one variable - multiple triggers - how?

Posted by Doopsko on Sat 16 Oct 2004 09:19 AM — 3 posts, 13,021 views.

#0
Hi
I've got a problem with variables.
I want to do few triggers that will change one variable. I mean:
When I see 2 ways out: nw and ne I want set variable "position" to 1
When I see 2 others ways out: w and nw I want set variable "position" to 2
etc.

I wrote something like this but it doesn't work, because a name of variable is at once a name of trigger:
'World.AddTriggerEx "position", ": nw and ne", "3", 49, -1, 0, "", "", 9, 50
'World.AddTriggerEx "position", ": w and nw", "4", 49, -1, 0, "", "", 9, 50
'World.AddTriggerEx "position", ": ne, sw and e", "5", 49, -1, 0, "", "", 9, 50

I've found a specific place in my mud world and I want write a script that will know where I exactly am at the moment.

I want to write a nice-looking script, I dont want it to be like that:

<trigger
enabled="y"
match="nw and w"
send_to="10"
sequence="100"
>
<send>/world.setvariable &quot;position&quot;, &quot;1&quot;</send>
</trigger>

By the way Is it possible to write triggers available only for script? I dont want to see them in my Triggers Menu.

Thanks a lot for help.
USA #1
You had the right idea at the end there.
Use setvariable, get rid of the / (your script prefix) and change the "send to" dropdown box to "script".

Or you could write some logic to match on any directions, and then calculate your number.

And no, there is no way to "hide" triggers.
Although you could put them in a plugin. Then they would be in the plugin and not in the world file's triggers.

You know, you can also make triggers without a name (so you dont get the conflict, or make them named something informative) and then send to variable and use the "variable" box.
But the scripting solution is the way most of us do it, I think.

And are you trying to create new triggers from the command line? Those AddTrigger commands are designed to be used by a script, not really by people. Its easier to use the trigger interface. You get all the functionality (addtrigger cant set certain things).
Amended on Sat 16 Oct 2004 05:54 PM by Flannel
Australia Forum Administrator #2
Quote:

By the way Is it possible to write triggers available only for script?


If you don't want to see them in your triggers list, you can put them into a plugin. This is really easy to do - first get them right in the usual place, then use the plugin wizard to move them to a plugin. That way you won't see them in the list but (provided you install the new plugin) they will have the same effect.