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


Joined: 17 Mar 2005
Posts: 1

PostPosted: Mon Mar 21, 2005 6:59 am   

variables and if and text
 
Hi

I`ve little two problems and dont known how to do it please help:
1. To check that variable is true of course we use = to check that variable is not true we can use != or <>. When variable is some text to check we use =~{TEXT} but what I can check that variable is not the text in {}

2. This problem I thing is related with the first one. How can I use IF inside another IF. Version:

#if (@temp = 1) {#say yes} {#if (@temp2 = 1) {#say YES} {#say NO}}

doesnt work.

HUB
P.S.

Sorry about my english ;/
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Mon Mar 21, 2005 11:49 am   
 
1)
#var temp {Something}
#IF (!(@temp =~ {TEXT})) {#echo true} {#echo false}

The above code should echo true.
We just enclose the pattern matching expression in brackets () and then negate it using the negation operator !

2)
It does work:
#if (@temp = 1) is true
it says "yes"
#if (@temp = 1) is false and #if (@temp2 = 1) is true
it says "YES"
#if (@temp = 1) is false and #if (@temp2 = 1) is false
it says "NO"
This is correct, what is that you wished to do with nested IFs?
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
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