|
abu_monster Newbie
Joined: 18 Jan 2006 Posts: 4
|
Posted: Thu Jan 26, 2006 1:28 pm
IF command problems in scritp |
A question: WHY IF COMMAND INSTEAD OF DOING NOTHING FIRES EVEN THOUGH IT HAS VALUE 0 OR VALUE WHICH IS NOT DEFINED?
I have made following script:
#CLASS Battlescripts
#ALIAS kelpon {#T+ Battlescripts|Kelplock}
#ALIAS kelpoff {#T- Battlescripts|Kelplock}
#CLASS O
#CLASS Battlescripts|Kelplock
#ALIAS dk {envd;ctrl1}
#ALIAS envd {envenom dirk with}
#ALIAS kelplock {envd cyanide;envd ciguatoxin;envd iodine;envd bromine;envd botulinum;envd mercury;envd ether;envd arsenic;envd ciguatoxin;envd aconite}
#ALIAS ctrl1 {conjure illusion Khunkao pricks you twice in succesion with his dirk. Hmmmm. Why must everything be so difficult to figure out? Your body stiffens rapidly with paralysis.}
#ALIAS ctrl2 {conjure illusion Khunkao pricks you twice in succesion with his dirk. Terror descends upon you and your head swims - you must find shelter Hmmmm. Why must everything be so difficult to figure out?}
#ALIAS ctrl3 {conjure illusion A small black cobra opens its mouth wide and strikes you in the leg. You are confused as to the effects of the toxin.}
#ALIAS ctrl4 {conjure illusion Dart streaks from out of nowhere and slams into you. You are confused as to the effects of the toxin.}
#ALIAS ctrl5 {conjure illusion Khunkao pricks you twice in succesion with his dirk. Your limbs grow heavy and you groan feebly as weakness overcomes your body. You stumble and it becomes very difficult to concentrate on your coordination.}
#ALIAS ctrl6 {conjure illusion You are: Afflicted by horrible asthma. Afflicted with clumsiness.}
#ALIAS ctrl7 {conjure illusion Khunkao pricks you twice in succesion with his dirk. Your mind swims as dizziness overtakes you. A numbness seizes you, and your left arm goes limp.}
#ALIAS ctrl8 {conjure illusion Khunkao pricks you twice in succesion with his dirk. Your mind swims as dizziness overtakes you. A prickly, stinging sensation spreads through your body.}
#ALIAS ctrl9 {conjure illusion Khunkao pricks you twice in succesion with his dirk. You feel suddenly as if food is the most repulsive thing you can imagine. You watch, in horror, as your right arm shrivels up.}
#ALIAS ctrl10 {conjure illusion Khunkao pricks you twice in succesion with his dirk. Blood begins to slowly drip from your nose. Your ability to digest elixirs seems off for some reason}
#ALIAS ctrl11 {conjure illusion Khunkao pricks you twice in succesion with his dirk. A numbness seizes you, and your left arm goes limp. A numbness seizes you, and your left leg goes limp.}
#ALIAS ctrl12 {conjure illusion Khunkao pricks you twice in succesion with his dirk. A numbness seizes you, and your left leg goes limp. A numbness seizes you, and your right leg goes limp.}
#VAR Battlescripts/Kelplock/mental 0
#VAR Battlescripts/Kelplock/balance 1
#VAR Battlescripts/Kelplock/aura 0
#VAR Battlescripts/Kelplock/shield 0
#TRIGGER {You recovered balance} {#IF (@balancee 1) {dstb};#IF (@aura 1) {fla};#IF (@shield 1) {touch hammer &tar}}
#TRIGGER {you suddenly percieve the vague outline of an aura} {#VAR Battlescripts/Kelplock/aura 1;#VAR balance 0}
#TRIGGER {^You raze} {#VAR Battlescripts/Kelplock/aura 0;#VAR balance 1}
#TRIGGER {^A shimmering translucent shield forms around} {#VAR Battlescripts/Kelplock/shield 1;#VAR balance 0}
#TRIGGER {^You touch your tattoo and a massive, ethereal hammer rises up and shatters} {#VAR Battlescripts/Kelplock/shield 0;#VAR balance 1}
#TRIGGER {You have regained your mental equilibrium} {#IF (@mental 1) {dstb;#WAIT 200;ctrl5;#ADD Battlescripts/Kelplock/mental 1};#IF (@mental 2) {#WAIT 200;ctrl6;#ADD Battlescripts/Kelplock/mental 1};#IF (@mental 3) {#VAR Battlescripts/Kelplock/mental 0}}
#CLASS 0
The problem is just the last trigger. It goes normaly until it gets mental to 3, then sets it to 0 and repeats last illusion infinately.
Any suggestions would be nice. |
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Thu Jan 26, 2006 3:42 pm |
This #case works. I put my original idea at the bottom cause it don't work. If someone can tell me with THAT one what i did wrong I'd appreciate it.
Code: |
#trigger {You have regained your mental equilibrium} {
#CASE @mental {
#Echo 1A
#WAIT 200
#Echo 1B
#ADD mental 1
} {
#WAIT 200
#Echo 2A
#ADD mental 1
} {
#Echo 3A
#VAR mental 0
}
} |
You have regained your mental equilibrium
1A
1B
You have regained your mental equilibrium
2A
You have regained your mental equilibrium
3A
Also:
from your post on another thread:
mr_kent wrote: |
SUGGESTION: Don't use #WAIT inside triggers.
SUGGESTION: Add something for #IF(@mental 0) in the last trigger. |
Unless you have another script that makes mental 1 you have nothing that is doing it.
---
bumped to the bottom of post due to error
Nest your #if's
#IF (@mental = 1) {
#Echo 1A
#WAIT 200
#Echo 1B
#ADD mental 1
} {
#IF (@mental = 2) {
#WAIT 200
#Echo 2A
#ADD mental 1
}
} {
#IF (@mental = 3) {
#Echo 3A
#VAR mental 0
}
}
EDIT:
Bleh, screwed something up.
You have regained your mental equilibrium
1A
1B
You have regained your mental equilibrium
2A
You have regained your mental equilibrium
It's changing it to 3 but then ignoring the 3rd one. Not sure why. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Thu Jan 26, 2006 9:56 pm |
I'm just taking a wild guess here, but it might be the #WAITs messing you up. #WAIT in triggers is a really bad idea.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
abu_monster Newbie
Joined: 18 Jan 2006 Posts: 4
|
Posted: Thu Jan 26, 2006 10:16 pm |
I hate to dissapoint you guys, but ALARM doesn't work either. It still fires all illusions at once.
|
|
|
|
TonDiening GURU
Joined: 26 Jul 2001 Posts: 1958 Location: Canada
|
Posted: Fri Jan 27, 2006 12:09 am |
500ms work well enough?
trigger {You have regained your mental equilibrium} {
#CASE @mental {
#Echo 1A
#ALARM metal +0.5 {#Echo 1B;#ADD mental 1}
} {
#ALARM metal +0.5 {#Echo 2A;#ADD mental 1}
} {
#ALARM metal +0.5 {#Echo 1B;#ADD mental 1}
}
}
The trigger you had would fire all three as you increment mental and the next if check will prove true.
#TRIGGER {You have regained your mental equilibrium} {#IF (@mental 1) {dstb;#WAIT 200;ctrl5;#ADD Battlescripts/Kelplock/mental 1};#IF (@mental 2) {#WAIT 200;ctrl6;#ADD Battlescripts/Kelplock/mental 1};#IF (@mental 3) {#VAR Battlescripts/Kelplock/mental 0}}
Once mental hits 0 it gets stuck unless you change mental somewhere else. |
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Fri Jan 27, 2006 8:04 pm |
The script as you've posted it has no operators in the actual expression being evaluated.
Yours:
Code: |
#IF (@aura 1) {blah} |
Correct:
Code: |
#IF (@aura == 1) {blah} |
|
|
|
|
Vitae Enchanter
Joined: 17 Jun 2005 Posts: 673 Location: New York
|
Posted: Mon Jan 30, 2006 1:30 pm |
*points to his post and states again, "My #CASE example works. At least it does for me."
Just take out the #waits and put in alarms |
|
|
|
|
|