|
Shattuc Beginner
Joined: 30 May 2007 Posts: 13
|
Posted: 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. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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. |
|
|
|
Taz GURU
Joined: 28 Sep 2000 Posts: 1395 Location: United Kingdom
|
Posted: Wed May 30, 2007 10:30 pm |
#trigger {'(*) strips of cloth'} {#if ("%1"="many") {#echo Bandage count ok.} {#echo Bandages needed.}}
|
|
_________________ Taz :) |
|
|
|
Shattuc Beginner
Joined: 30 May 2007 Posts: 13
|
Posted: 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? |
|
|
|
Shattuc Beginner
Joined: 30 May 2007 Posts: 13
|
Posted: 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 |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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. |
|
|
|
|
|