|
elucid8 Newbie
Joined: 25 Apr 2008 Posts: 6
|
Posted: Fri Apr 25, 2008 2:08 pm
Problem with #IF Statment |
I am trying to write a script that will check my current tnl and if it is within a certain range then it should equip my status affecting gear. It works except that it repeats endlessly. How do I write this to makes sure that it will only execute once?
Looks like this:
//Declaring variable xpTnl
#var xptnl 0;
//Trigger to check
#trigger xpCheck {(*)<(%d)/(%d)hp (%d)/(%d)mp (%d)/(%d)mv (%d)xp>} {xpTnl = %8;#if (xpTnl < 200) {levelGear}{} }
Ok, so essentially this works. BUT because it is a trigger it executes endlessly so long as that evaluates as true. I need to know how to get this to evaluate and execute one time. I have thought about adding an "emote wears his levelgear." and then drafting a conditional trigger to fire if that happens but after that I am stuck. So do you have any suggestions? |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Fri Apr 25, 2008 2:14 pm |
This is a relatively common problem with a fairly simple solution.
#if ((xpTnl < 200) and (@levelGearOnce==0)) {levelGear;levelGearOnce=1}
#if ((xpTnl > 200) and (@levelGearOnce==1)) {levelGearOnce=0} |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
elucid8 Newbie
Joined: 25 Apr 2008 Posts: 6
|
Posted: Fri Apr 25, 2008 2:25 pm |
Thanks Arminas. I didn't even think about making a second variable doing a if and. Thanks!
|
|
|
|
|
|