Difference between revisions of "User:Dt192/Sandbox2"

From Mudlet
Jump to navigation Jump to search
m
m
Line 3: Line 3:
  
 
disableTimer("Newbie timer") -- disables it, so it won't go off anymore
 
disableTimer("Newbie timer") -- disables it, so it won't go off anymore
</syntaxhighlight>
 
 
 
 
<syntaxhighlight lang="lua">
 
tempTimer(3, [[ echo("this is timer #1 going off 3s after being made\n") ]])
 
tempTimer(4, [[ echo("this is timer #2 going off 4s after being made - and 1s after the first one\n") ]])
 
</syntaxhighlight>
 
 
 
 
<syntaxhighlight lang="lua">
 
-- get and store the timer ID in the global "greeting_timer_id" variable
 
greeting_timer_id = tempTimer(2, [[ echo("hello!\n") ]])
 
 
-- delete the timer - thus nothing will actually happen!
 
killTimer(greeting_timer_id)
 
</syntaxhighlight>
 
 
 
 
<syntaxhighlight lang="lua">
 
if portal_timer then killTimer(portal_timer) end
 
portal_timer = tempTimer(2, [[ send("enter portal") ]])
 
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 00:27, 16 February 2026

enableTimer("Newbie timer") -- enables the timer, so 2s after being enabled, it'll tick - and every 2s after that

disableTimer("Newbie timer") -- disables it, so it won't go off anymore