There seems to be many bad forum posts and confusion on the simple action of toggling pause and play. Here is two examples of playing and pausing shortcuts. I'm sure there may be multiple ways to do this. Or there maybe more efficient ways but this was the simple way I do it
Example one: Two shortcuts that toggle Pause and Play
HotKeySet("{insert}","_Pause");press insert to make $pause variable = 1 and resume actions
HotKeySet("{esc}","_Play");press esc to make $pause variable = 0
$pause=1; sets varriable to 1 starting actiions in loop
While 1; Loop every 500 mill seconds and check varriables
Sleep(500); check variable every 500 seconds
if $pause=1 Then; if $pause variable = 1 then do actions
;Do actions
EndIf
WEnd
func _Play()
$pause=0
EndFunc
func _Pause()
$pause=1
EndFunc
Example Two: One shortcut that toggle Pause and Play
HotKeySet("{insert}","_Pause");press insert to make $pause press insert again to resume
$pause=1; sets varriable to 1 starting actiions in loop
While 1; Loop every 500 mill seconds and check varriables
Sleep(500); check variable every 500 seconds
if $pause=1 Then; if $pause variable = 1 then do actions
;Do actions while $pause = 1
EndIf
WEnd
func _Pause()
if $pause=0 then
$pause=1
else
$pause=0
endif
EndFunc