 |
Qaiia Wanderer
Joined: 06 Apr 2007 Posts: 59
|
Posted: Wed May 28, 2008 12:32 pm
Waitfor something to occur? |
I am trying to work with this output.
>eat my root
You take a bite of your haphip root.
Your head feels better.
Roundtime: 15 sec.
You have about 45 bites left.
Eating the root is a scripted auto-healing command. After the command it will issue #T+ wounds|rttrigger and this section activates. When this section is done, it goes back to the previous script for another couple of commands before exiting. Another trigger elsewhere stores round time as an integer. Following is the class script.
Code: |
#CLASS {wounds|rttrigger}
#TRIGGER {Your %1 feels better.} {#WAIT}
#COND {Roundtime: %1 sec.} {#WAIT @roundtime * 1000}
#T- rttrigger
#CLASS 0 |
Now, this WORKS, however if the game lags a bit for whatever reason, often the first #WAIT expires before the round time kicks in and since round time will = 0 it just flies past and attempts to go to the next step, which doesn't happen because the character will be in round time.
Is there another way I can do this to keep better control of the sequence of events? Maybe an example of how #ALARM would be more appropriate? Or should I use an #IF statement around the next section of commands to look for a value in @roundtime and issue a #WAIT if it is > 0 (I sense the same potential for failure as the above script here).
Thanks in advance. |
|
|
 |
Qaiia Wanderer
Joined: 06 Apr 2007 Posts: 59
|
|
|
 |
Qaiia Wanderer
Joined: 06 Apr 2007 Posts: 59
|
Posted: Fri May 30, 2008 1:39 pm |
So now the herb-eating code calls #T+ wounds|rttrigger which enables the following bit of code. Works like a charm.
Code: |
#CLASS {wounds|rttrigger} {disable}
#TRIGGER {You take a {bite of|drink from} your %1.} {lasteatenherb = %1}
#COND {q} {
#MATH int_waitfor {@roundtime+1}
#ALARM +@int_waitfor {
put my @lasteatenherb in my @gearcontainer
#ALARM +1 {close my @gearcontainer}
}
#T- rttrigger
} {gsl}
#CLASS 0 |
|
|
|
 |
|
|