So I suppose what you could do is something like this:
Code:
$spell_615_active = nil
Thread.new{
loop{
wait_until { $spell_615_active }
150.times{
break if $spell_615_active.nil?
sleep 0.2
}
$spell_615_active = nil
}
}
while line = get
$spell_615_active = nil if line =~ /The insect swarm disperses and the buzzing subsides\./
end
Which would do what I mentioned above: look for when the swarm fades and waits 30 seconds before assuming the swarm has faded. This script would need to be running in the background while you're hunting, or you could just leave it running all the time, it won't hurt anything.
Then in your attacking script you could do something like:
Code:
if $spell_615_active.nil?
Spell[615].cast
$spell_615_active = true
end
Again the script won't be perfect because of the aforementioned critter/you leaving the room before you see the message about the swarm fading, but at most you would just have to wait 30 seconds before the script would try again. Or reduce the wait time to 10 or 15 seconds, it all good!
You could also have the script check to see if there is a swarm in the room with you and if there is the 30 second timer won't assume the swarm has dispersed because...well...the swarm is there.