Use return value from a lua function as a PE condition menu

User Tag List

Results 1 to 4 of 4
  1. #1
    Filint's Avatar Contributor Authenticator enabled
    Reputation
    167
    Join Date
    Mar 2014
    Posts
    97
    Thanks G/R
    23/56
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Use return value from a lua function as a PE condition

    Hey.

    Let's imagine I have a function myFunc. Pseudocode:
    Code:
    function myFunc()
      if whateveriwanttocheck > whatever then
        return true
      end
      return false
    end
    How do I use the result from myFunc in a ProbablyEngine?
    Code:
    ...
    {"Random ability", myFunc()} --Doesn't work
    ...
    {"Random ability", (function() return myFunc() end)} --Obviously doesn't work either ;)
    There must surely be a way.

    Cheers
    Last edited by Filint; 11-23-2014 at 03:42 PM.

    These ads disappear when you log in.

  2. #2
    ImogenOC's Avatar Contributor ProbablyEngine Community Manager
    Reputation
    173
    Join Date
    Nov 2013
    Posts
    364
    Thanks G/R
    0/8
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Filint View Post
    Hey.

    Let's imagine I have a function myFunc. Pseudocode:
    Code:
    function myFunc()
      if whateveriwanttocheck > whatever then
        return true
      end
      return false
    end
    How do I use the result from myFunc in a ProbablyEngine?
    Code:
    ...
    {"Random ability", myFunc()} --Doesn't work
    ...
    {"Random ability", (function() return myFunc() end)} --Obviously doesn't work either ;)
    There must surely be a way.

    Cheers
    Indeed!
    Register your function inside the rotation.lua w/
    Code:
    ProbablyEngine.library.register('functionName', {
    if function
    then function
    else function
    end
    end
    end})

    So if I wanted to do... Say, heal a raid, it's easily accomplished by
    Code:
    ProbablyEngine.library.register('coreHealing', {
      needsHealing = function(percent, count)
        return ProbablyEngine.raid.needsHealing(tonumber(percent)) >= count
      end,
      needsDispelled = function(spell)
        for _, unit in pairs(ProbablyEngine.raid.roster) do
          if UnitDebuff(unit.unit, spell) then
            ProbablyEngine.dsl.parsedTarget = unit.unit
            return true
          end
        end
      end,
    })
    Wherein we can call to corehealing as

    Code:
    { "Spell", "@function.condition(x,y)", "target" },
    { "Tranquility", "@coreHealing.needsHealing(60, 4)", "lowest" },
    Where

    Spell = Spell Casted
    @ = Internal Func specified
    coreHealing = Func called
    .needsHealing = Condition
    (60, = Percentage
    4) = Player Count
    Lowest = Lowest Raid HP

    Hope that helps!
    Last edited by ImogenOC; 11-23-2014 at 07:09 PM. Reason: Syntax
    ProbablyEngine - Developer and Lead Support
    A Powerful Rotation Bot: ProbablyEngine

  3. #3
    Filint's Avatar Contributor Authenticator enabled
    Reputation
    167
    Join Date
    Mar 2014
    Posts
    97
    Thanks G/R
    23/56
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, thanks! It looks like this is exactly what I need, will try tomorrow and post back here.

    Thanks for the reply

  4. #4
    ImogenOC's Avatar Contributor ProbablyEngine Community Manager
    Reputation
    173
    Join Date
    Nov 2013
    Posts
    364
    Thanks G/R
    0/8
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Filint View Post
    Awesome, thanks! It looks like this is exactly what I need, will try tomorrow and post back here.

    Thanks for the reply
    My pleasure, hope it works out.
    ProbablyEngine - Developer and Lead Support
    A Powerful Rotation Bot: ProbablyEngine

Similar Threads

  1. Calling Lua Functions from DLL
    By Viano in forum WoW Memory Editing
    Replies: 19
    Last Post: 07-28-2009, 07:56 PM
  2. [GuaEngine][AddOn] Extra Useful LUA Functions
    By Claiver in forum WoW EMU General Releases
    Replies: 21
    Last Post: 05-16-2009, 05:13 PM
  3. [WoW][3.0.9] A way to get return values from Lua Functions
    By ramey in forum WoW Memory Editing
    Replies: 6
    Last Post: 03-22-2009, 10:09 PM
  4. [Guide] How to use local LUA function!
    By Dartignan in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 08-05-2008, 09:28 PM
All times are GMT -5. The time now is 03:29 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2023 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2023 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search