Simimi2006-11-05 18:32:00
well now we have...
SetVariable ("currenthealth", "%1")
SetVariable ("currentmana", "%2")
SetVariable ("currentego", "%3")
if @currenthealth <= (.80 * @maxhealth) and @potionbalance == " true " then
Send ("drink health")
end
Which is supposed to trigger off of
and when I drink health, I get...
:1: bad argument #2 to `SetVariable' (string expected, got boolean)
stack traceback:
: in function `SetVariable'
:1: in main chunk
...
CODE
SetVariable ("currenthealth", "%1")
SetVariable ("currentmana", "%2")
SetVariable ("currentego", "%3")
if @currenthealth <= (.80 * @maxhealth) and @potionbalance == " true " then
Send ("drink health")
end
Which is supposed to trigger off of
CODE
^(\\d+)h\\, (\\d+)m\\, (\\d+)e(.*)\\-$|^(\\d+)h\\, (\\d+)m\\, (\\d+)e\\, (\\d+)p\\, (\\d+)en\\, (\\d+)w\\ (.*)\\-
I have them both, cause sometimes I use both...and when I drink health, I get...
CODE
:1: bad argument #2 to `SetVariable' (string expected, got boolean)
stack traceback:
: in function `SetVariable'
:1: in main chunk
...
Tervic2006-11-05 22:10:32
QUOTE(Simimi @ Nov 5 2006, 09:02 AM) 351070
Well since all of my variables are in the lusternia2.mcl file, and are all stored in the variables box on Mush...that makes them all world variables, right?
This is (or at least should be) correct.
QUOTE(Acrune @ Nov 5 2006, 10:14 AM) 351090
if (@currenthealth < (.85 * @maxhealth)) and (@potionbalance = "true")) then
you have an extra ) at the end
you have an extra ) at the end
I wrote that snippet, and it's actually one missing at the beginning.
Should be as follows (with spaces added to make the groupings more obvious):
if ( (@currenthealth < (.85 * @maxhealth)) and (@potionbalance = "true") ) then
And with regards to the most recent question:
try removing the quotes from around the %1? I'm not sure because I'm unfamiliar with the nuances of lua, but I know mine occasionally flips out at me if I leave quotes where they should not be.
Another option would be to have 2 triggers targetting the same line, and you make them "Keep evaluating" (little checkbox in mush) so that they don't override eachother, and then use current health mana and ego as world variables. *shrug* zarquan certainly knows a lot more about this than I do.
Acrune2006-11-05 23:03:35
QUOTE(Tervic @ Nov 5 2006, 05:10 PM) 351180
I wrote that snippet, and it's actually one missing at the beginning.
In lua, adding one to the front or removing one from the end should both fix it. It keeps looking at the condition until the 'then' is encountered, I think.
Simimi2006-11-05 23:04:43
This works...
SetVariable ("currenthealth", "%1")
SetVariable ("currentmana", "%2")
SetVariable ("currentego", "%3")
if EnableTriggerGroup ("autohealer" , true) then
end
if @currenthealth <= (.85 * @maxhealth) and @potionbalance ==  true  then
Send ("drink health")
end
CODE
SetVariable ("currenthealth", "%1")
SetVariable ("currentmana", "%2")
SetVariable ("currentego", "%3")
if EnableTriggerGroup ("autohealer" , true) then
end
if @currenthealth <= (.85 * @maxhealth) and @potionbalance ==  true  then
Send ("drink health")
end