Ok, so I have the following script:
This is supposed to keep me from inadvertantly wasting my health elixirs by drinking when they would be ineffective, instead creating a trigger that would make me drink the elixir when the game notifies me that I can do so. The trigger is supposed to delete itself by calling the function autoheal_off:
It sets up the trigger just fine, and when the trigger fires, it sends the ColourNote specified by the autoheal_off function, but it doesn't delete the trigger.
I also have an alias to call the autoheal_off function, and when I use the alias, the script functions properly, sending the note and deleting the trigger.
Why does the function autoheal_off delete the trigger when called by an alias, but not when called by the trigger it is intended to delete?
function drink_health (name, line, wildcards)
if vitals.elixbal == 1 then
Send("DRINK HEALTH")
else
ColourNote("black", "white", "You will sip when the previous elixir clears your system.")
AddTriggerEx ("healwhenable", "You may drink another health or mana elixir.", "DRINK HEALTH", trigger_flag.Enabled + trigger_flag.KeepEvaluating, custom_colour.NoChange, 0, "", "autoheal_off", 0, 100)
end -- if
end -- function drink_health
This is supposed to keep me from inadvertantly wasting my health elixirs by drinking when they would be ineffective, instead creating a trigger that would make me drink the elixir when the game notifies me that I can do so. The trigger is supposed to delete itself by calling the function autoheal_off:
function autoheal_off (name, line, wildcards)
ColourNote("silver", "red", "Autoheal OFF")
DeleteTrigger ("healwhenable")
end -- function aheal_off
It sets up the trigger just fine, and when the trigger fires, it sends the ColourNote specified by the autoheal_off function, but it doesn't delete the trigger.
I also have an alias to call the autoheal_off function, and when I use the alias, the script functions properly, sending the note and deleting the trigger.
Why does the function autoheal_off delete the trigger when called by an alias, but not when called by the trigger it is intended to delete?