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


Joined: 11 Apr 2005
Posts: 17

PostPosted: Sat Feb 18, 2006 10:40 pm   

Clearing VAR's
 
I have a script that takes a multi-line trigger and adds the result to a variable, basically each hit is worth points, and the limb breaks at 7 points, 2 points for a kick, 1 for a punch

You can hit right arm | leg or left arm | leg. Once i hit 7 I want it to reset to 0, (of course, i might hit 8, if the count is 6 and a kick hits.) But the following doesn't seem to clear the VAR..

Anyone see what I'm doing wrong?


#CLASS {Limb Tracking}
#TRIGGER {^You let fly at @p with a snap kick.}
#COND {^You connect to the (*)!} {
#add %replace(%1," ") 2
#IF (@%replace(%1," ")=>7) {#var %replace(%1," ") 0}
}
#TRIGGER {^You ball up one fist and hammerfist @p.}
#COND {^You connect to the (*)!} {
#add %replace(%1," ") 1
#IF (@%replace(%1," ")=>7) {#var %replace(%1," ") 0}
}
#TRIGGER {^You form a spear hand and stab out towards @p.}
#COND {^You connect to the (*)!} {
#add %replace(%1," ") 1
#IF (@%replace(%1," ")=>7) {#var %replace(%1," ") 0}
}
#CLASS 0


Thanks!

AS
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sat Feb 18, 2006 11:51 pm   
 
This is just a stab in the dark, but perhaps it's the %replace() in your #IF command condition. You may need to surround it in curly braces for ZMud to recognize that it's the variable you want to check.
_________________
EDIT: I didn't like my old signature
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Sun Feb 19, 2006 12:04 am   
 
prolly wrong, but not able to test now:

#IF (@(%replace(%1," "))=>7) {#var %replace(%1," ") 0}
_________________
http://www.Aardwolf.com
Reply with quote
aliensurfer
Beginner


Joined: 11 Apr 2005
Posts: 17

PostPosted: Sun Feb 19, 2006 12:13 am   
 
Thanks guys, still couldn't get it to work..
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sun Feb 19, 2006 4:14 am   
 
Probably some odd order of comparaison?

#add %replace(%1," ") 2;#IF ([@{%replace(%1," ")} >= 7]) {#var %replace(%1," ") 0}

Try that maybe?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Feb 19, 2006 4:40 am   
 
Oh, crap, I can't believe I totally missed that. Your less than or equal to operator was backwards. >= instead of =>. The operator was probably defaulting to =, and since the result of the replace would never equal >7 it was always evaluating to zero. Without a false code-block to execute, the script was always appearing to do nothing at that point.
_________________
EDIT: I didn't like my old signature
Reply with quote
aliensurfer
Beginner


Joined: 11 Apr 2005
Posts: 17

PostPosted: Mon Feb 20, 2006 1:46 pm   
 
Worked a treat! Thanks Guys
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