Lukepro2315 Posted May 27, 2014 Share Posted May 27, 2014 Hi guyz, im trying to make script needs to have _IsPressed command in it, to run some repeating action. Problem is, that all _IsPressed functions need While 1 / WEnd to work. And in i add some another While / WEnd between existing While / Wend, both will stop work. Example what i need to do: While1 (must be here to work) _IsPressed Then Some loop (Unfortunately i dont know how to make another loop without While / WEnd - if i place new While here, both stops work) EndIf _IsPressed Then Blabla1 EndIf _IsPressed Then Blabla2 EndIf WEnd (must be) Can somehow hlp me? What i planed to do is somehow connect the first _IsPressed function with another one, that is out of this While loop, and make another While loop somewhere else. But im afraid that two of them cant run at once...right? So can someone hlp me? Or give some advice? Thx Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 27, 2014 Moderators Share Posted May 27, 2014 Have you looked at AdLibRegister? #include <Misc.au3> AdlibRegister("MyFunc") While 1 ;Do Stuff WEnd Func MyFunc() If _IsPressed(01) Then Exit EndFunc "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Lukepro2315 Posted May 27, 2014 Author Share Posted May 27, 2014 Have you looked at AdLibRegister? #include <Misc.au3> AdlibRegister("MyFunc") While 1 ;Do Stuff WEnd Func MyFunc() If _IsPressed(01) Then Exit EndFunc I did...a little...i thought it have something to do with timing...maybe i didnt understand that well...ill try to read it again and more carefully. Link to comment Share on other sites More sharing options...
Sori Posted May 27, 2014 Share Posted May 27, 2014 (edited) If you make a loop inside a loop, the second loop will take over... essentially.. While 1 Going X is pressed While 1 Going This will cause the first loop to essentially freeze, because it's waiting for the second loop to finish. What key are you wanting to capture? Can you be more detailed in what you're doing? Have you looked into hotkeys? Edited May 27, 2014 by Sori If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects. Link to comment Share on other sites More sharing options...
Lukepro2315 Posted May 27, 2014 Author Share Posted May 27, 2014 (edited) Well what i have build was something like that: $countsec1 = 60 ;time set to 60 seconds While 1 If _IsPressed("70", $hDLL) = 1 Then ;F1 starts countingWhile 1 ;-I knw that this one is not suppoed to be here $countsec1 = $countsec1 -1 ;Countdown by 1 sec to zero Sleep(1000) ;Every second EndIf If $countsec1 = 0 Then ;If countdown drops to 0, it will stop and reset back to 60 sec Exitloop $countsec1 = 60 Wend EndIf If _IsPressed("71", $hDLL) = 1 Then ;F2 type remaining time Send ("Time left is " & $countsec1 & " till end") EndIf WEnd Its not exactly like it should be...i wrote it in hurry. But b4 i build that trough Hotkeyset function, and it worked. Unfortunately i need that in _IsPressed and dont know how. All i need is to Press button, and repeat all between While / Wend and another button to show it. But when i make group with _IsPressed, i cant do another loops. And...maybe another button to stop and reset Green loop Edited May 27, 2014 by Lukepro2315 Link to comment Share on other sites More sharing options...
Bert Posted May 27, 2014 Share Posted May 27, 2014 Is there some reason you can't use hotsetkeys? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Sori Posted May 27, 2014 Share Posted May 27, 2014 (edited) Instead of while 1, do while $countset1 > 0 That way it will exit at 0 for you. (update your count inside the while) As far as detecting if F2 is pressed during the F1 loop, it will be something like... While F1 Looping stuff If F2 is pressed print scripting endif wend That way it's checking for F2 during the F1 loop P.S. Very helpful for us: When creating a reply, there is a small blue A key, right below the smiley face. When you want to post Autoit Code, press that blue button, then paste your code into it. This will automatically format the code into the correct colors and space it accordingly. Edited May 27, 2014 by Sori If you need help with your stuff, feel free to get me on my Skype. I often get bored and enjoy helping with projects. Link to comment Share on other sites More sharing options...
Lukepro2315 Posted May 27, 2014 Author Share Posted May 27, 2014 Is there some reason you can't use hotsetkeys? Yy i want it in game, and Hotkeys not work there Link to comment Share on other sites More sharing options...
Lukepro2315 Posted May 27, 2014 Author Share Posted May 27, 2014 Instead of while 1, do while $countset1 > 0 That way it will exit at 0 for you. (update your count inside the while) As far as detecting if F2 is pressed during the F1 loop, it will be something like... While F1 Looping stuff If F2 is pressed print scripting endif wend That way it's checking for F2 during the F1 loop P.S. Very helpful for us: When creating a reply, there is a small blue A key, right below the smiley face. When you want to post Autoit Code, press that blue button, then paste your code into it. This will automatically format the code into the correct colors and space it accordingly. Aaah thx for all. Ill try it in work after 7Pm (Dont have time now). Hope it will work. Thx for advice Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 27, 2014 Moderators Share Posted May 27, 2014 (edited) Yy i want it in game, and Hotkeys not work there You need to look at the forum rules (bottom right corner of every page) before going any further. Especially the part the prohibits any form of game automation. Edited May 27, 2014 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2014 Moderators Share Posted May 27, 2014 Lukepro2315,JLogan3o13 is quite right - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. Thread locked. But welcome to the AutoIt forum - and see you soon with a legitimate question I hope. 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