mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-17 14:58:21 +00:00
Updated Perl EVENT_TIMER (markdown)
+11
-17
@@ -10,27 +10,25 @@ sub EVENT_TIMER {
|
||||
}
|
||||
```
|
||||
|
||||
### Functionality Explained
|
||||
### Triggered
|
||||
|
||||
EVENT_TIMER is triggered by a quest::settimer(timer_name,duration_in_seconds) or quest::settimerMS(timer_name,duration_in_milliseconds)
|
||||
* triggered by a quest::settimer(timer_name,duration_in_seconds) or quest::settimerMS(timer_name,duration_in_milliseconds)
|
||||
|
||||
The timer will loop until it is stopped, and EVENT_TIMER will trigger each time that the duration of the timer elapses
|
||||
* The timer will loop until it is stopped, and EVENT_TIMER will trigger each time that the duration of the timer elapses
|
||||
|
||||
Timers can be stopped using the quest::stopalltimers() or quest::stoptimer(timer_name) functions
|
||||
* Timers can be stopped using the quest::stopalltimers() or quest::stoptimer(timer_name) functions
|
||||
|
||||
### EVENT_TIMER in use
|
||||
### Examples
|
||||
|
||||
* this is an example of using a timer with a string name to cause an NPC to depop 30 minutes after it spawns
|
||||
|
||||
```perl
|
||||
# this is an example of using a timer with a string name to cause an NPC to depop 30 minutes after it spawns
|
||||
|
||||
sub EVENT_SPAWN {
|
||||
|
||||
# Start a timer that is named "depop", the duration is 1,800 seconds (30 minutes)
|
||||
quest::settimer("depop",1800);
|
||||
}
|
||||
|
||||
sub EVENT_TIMER {
|
||||
|
||||
# Use eq for string comparison to match timer "depop"
|
||||
if ($timer eq "depop") {
|
||||
# Stop timer "depop" from looping
|
||||
@@ -40,25 +38,22 @@ sub EVENT_TIMER {
|
||||
}
|
||||
```
|
||||
|
||||
* This is an example of using two timers with numeric names, started by separate events
|
||||
* The NPC will depop two hours after it spawns
|
||||
* The NPC will shout every minute to taunt attackers once it has been engaged
|
||||
|
||||
```perl
|
||||
# This is an example of using two timers with numeric names, started by separate events
|
||||
# The NPC will depop two hours after it spawns
|
||||
# The NPC will shout every minute to taunt attackers once it has been engaged
|
||||
|
||||
sub EVENT_SPAWN {
|
||||
|
||||
# Start a timer that is named "depop", the duration is 7,200 seconds (2 hours)
|
||||
quest::settimer("depop",7200);
|
||||
}
|
||||
|
||||
sub EVENT_AGGRO {
|
||||
|
||||
# Start a timer that is named "engaged", the duration is 60 seconds (1 minute)
|
||||
quest::settimer("engaged",60);
|
||||
}
|
||||
|
||||
sub EVENT_TIMER {
|
||||
|
||||
# Use eq for string comparison to match timer "depop"
|
||||
if ($timer eq "depop") {
|
||||
# Stop the timer "depop" from looping
|
||||
@@ -78,7 +73,6 @@ sub EVENT_TIMER {
|
||||
}
|
||||
|
||||
sub EVENT_DEATH_COMPLETE {
|
||||
|
||||
quest::say("You have defeated me...");
|
||||
# Stop the timer "depop" from looping
|
||||
quest::stoptimer("depop");
|
||||
|
||||
Reference in New Issue
Block a user