|
robthesilent Newbie
Joined: 05 Oct 2002 Posts: 7 Location: Australia
|
Posted: Mon Sep 22, 2003 4:36 pm
IF triggers firing all at once |
First of all, I'd like to thank zwanth and prestopimp for helping me solve some problems.
Now, the bot has little routines to move, cast,move back, wait
differnt spells for different conditions
However, the #IF statement has a problem in the way I am trying to use it. So i have a trigger 'go'
#IF (@HP > @MAXHP/2 AND @SP > @MAXSP/3) {mmflay);hp;#ALA +10 {attack}} {'not flaying;hp;#ALA +10 {attack}}
#IF (@HP > 300 AND @SP < @MAXSP/2) {bbdrain;hp;#ALA +10 {attack}} {'not draining;hp;#ALA +10 {attack}}
twiddle
mmflay is
@dir;m @enemy;%reversedir(@dir);hp
bbdrain similar
as draining gets sp at the cost of hp and it is easy to die from doing this. The problem is when attack runs, it tries to execute both IF together, and if both are true, then they interfer with each other, "You have not recovered from your last incantatiion! etc"
I was thinking if maybe a FORWHILE loop, but I wasnt sure. Anyway, I think it should be a simple answer, but I dont know it. Help? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Sep 22, 2003 6:09 pm |
1. Remove the alarm from one of the #IFs. After the first #IF, you're already going to attack in 10 seconds so the second #IF doesn't need it.
2. You probably ought to change the conditions to ensure that only one #IF can be true. Right now they overlap. |
|
|
|
robthesilent Newbie
Joined: 05 Oct 2002 Posts: 7 Location: Australia
|
Posted: Tue Sep 23, 2003 10:31 am |
Better!
As you say, I moved the #ALA and found a much better way to do the whole thing
#IF (@HP > @MAXHP/2 AND @SP > @MAXSP/3) {@dir;m @enemy;%reversedir(@dir);hp} {'not flaying;hp}
#IF (@HP > 330 AND @SP < @MAXSP/2) {@dir;braindrain @enemy;%reversedir(@dir);hp} {'not draining;hp}
#ALA +10 {attack}
twiddle
neater. Now, I already have a (%w) died variable - it keeps track of how many of what I have killed. Stopping alarms I have found hard - the best way I know is #untrigger +10 - but if there are other alarms running at the same time, I fear the monster dying will interupt them if i make a trigger blah died = untrig +10;reset enemy,dir, blah
any suggestions? |
|
|
|
Rehcra Novice
Joined: 10 Oct 2000 Posts: 43
|
Posted: Tue Sep 23, 2003 5:22 pm |
You can assign ID's to triggers and alarms. Then you can untrigger them by name.
#alarm "test" +10 {#show Time}
#untrigger test |
|
|
|
|
|
|
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
|
|