Originally Posted by
Filint
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!