Coda Posted February 13, 2017 Share Posted February 13, 2017 Heyo My problem is iam using ispressed func in while but i don't have the idea how to end it : While 1 if _IsPressed(12) then Send("{Space}") sleep(17) Send("{Space}") endif wend My problem is it gonna sends space all the time so how can i stop it ? also without using exitloop since i want to use the same func again. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2017 Moderators Share Posted February 13, 2017 Coda, Just wait until the key is released before continuing - look at the example in the Help file which shows exactly how to do it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Coda Posted February 13, 2017 Author Share Posted February 13, 2017 1 hour ago, Melba23 said: Coda, Just wait until the key is released before continuing - look at the example in the Help file which shows exactly how to do it. M23 As i said it always send space i want a way to stop it and wait until i press alt again and so one. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2017 Moderators Share Posted February 13, 2017 Coda, Which is what I have told you above will achieve: press the key and {SPACE} is sent twice, wait for the key to be released and then continue to loop until the key is pressed again: While 1 ; Is the key pressed? If _IsPressed(12) Then ; Yes, so send {SPACE} twice Send("{Space}") Sleep(17) Send("{Space}") ; Now wait for the key to be released While _IsPressed(12) Sleep(10) ; Do this to stop the CPU overheating Wend ; Now the key is released, so reenter the loop Else ; No, key not pressed Sleep(10) ; Again do this to prevent the CPU overheating if key is not pressed EndIf WEnd And as you are calling _IsPressed in a tight loop, I would also strongly recommend opening 'user32.dll' first and using the returned handle in the $vDLL parameter. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Coda Posted February 13, 2017 Author Share Posted February 13, 2017 5 minutes ago, Melba23 said: Coda, Which is what I have told you above will achieve: press the key and {SPACE} is sent twice, wait for the key to be released and then continue to loop until the key is pressed again: While 1 ; Is the key pressed? If _IsPressed(12) Then ; Yes, so send {SPACE} twice Send("{Space}") Sleep(17) Send("{Space}") ; Now wait for the key to be released While _IsPressed(12) Sleep(10) ; Do this to stop the CPU overheating Wend ; Now the key is released, so reenter the loop Else ; No, key not pressed Sleep(10) ; Again do this to prevent the CPU overheating if key is not pressed EndIf WEnd And as you are calling _IsPressed in a tight loop, I would also strongly recommend opening 'user32.dll' first and using the returned handle in the $vDLL parameter. M23 Thanks for your effort bro but i need something to pause the script after it send the second send cuz in my game if i pressed alt it always send space Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 13, 2017 Moderators Share Posted February 13, 2017 Coda, Firstly, you have obviously not tried the code I gave you because that is exactly what it does. Secondly I warned you here that our patience has limits, but you continue to post gamebot scripts. I am sorely tempted to ban you now, but you get one, and only one, more chance - another game-related script and you will be removed from the community. Thread locked. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts