AddTrigger

Posted by tobiassjosten on Tue 17 May 2005 09:49 PM — 4 posts, 16,356 views.

Sweden #0
Don't know if this is a LUA-bug or a MC-bug, but here goes.. When I try to use the AddTrigger command from an "external" lua-file of mine, it wont add the trigger if its name collides with the script-part of another one. Got a trigger named "" which executes "balLostHerb", and I wanted to add a trigger named "balLostHerb". It didn't let me (no message or anything), until I tested to change the name to "balaLostHerb".
Australia Forum Administrator #1
Not sure if I know what you mean by the script-part. Can you post the actual AddTrigger command?
Sweden #2
It's gone, I'm afraid, but I could try to explain.. Let say we have a trigger looking like this:
<trigger
  enabled="y"
  keep_evaluating="y"
  match="^whatever$"
  regexp="y"
  script="theScript"
  sequence="100">
</trigger>

Then MUSHclient wont let me do the command:
AddTriggerEx ("theScript", "* attacks", "You are under attack!", trigger_flag.Enabled, custom_colour.Custom15, 0, "", "", 12, 50)

..because the new trigger's name collides with the above trigger's associated function's name. See what I mean?
Australia Forum Administrator #3
I successfully added that trigger.

What error code did you get from the AddTriggerEx?

Unless you have the "replace" flag on you cannot add the same named trigger twice, perhaps that is what is happening?

Also, if you specify a script routine the script must exist.