Vindicator209 Posted August 12, 2006 Share Posted August 12, 2006 im trying to make a hot key command to pause a loop or the script itself is it possible? i have a "while" loop running and i have this so far: HotKeySet("^!p", "pause") Func pause() [what goes here?] EndFunc [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
azeazezar Posted August 12, 2006 Share Posted August 12, 2006 (edited) im trying to make a hot key command to pause a loop or the script itself is it possible? i have a "while" loop running and i have this so far: HotKeySet("^!p", "pause") Func pause() [what goes here?] EndFunc HotKeySet("^!p", "pause") Func pause() sleep (time you would like to wait in miliseconds);[what goes here?] EndFunc Edited August 12, 2006 by azeazezar Link to comment Share on other sites More sharing options...
Vindicator209 Posted August 12, 2006 Author Share Posted August 12, 2006 wait what if they wanted it to UN pause? would they have to just wait for it? [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center] Link to comment Share on other sites More sharing options...
Zib Posted August 12, 2006 Share Posted August 12, 2006 Global $Paused HotKeySet("{PAUSE}", "TogglePause") ;;;; Body of program would go here ;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Link to comment Share on other sites More sharing options...
azeazezar Posted August 12, 2006 Share Posted August 12, 2006 HotKeySet("^!p", "pause") Func pause() msgbox(0,"Title","Text.") EndFunc this will pause the script till the user presses ok Link to comment Share on other sites More sharing options...
Vivvic Posted August 12, 2006 Share Posted August 12, 2006 (edited) How about HotKeySet("^!p", "_Pause") $Paused = 0 ;Code here Func _Pause() $Paused = Not $Paused While $Paused Sleep(100) WEnd EndFunc To be able to toggle pause with the hotkey. EDIT: Got beat to it >.< Edited August 12, 2006 by Vivvic [quote name='DaleHohm']You have a strange habit of posting error messages that don't match your code.[/quote][quote name='SmOke_N']Forget the learning... straight to the scripting :lol: (laugh.gif)[/quote] Link to comment Share on other sites More sharing options...
Golbez Posted August 18, 2006 Share Posted August 18, 2006 Dim $sleep = 0 HotKeySet("{DEL}", "_Sleep") While $sleep = 1 If $sleep = 0 Then ExitLoop Sleep (100) WEnd Func _Sleep() If $sleep = 0 Then $sleep = 1 Else $sleep = 0 EndIf EndFunc idk if what they said works but this will Link to comment Share on other sites More sharing options...
Valuater Posted August 18, 2006 Share Posted August 18, 2006 straight from help "HotKeySet" AT THE BOTTOM of the page are great examples ; Press Esc to terminate script, [color="#ffffff"]Pause[/color]/Break to "[color="#ffffff"]pause[/color]" Global $Paused HotKeySet("{[color="#ffffff"]PAUSE[/color]}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d ;;;; Body of program would go here ;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message.") EndFunc 8) Vlad_1996 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now