-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added some basic timer functionality
- Loading branch information
1 parent
a5e9236
commit 01bd232
Showing
2 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
LIB TIMER | ||
{ | ||
SPECIAL Create, SHARED | ||
{ | ||
IN Exec, PN_Exec, #Starts the timer | ||
IN Delay, PN_Number, #How long until the timer finishes | ||
IN Key, PN_Any, #Uniquely identifies the timer | ||
OUT Thru, PN_Exec, #Called after the timer finishes | ||
LATENT | ||
CODE | ||
{ | ||
__bpm.delay(tostring($3), $2, function() @graph(#_1) end) | ||
goto popcall | ||
} | ||
} | ||
SPECIAL CreateBoxed, SHARED | ||
{ | ||
IN Exec, PN_Exec, #Starts the timer | ||
IN Delay, PN_Number, #How long until the timer finishes | ||
IN Key, PN_Any, #Uniquely identifies the timer | ||
IN Value, PN_Any, #Value to pass through the timer | ||
OUT Thru, PN_Exec | ||
OUT Value, PN_Any | ||
INFORM 4,6 | ||
LATENT | ||
CODE | ||
{ | ||
__bpm.delay(tostring($3), $2, function(x) #2 = x @graph(#_1) end, $4) | ||
goto popcall | ||
} | ||
} | ||
SPECIAL Cancel, SHARED | ||
{ | ||
IN Exec, PN_Exec, #Cancels the timer | ||
IN Key, PN_Any, #Unique ID of the timer to cancel | ||
OUT Thru, PN_Exec, #Called after the timer is cancelled | ||
CODE | ||
{ | ||
__bpm.delayKill($2) | ||
#1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters