|
Nurodma Beginner
Joined: 10 Oct 2005 Posts: 24
|
Posted: Thu Jul 12, 2007 3:41 am
If checks |
i am running zmud 7.21
This if check is giving me problems. Instead of performing the if check it sends it to the mud as a command.
This is the trigger I am trying to use:
Code: |
#TRIGGER {You report: */1237 hp (%n)/1806 mana} {#if %n<1700 {#4 q blue portal;stat}{say Quaffing complete!;#t- quaffup}}
|
This is what appears on my screen:
Code: |
You report: 1237/1237 hp 1690/1806 mana 685/685 mv 147066817 xp.
{#4 q blue portal;stat}{say Quaffing complete!;#t- quaffup}
Your base stats: 12 str 17 int 17 wis 11 dex 13 con 10 cha 15 lck.
Your current stats: 18 str 25 int 22 wis 15 dex 12 con 11 cha 16 lck.
Huh?
|
Can anyone tell me why it isn't performing the if check like it is supposed to? |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 12, 2007 3:58 am |
The main problem is that you haven't got a space where you need one. It should be
#if (expression) {true} {false}
and not
#if (expression) {true}{false}
Spaces are important in zScript syntax. Some minor problems are that %n matches a comma-spaced number, which shouldn't matter with values below 1000 but might matter when you level up more. Consider using %d instead. Also, when you want to refer to them later, you use a number - wildcards that you've put brackets around are numbered from left to right based on the position of their opening bracket. In this case, when you want to refer to the %n wildcard, you need to use %1.
Also, some expressions need to be surrounded in brackets () like the example of the #if syntax I gave above. This one probably doesn't, but it's something to remember. |
|
|
|
Nurodma Beginner
Joined: 10 Oct 2005 Posts: 24
|
Posted: Thu Jul 12, 2007 4:06 am |
Adding the space made it work perfectly, thank you.
|
|
|
|
|
|