|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Mon Dec 10, 2007 6:37 am
Triggers and Timers |
I want to create a trigger that will become triggered wait 5 seconds and then do what I want it to do.
Example: Type Yellow 5 seconds after you see green
Output: Green
1 second
2 second
3 second
4 second
5 second
Produce: Yellow
Is this possible? If so how do I do it? |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Dec 10, 2007 6:51 am |
Sure is... all you have to do is the following:
#TRIGGER {Green} {#ALARM +5 {Yellow}}
Of course, Green is your trigger, and Yellow is the command you want done.
Charneus |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Dec 10, 2007 11:13 pm |
There's an even better way to do that, Charneus.
#trigger {Green} {}
#condition {} {Yellow} "wait|param=5000"
Just gotta remember that just like #WAIT, the time format is in milliseconds instead of in X.Y seconds like with #ALARM. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Tue Dec 11, 2007 3:42 am |
Quick question where do I type this?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 11, 2007 3:50 am |
On the command line. The #trig command creates a trigger.
|
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Tue Dec 11, 2007 3:58 am |
What command line, I am really confused. I am new to Zmud.
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Dec 11, 2007 5:39 am |
The command line is what you type all your commands in... the ones you send to the MUD. Traditionally, it's the white rectangle located at the bottom of your screen. Just copy/paste that into that box, hit enter, and you're set. :)
Charneus |
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Tue Dec 11, 2007 6:31 am |
put wont that only let the trigger work once, i want it to be globally set
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Tue Dec 11, 2007 6:42 am |
No, that creates it from there instead of having to manually use the trigger editor.
If you're worried about it poofing, you can always do #SAVE afterwards, which forces all settings in current session to save.
Also, if you're using this for color chatting you may want to look in the finished scripts, I recently posted my random color chat alias... could give you ideas. |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
Churlant Novice
Joined: 17 Oct 2002 Posts: 44 Location: USA
|
Posted: Tue Dec 11, 2007 3:38 pm |
I'm not sure what the trigger is for, but wouldn't the given suggestions cause a 5 second wait and "yellow" be sent to the mud after literally every instance of the word "green"?
That may or may not be desired... I guess it depends on what exactly you're trying to accomplish wsanno :)
-JC |
|
_________________ >-Churlant-< |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 11, 2007 4:43 pm |
It'll do that, yes, but that's what was asked - "I want to create a trigger that will become triggered wait 5 seconds and then do what I want it to do". If that answer doesn't solve his problem, I'm sure he'll ask a different question ;)
|
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Tue Dec 11, 2007 5:18 pm |
In this mud I play there is this door. And it says, "Who shall enter?" You have to wait exactly 5 seconds and answer "I shall". If you are off it asks again and it is really annoying. Everyone tells me they just trigger it but I used the ZMud trigger function but it outputted "I shall" instananeously. I need it to wait 5 seconds. I am trying to make it so every time i log into ZMud this will already be done. I hope that clears things up.
I just don't know much about ZMud, I am trying to learn, so I do not know where and what to do so if someone is nice enough to answer, as you all have been thus far, be as detailed as you can.
Thanks |
|
|
|
Churlant Novice
Joined: 17 Oct 2002 Posts: 44 Location: USA
|
Posted: Tue Dec 11, 2007 5:59 pm |
#TR {Who shall enter?} {#WA 5000;say I shall}
That would work, assuming your input function is a "say" command. |
|
_________________ >-Churlant-< |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Dec 11, 2007 6:13 pm |
Don't use #wait. It is such a buggy function. Your best bet is to go with what I or MattLofton suggested. To recap:
#TRIGGER {Who shall enter?} {#ALARM +5 {say I shall}}
OR
#TRIGGER {Who shall enter?} {}
#COND {} {say I shall} {Wait|Param=5000}
But #WAIT should be used sparingly, as it can throw off a lot of your scripts.
Charneus |
|
|
|
Churlant Novice
Joined: 17 Oct 2002 Posts: 44 Location: USA
|
Posted: Tue Dec 11, 2007 6:53 pm |
Out of curiosity, what kind of bugging does it do? I actually use wait in more than a few scripts, although usually in regard to a repeating function (repeating a #Beep 3 times in 5 seconds intervals, for example). I haven't used it in more complex formats, probably for lack of necessity.
Which is a good thing I guess
-JC |
|
_________________ >-Churlant-< |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 11, 2007 7:09 pm |
The only circumstance you should use #wait in is to delay looping, and only when you know the problems I'm about to describe don't apply.
The problem with wait is this. Imagine you have the trigger you gave above - what happens if the message is sent twice one second apart? The trigger is already waiting and paused, but now it needs to fire and wait again. Should the extra time add a delay, or should it create another waiting instance of the trigger, so the command is sent twice in a row? Added to this is the fact that waiting like this isn't trivial (you wouldn't want the GUI to hang while a trigger is waiting, for example, so the GUI has to keep running, but the windows message queue is only a single queue). It's much more complex than you'd think, which is why it causes problems. Alarms allow for all these options, which is why we suggest using them instead. This problem is most obvious with triggers, since you're not in control of when they run, but applies to aliases and such as well.
CMUD avoids these issues (from v2) by having each trigger containing #wait run in its own thread. That way more than one thing (including multiple instances of the same trigger) can be running simultaneously. |
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Tue Dec 11, 2007 7:25 pm |
So I just type that into the command line and I am good to go? I have no idea where to input this trigger. Is there like a section I add it to liek creating an alias or a trigger in the simple form?
|
|
|
|
Churlant Novice
Joined: 17 Oct 2002 Posts: 44 Location: USA
|
Posted: Tue Dec 11, 2007 8:29 pm |
Command line will work fine. Your ZMud probably has the Trigger Button on the top bar (Says "Triggers" with a little icon of a gun) that you can click on to view any triggers you may have. If they're assigned to a class, the settings window that pops up will have folder icons with names. In this case the example Charneus gave you will just create a trigger in the open file and not inside a class folder.
I find it's easier to add triggers through the command line than putting one in manually by opening the Trigger settings and creating one from there, but it may not be safer. If you enter a trigger (or alias for that matter) directly though the command line that has parsing errors, weird things could be created in all sorts of different formats (variables, aliases, triggers, etc).
On a side note, thanks Fang for the info above. i actually tried to switch over to CMud a few months ago, but I'll admit it didn't go so well. After looking at the support info here I found out the reason was due to my extensive use of %1 type expressions in the scripts I've written...
-JC |
|
_________________ >-Churlant-< |
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Wed Dec 12, 2007 12:06 am |
It is not working on my command line, so how will I go about another way of doing this. When I paste it into a trigger it says there is a syntax error and points to the bracket so please help.
|
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Wed Dec 12, 2007 3:42 am |
Okay, whew - I am not crazy. I tried the advice on another Mud and it works. However, it does not work on my Mud. When the triggered event happens "Who shall enter" instead of it waiting and then say I shall. It outputs {#ALARM +5 {say I shall}} right away. How can I get around this?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Dec 12, 2007 3:47 am |
It sounds like somehow you turned parsing off. It is a little computer icon to the right of your commandline that indicates this. If it has a red X over it then it is off and your need to either click it or press CTRL-R to turn it on.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Wed Dec 12, 2007 3:57 am |
Parsing is on
|
|
|
|
ralgith Sorcerer
Joined: 13 Jan 2006 Posts: 715
|
Posted: Wed Dec 12, 2007 4:15 am |
Delete the trigger and redo it from the command line.
Then repost here if it still fails out (with an excerpt of the screen text plz) |
|
_________________ CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate |
|
|
|
wsanno1 Beginner
Joined: 10 Dec 2007 Posts: 10
|
Posted: Wed Dec 12, 2007 4:19 am |
Paste:
#TRIGGER {Who shall enter?} {#ALARM +5 {say I shall}}
What?
End Paste |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Dec 12, 2007 5:36 am |
I assume that the "What?" is returned from your MUD as a "You entered a command I didn't understand" message?
The #trigger command should never be sent to your MUD - the only time that should happen is if you have parsing off. Double-check that it's on - if that doesn't work, try some other zMUD commands like #say, #echo, #gag and see if they do what they're supposed to or if they get sent to the MUD. If parsing really is on and stuff is being sent to the MUD, check the "Parse" option on the Settings menu. If it's definitely on, you should try reinstalling zMUD (none of your data will be lost). |
|
|
|
|
|