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
Maximus
Wanderer


Joined: 21 May 2001
Posts: 59
Location: USA

PostPosted: Wed Mar 05, 2003 6:48 pm   

Equality of string variables
 
I feel really stupid for forgetting this, as I had it working at one time, but here's the problem:

Room names on my MUD appear in a unique color. So, I have a trigger with the pattern ^(*).

I then set the Line Color porperty and the trigger fires just fine on all room names. Now, the problem comes in what actually happens inside that trigger. I have a variable RoomName that has the name of an important room. What I want to do is test whether the room name sent from the MUD matches RoomName. Currently I have:

#IF (@RoomName = %1) {#SAY Yes} {#SAY No}

Problem is, this always returns true, even if @RoomName and %1 are obviously not equivalent strings (I've had it output both upon triggering to make sure it was testing the right things).

How od I do this porperly?

-Maximus
Reply with quote
Maximus
Wanderer


Joined: 21 May 2001
Posts: 59
Location: USA

PostPosted: Wed Mar 05, 2003 6:55 pm   
 
Hmm, okay, so I just tried this:

#IF (%eval(%1) =~ %eval(@RoomName)) {yada} {yada}

...and it works. But is this the best solution? I don't remember having to do this.

-Maximus
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Mar 05, 2003 9:02 pm   
 
Surround the %1 with double quotes:
#IF (@RoomName = "%1") {#SAY Yes} {#SAY No}

Kjata
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