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


Joined: 06 Apr 2003
Posts: 15

PostPosted: Sat Sep 20, 2003 11:40 am   

#if bug? or am i to stupid for?
 
i have this 2 Vars:
#VAR team_member {2}
#VAR team_ang_pid {0} {0}

an this piece of code

#if (@team_member!=2) {
#SAY "Du bist kein Teamleiter!"
#color bold,red
} {
#IF (%1="" AND @team_ang_pid>0) {
team rufe Team Angriff abgebrochen!
team_ang_pid=0
} {
#IF (%1!="" AND %1>0) {
team_ang_pid=1
team rufe --- %1 ---
#wait 1000
team_angriff %eval( %1-1)
} {
team angriff
team_ang_pid=0
}
}
}

My prob in v6.40 is that altough the var team_ang_pid is 0, i get into the second if-Block (starting the alias with no parameters). But the Expression in the if statement says larger 0

So is this a bug, or have i make a simple mistake?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Sep 20, 2003 3:26 pm   
 
It's a common mistake. If you have no parameters, the second IF expression becomes:
(="" AND @team_ang_pid>0)
and zMUD doesn't know how to parse it. The solution is to use %numparam() instead.
#if (@team_member!=2) {
#SAY "Du bist kein Teamleiter!"
#color bold,red
} {
#IF (%numparam() = 0 AND @team_ang_pid>0) {
team rufe Team Angriff abgebrochen!
team_ang_pid=0
} {
#IF (%1>0) {
team_ang_pid=1
team rufe --- %1 ---
#wait 1000
team_angriff %eval( %1-1)
} {
team angriff
team_ang_pid=0
}
}
}
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