Nick,
I have a few questions for you still. First, I am trying to develop a function that will allow me to cast the same spell on myself multiple number of times. What I came up with was something like this:
function spellup(spell, number)
{
if (number < 1)
{
world.deletetrigger("cast");
return (world.note("Spellup finished!"));
}
else
{
world.send("pr "+spell);
world.addtrigger("cast", "Your spell is
ready." , "cast", 1, -1, 0, "", "");
world.addTimer("cont"+number, 0, 0, 3, spellup
(spell,number-1), 5, "");
}
}
The problem I have with this implementation is this, instead of sending "pr <spell>", waiting until the spell is ready, casting, and then waiting 3 seconds before accessing the loop again, the execution seems to send "pr <spell>"*number, then waiting until the spell is ready, then casting*number.
Example: /spellup(103,3)
pr 103
pr 103
pr 103
Script Finished!
<wait until "Your spell is ready.">
cast
cast
cast
I have one more questino for you, Nick. Is there any possible way to actually extract data from the output screen rather than just set a "trigger" to act upon seeing the message? For instance, I would like to make a function that would tell me whether or not it is safe for me to hunt based on my current number of health points. Basically, if my health is greater than X amount, it is safe for me to hunt. Implimenting it trigger-wise would require me to enter a trigger for every value between X and my maximum health number (and a required upkeep based on advancing levels). I would much rather read my value from the output and compare it to my conditional statement. Thanks, Nick!
Patrick |