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
Shattuc
Beginner


Joined: 30 May 2007
Posts: 13

PostPosted: Wed May 30, 2007 10:22 pm   

#IF
 
Ok, I've reviewed the included help repeatedly... if I use the help included EXACTLY as it's listed in the help file, it doesn't work.
all I want to do is look in a container and have it echo back that there is enough of an item, or that there isn't enough of an item.

look in belt
(somewhere in the return it says) 'strips of cloth'
if the line is 'many strips of cloth' echo Bandage count ok
if the line is '(anything but many) strips of cloth' echo bandages needed

I realize it needs a trigger to recognize the line, and every way I've tried to write it, it returns both bandage count ok and bandages needed.

there are many places I'd like to use the #IF command to check a line,

I'd rather not create 20 triggers that trigger on the words one through twenty to return bandages needed
if I have many strips of cloth my bandage count is fine, if I have anything other than 'many' I need bandages.

please help me understand how to use #IF to where it will execute X command if the line is true, and Y command if it is not.

Thank you.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed May 30, 2007 10:27 pm   
 
Try this:

#trig {(%w) strips of cloth} {#if (%1 != "many") {#echo need bandages}}

You might have to change %w to * if the response can be more than one word. If this doesn't work, seeing the exact output, both when you have enough and when you have too few, would probably help.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Wed May 30, 2007 10:30 pm   
 
#trigger {'(*) strips of cloth'} {#if ("%1"="many") {#echo Bandage count ok.} {#echo Bandages needed.}}
_________________
Taz :)
Reply with quote
Shattuc
Beginner


Joined: 30 May 2007
Posts: 13

PostPosted: Wed May 30, 2007 10:33 pm   
 
ok, so it doesn't execute one statement if it is true, or execute the second statement if it is false like the help file says it does.
you have to enter in each test state with a response if the state is true.
this did fix it, but I have one last question semi related.

how can I get the echo need bandages to blink bold red?
Reply with quote
Shattuc
Beginner


Joined: 30 May 2007
Posts: 13

PostPosted: Wed May 30, 2007 10:35 pm   
 
nevermind, fixed it with a different trigger, thanks anyways.
and thanks for helping me with the #if syntax
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed May 30, 2007 10:37 pm   
 
It does work that way, I just chose not to word it like that in my example since you don't need a reminder when it's true. Taz's example does exactly the same thing as mine, but with a response if it's at the right level as well as if it's too low.

To get it to blink bold red, you use the #color command. Just do #color blink,bold,red as part of the trigger - if you only want it to do that when you're out of bandages, just add it to relevant part of the #if command.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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