Elf programming example #4

how to refresh spells when a trigger is activated while you're sleeping

Task: This is a really common problem. Let's see what happens. You start sleeping. When the tick elapses, the mud sends to you several messages to inform you about the spells that are no longer active. It is easy to trap, with some triggers, such messages, but ther is a problem: you'll find find yourself unable to cast those spells, because you're sleeping!
View the source code now.

This task is very easy, yet powerful, for ELF.

We simply have to write the trigger that traps the message and casts the spell again.

The only other thing we need to set is the delay before activate value. Let's set it to 8 seconds... That's all!

When the trigger will be activated, the execution of related commands will be delayed for the specified number of seconds. It is likely that in the meantime you'll wake up, either manually or with some kind of trigger (see monitoring sleep).

Here is the necessary programming for this task:
 
trigger Refresh shield
trigger Your magic shield fades away happily.
flags none
delay 8 seconds
commands cast 'shield' myname
 

These pages were developed with Netscape Composer 4.03 by Alfredo Milani-Comparetti  
Last modified on 8 nov 1997