Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
dread211
Newbie


Joined: 12 Feb 2002
Posts: 1
Location: Australia

PostPosted: Tue Feb 12, 2002 2:12 am   

TRIGGERS
 
I must be dumb or something. I have used
tintin for years, but I recently got zmud and
I can only get the triggers to partially work. I want my char to say and do certain
things when other players interact with it.
For example, if another player looks at my
char I want the char to say "Hi" and then
shake the player's hand, but I need to know
how to make it do that to EVERY player.
Please help cos I'm tearing my hair out.
PS: I have read the help files, but no luck.


Ajax McCoy
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Tue Feb 12, 2002 3:36 am   
 
Sounds like you need to read the Pattern Matching Section.There are all sorts of 'wildcard' characters you can use to make a trigger match a given line.For instance:
#TR {%1 says, 'Hello'} {say Hello %1!}
will do like you said, and greet everyone and anyone who says 'Hello', but you could also make it match more, such as:
#TR {%1 says, 'Hello, %2!'} {say Hi;grin %2)
will make you say hi, and then grin at whoever the person was talking to.
Another helpful(and dangerous) wildcard is (%*) which will match any and all character's.
Just goto help, and search using the keyword 'pattern' and it will give you a list of all the available wildcards
Reply with quote
einar
Wanderer


Joined: 06 Nov 2000
Posts: 80
Location: USA

PostPosted: Tue Feb 12, 2002 3:36 am   
 
Well, it would help if you gave us some info on what the output from your MUD looks like.
If you get something like this:
Bob looks at you.
Then you would need a trigger like:
#TR {(%w) looks at you.} {hi;shake %1}
This is assuming that just typing "hi" will do the "Hi" emote, and typing "shake Bob" will shake bob's hand.
You should probably be able to figure it out from there, if not you should post the mud output, and exactly how you type the commands in.

Reply with quote
einar
Wanderer


Joined: 06 Nov 2000
Posts: 80
Location: USA

PostPosted: Tue Feb 12, 2002 3:39 am   
 
Wow, I was still typing mine when you were... fear how close we were...
But how can %1 capture something as a wildcard? I thought that was where the variable was held, and to capture them you need to use (*) (%d) (%w) and so on...

Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Tue Feb 12, 2002 4:33 am   
 
Not quite certain...was just looking at the pattern maching list and noticed that it wasnt there...but i use them in almost all my script Dont even know where i picked that up, its just how ive been writing my script from the get go...
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Tue Feb 12, 2002 5:04 am   
 
Using %1...%99 in your pattern will work, but it's considered poor form -- primarily because it is non-discriminating and will match anything. Using specific pattern matching symbols is much more secure.

Regarding dread211's original question:

Dread211, you should take the message that your MUD puts out and use that to make your pattern. If, for example, a typical message is: Strider looks at you. then your pattern would be (%w) looks at you. The (%w) is a pattern matching symbol which matches a single word, in this case somebody's name. In the value for the trigger, you might use say Hello %1; shake %1 The name captured from the pattern is placed in the %1 parameter. To enter this from the command line use:

#TR {(%w) looks at you.} {say Hello %1; shake %1}

Good Luck!

Troubadour
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Tue Feb 12, 2002 5:14 am   
 
So what your basically telling me is that I'm a sloppy script writer,huh? J/k.
Basically its just another way to write (*), correct?How is that poor form?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Feb 12, 2002 12:28 pm   
 
The problem is that the result in using %1..%99 in a pattern is undefined. In some cases it works just fine, but I remember someone that posted a while back with a script that used %1 in the pattern, some very strange stuff was happening and it was all because of the %1.

Kjata
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net