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
snorkymn
Newbie


Joined: 16 Jun 2006
Posts: 4

PostPosted: Fri Jun 16, 2006 5:50 pm   

Silly Trigger question
 
How do I differentiate in a trigger when I have the following two lines..

You see traces of your quarry to the north
You see traces of your quarry to the northeast

Right now the trigger for north will also go off for northeast as well.

I tried looking through other posts and searching a bit, but can't see how to tell it end of line or something.
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Fri Jun 16, 2006 6:34 pm   
 
One trigger will be able to be used for both situations you simply need to capture the word which can change and then perform an #IF on it, something like this:
Code:
#TRIGGER  {You see traces of your quarry to the (%w)}  {#IF (%1="north") {#ECHO The word north was detected, place the commands you want if this occurs inside these brackets} {#ECHO The word north was NOT detected, place the commands you want if this occurs inside these brackets}}

That code was off ther top of my head so it is untested, use the zMud help Files to better understand the commands used and also take a look at the 'Pattern matching' section.
Reply with quote
snorkymn
Newbie


Joined: 16 Jun 2006
Posts: 4

PostPosted: Fri Jun 16, 2006 6:54 pm   
 
Hmm.. There are actually about 8 directions, can you do if statements for all choices?
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Fri Jun 16, 2006 7:02 pm   
 
Ther are many ways you can process the information, What are you actually trying to do?
Reply with quote
snorkymn
Newbie


Joined: 16 Jun 2006
Posts: 4

PostPosted: Fri Jun 16, 2006 7:04 pm   
 
Well basically if it says a mob is a certain direction, go that direction.
Reply with quote
Ceres
Wanderer


Joined: 25 May 2006
Posts: 88

PostPosted: Fri Jun 16, 2006 8:00 pm   
 
This should do what you want:
Code:
#TRIGGER  {You see traces of your quarry to the (%w)}  {%eval(%1)}

Personally I wouldn't use a trigger to do that automatically but each to their own...
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Jun 16, 2006 11:30 pm   
 
Even better, you can use a #CASE command (or %case() function, as applicable). Regardless of whether you use IF or CASE, you're going to need to track whether you have decided to go somewhere or not, and if so to disregard other such lines until after you've moved.
_________________
EDIT: I didn't like my old signature
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Sat Jun 17, 2006 3:55 pm   
 
#CASE only works in cmud right?
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Jun 17, 2006 4:14 pm   
 
Nope, #CASE predates CMud. You are thinking of #SWITCH, I believe.
_________________
EDIT: I didn't like my old signature
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Sat Jun 17, 2006 10:53 pm   
 
blah ur right lol my head is swimming.
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
Mixsel
Wanderer


Joined: 02 Feb 2003
Posts: 99
Location: Seattle, Wa

PostPosted: Sun Jun 18, 2006 1:24 pm   
 
Wouldn't this work?

#trigger {You see traces of your quarry to the &targetdir} {#echo mob went @targetdir Im gonna get that rascal!;@targetdir}

I always put in #echo in when im trying new stuff to help me figure out bugs.
OR i think this works also
#trigger {You see traces of your quarry to the (%w)} {#echo friggen chicken went %1;%1}
_________________
Spin
Reply with quote
snorkymn
Newbie


Joined: 16 Jun 2006
Posts: 4

PostPosted: Mon Jun 19, 2006 2:33 am   
 
Thanks, the simplest thing seeme dto be the last one you suggested Spin!
Reply with quote
porsche
Beginner


Joined: 23 Jul 2002
Posts: 22
Location: United Kingdom

PostPosted: Fri Jun 23, 2006 11:28 am   
 
How about using the $ at the end? So:

Code:
#TRIGGER  {You see traces of your quarry to the north$} { do stuff}
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