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


Joined: 20 Jan 2006
Posts: 5

PostPosted: Sun Mar 05, 2006 3:16 am   

Help with comparing strings.
 
Here's the trigger pattern.

(*) says 'I suggest you travel to (*).'

Then this is to compare the area he puts.

#if (%2="Valley of the Elves") {valley} {}
#if (%2="Sewer") {sewer} {}
#if (%2="New Ofcol") {newofcol} {}
#if (%2="Ultima") {ultima} {}
#if (%2="Crystal Tokyo EX") {ct} {}
#if (%2="The Labyrinth") {lab} {}
#if (%2="High Tower of Sorcery") {htos} {}
#if (%2="Gnome Village") {gnome} {}

the true's are aliases to walk there.

For some reason, it executes them all if the area isnt recognized, and sometimes even if it is, any ideas?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Mar 05, 2006 3:35 am   
 
#if ("%2"="Valley of the Elves") {valley}

Delimeters are your friends. Those quotes inform zMud that you want to compare then entire contents of %2 with the other string instead of having something evaluate like this:
Code:
Valley of the Elves="Valley of the Elves"    First bunch of words meaningless
Elves="Valley of the Elves"                  Not true becomes 0, end of expression final step
Valley of the 0                              Expression is non-null and non-zero, therefore true
Also the false portion of the #IF command is optional. If you are not going to do anything there you should leave it out for faster processing time.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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