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


Joined: 10 Oct 2005
Posts: 24

PostPosted: 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?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Nurodma
Beginner


Joined: 10 Oct 2005
Posts: 24

PostPosted: Thu Jul 12, 2007 4:06 am   
 
Adding the space made it work perfectly, thank you.
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