|
aliensurfer Beginner
Joined: 11 Apr 2005 Posts: 17
|
Posted: 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 |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Sun Feb 19, 2006 12:04 am |
prolly wrong, but not able to test now:
#IF (@(%replace(%1," "))=>7) {#var %replace(%1," ") 0} |
|
|
|
aliensurfer Beginner
Joined: 11 Apr 2005 Posts: 17
|
Posted: Sun Feb 19, 2006 12:13 am |
Thanks guys, still couldn't get it to work..
|
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: 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? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
aliensurfer Beginner
Joined: 11 Apr 2005 Posts: 17
|
Posted: Mon Feb 20, 2006 1:46 pm |
Worked a treat! Thanks Guys
|
|
|
|
|
|