Tomb Posted January 27, 2008 Share Posted January 27, 2008 hi. i am creating this rpg about my dog, its called Toby's Quest. i have all of the hotkeys set up, just if you hold them down, or press them to fast, the images move to fast and they flash badly. is there some way i can set a delay of like 500 miliseconds before being able to press a hotkey again. I tried adding sleep(500) in the hotkey functions, but that becomes very buggy. i just want the functions to sleep like 500 miliseconds before they can be used again. is there some way i can do this? Link to comment Share on other sites More sharing options...
BigDod Posted January 27, 2008 Share Posted January 27, 2008 Disable the Hotkey at the start of your function and then reset it at the end using a sleep if required. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Tomb Posted January 27, 2008 Author Share Posted January 27, 2008 Disable the Hotkey at the start of your function and then reset it at the end using a sleep if required.how would i disable a hotkey? Link to comment Share on other sites More sharing options...
BigDod Posted January 27, 2008 Share Posted January 27, 2008 (edited) Parameterskey The key combination to use as the hotkey. Same format as Send(). function [optional] The name of the function to call when the key is pressed. Not specifying this parameter will unset a previous hotkey.IeHotKeySet("{ESC}") Edited January 27, 2008 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Tomb Posted January 27, 2008 Author Share Posted January 27, 2008 (edited) Parameters key The key combination to use as the hotkey. Same format as Send(). function [optional] The name of the function to call when the key is pressed. Not specifying this parameter will unset a previous hotkey. Ie HotKeySet("{ESC}")so if this were the normal function Func _ScrollUp();UP GUICtrlSetState($pic1, $GUI_HIDE) GUICtrlSetState($pic2, $GUI_HIDE) GUICtrlSetState($pic3, $GUI_HIDE) GUICtrlSetState($pic4, $GUI_HIDE) $GetPos = ControlGetPos($GUI, "", $background) ControlMove($GUI, "", $background, $GetPos[0], $GetPos[1]+5) GUICtrlSetState($pic1, $GUI_SHOW) EndFunc actually im still confused Edited January 27, 2008 by Tomb616 Link to comment Share on other sites More sharing options...
dabus Posted January 27, 2008 Share Posted January 27, 2008 HotKeySet("{ESC}", '_ScrollUp') Func _ScrollUp();UP GUICtrlSetState($pic1, $GUI_HIDE) GUICtrlSetState($pic2, $GUI_HIDE) GUICtrlSetState($pic3, $GUI_HIDE) GUICtrlSetState($pic4, $GUI_HIDE) $GetPos = ControlGetPos($GUI, "", $background) ControlMove($GUI, "", $background, $GetPos[0], $GetPos[1]+5) GUICtrlSetState($pic1, $GUI_SHOW) HotKeySet("{ESC}") Sleep(500) HotKeySet("{ESC}", '_ScrollUp') EndFunc Link to comment Share on other sites More sharing options...
martin Posted January 27, 2008 Share Posted January 27, 2008 (edited) so if this were the normal function Func _ScrollUp();UP GUICtrlSetState($pic1, $GUI_HIDE) GUICtrlSetState($pic2, $GUI_HIDE) GUICtrlSetState($pic3, $GUI_HIDE) GUICtrlSetState($pic4, $GUI_HIDE) $GetPos = ControlGetPos($GUI, "", $background) ControlMove($GUI, "", $background, $GetPos[0], $GetPos[1]+5) GUICtrlSetState($pic1, $GUI_SHOW) EndFunc actually im still confused Here is one way you could do it HotKeySet("1", "hotkeys");set all hot keys to the same function HotKeySet("2", "hotkeys") ;more hot keys Global $HotOK = True;the hot keys will work Func hotkeys() If Not $HotOK Then Return $HotOK = False AdlibEnable("releaseme", 500);set for the delay you want Switch @HotKeyPressed Case "1" func1;whatever you function is Case "2" func2 EndSwitch ;might be better to put the ADlibEnable here so that the delay starts from when the func called ends EndFunc ;==>hotkeys Func Releaseme () $HotOK = True AdlibDisable() EndFunc EDIT: added note about moving the position of AdlibEnable Edited January 27, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Tomb Posted January 27, 2008 Author Share Posted January 27, 2008 if i press a hotkey, the only hotkeys there really are so far are {up}, {down}, {left}, {right}, can i disable all of the hotkeys for maybe 500 miliseconds, then reenable them? that is my main goal here. Link to comment Share on other sites More sharing options...
martin Posted January 27, 2008 Share Posted January 27, 2008 if i press a hotkey, the only hotkeys there really are so far are {up}, {down}, {left}, {right}, can i disable all of the hotkeys for maybe 500 miliseconds, then reenable them? that is my main goal here.The example I gave does that, at least it stops the hot keys having any effect for 500 mS after any one is pressed.There are other ways to do it but I would need to know what you didn't like about the way I've suggested already before I could suggest another. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Tomb Posted January 27, 2008 Author Share Posted January 27, 2008 The example I gave does that, at least it stops the hot keys having any effect for 500 mS after any one is pressed.There are other ways to do it but I would need to know what you didn't like about the way I've suggested already before I could suggest another.yours confused me lol.i keep rereading it, but im missing out on what is going on there. Link to comment Share on other sites More sharing options...
Tomb Posted January 28, 2008 Author Share Posted January 28, 2008 actually nevermind i worked out a solution with BMP2RGN.dll thanks for help guys it doesnt flash at all now 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