Is this something I should be worried about?Contrary to tempTimers, tempTriggers lives throughout the entire session until it is explicitly disabled or killed.
Temp Trigger
Temp Trigger
I don't understand how it's done from reading the manual. Can anyone give me an example? I'm gonna do it for my Achaea antitheft where armour needs balance so I would do wear armournumber when I remove my armour only after I see You have recovered balance on all limbs. Also, reading from the manual,
Re: Temp Trigger
When you call tempTrigger(), it returns a trigger ID that you can use to enable/disable/kill the trigger later on.
For example, you might do something like this
Which would create a trigger that would rewear your armour when you regain balance, and then delete it again after 10 seconds.
Wyd
For example, you might do something like this
Code: Select all
Trigger:
You remove some armour.
Script:
remove_trigger_id = tempTrigger("You have recovered balance on all limbs.", [[ send("wear armour") ]])
tempTimer(10.0, [[killTrigger( ]] .. remove_trigger_id .. [[)]])
Wyd
Re: Temp Trigger
How about if I wanna kill it when I have this message "You are now wearing a suit of some armour."?
Re: Temp Trigger
Simply remove the tempTimer() line, and instead create another tempTrigger, which delete both triggers
For example
The bit at the end is a little confusing, but basically all it does is calls the killTrigger() functions with the two temp trigger ids
For example
Code: Select all
Trigger:
You remove some armour.
Script:
balance_trigger_id = tempTrigger("You have recovered balance on all limbs.", [[ send("wear armour") ]])
wear_trigger_id = tempTrigger("You are now wearing a suit of some armour.", [[ killTrigger(]] .. balance_trigger_id .. [[) killTrigger(]] .. wear_trigger_id .. [[)]])
Re: Temp Trigger
Okay, I have this now.
But every time I regain my balance, weirdly it still tries to wear my worn mail. It should have killed it when I did You are now wearing a suit of scale mail. so... What's wrong with this now?
Code: Select all
if matches[2] == "a suit of scale mail" then
remove_armour_trigger_id = tempTrigger("You have recovered balance on all limbs.", [[ send("wear " .. myarmour) ]])
wear_armour_trigger_id = tempTrigger("You are now wearing a suit of scale mail.", [[killTrigger(]] .. remove_armour_trigger_id .. [[) killTrigger(]] .. wear_armour_trigger_id .. [[)]])
elseif table.contains(wornitems, matches[2]) then
table.insert(wearqueue,1,wornitems[matches[2]])
rewear()
end
Re: Temp Trigger
[quote="Wennef"]Okay, I have this now.
Code: Select all
remove_armour_trigger_id = tempTrigger("You have recovered balance on all limbs.", [[ send("wear " .. myarmour) ]])[/quote]
Your error is that the trigger script will use the value of myarmour from back when the trigger was made. If you want to use the actual value of this variable at the time the script is run you'll need code like this: _G["myarmour"] - _G is the global table where Lua stores all variables and functions.
Re: Temp Trigger
So, I just change that to this?
I changed to that and still I rewear on balance even if I've already worn the mail.
Code: Select all
remove_armour_trigger_id = tempTrigger("You have recovered balance on all limbs.", [[ send("wear " .. _G["myarmour"]) ]])
Re: Temp Trigger
In that case, it seems like the tempTimer/killTrigger functions aren't firing.
If you haven't fixed it by the time I get home, I'll take a look
If you haven't fixed it by the time I get home, I'll take a look
Re: Temp Trigger
T_____T Yeah still not working. >.> it's easier in zmud but I wanna learn mudlet.
Re: Temp Trigger
Are you sure that you have the wearing message correct?
Also, you need a semi-colon (;) between your killTrigger commands otherwise it is read as one command rather than 2, so it won't fire.
Furthermore, what is the rewear function that is being called at the end? Just curious.
Also, you need a semi-colon (;) between your killTrigger commands otherwise it is read as one command rather than 2, so it won't fire.
Furthermore, what is the rewear function that is being called at the end? Just curious.