Hackerr Posted November 2, 2013 Share Posted November 2, 2013 #include <Misc.au3> ; HotKeySet("!a", "Main") ;wait for ALT-a keystroke, then go to Main() While 1 ;loop forever to wait for the keypress Sleep(1000) ;no need to kill the CPU WEnd Func Main() HotKeySet("!a") ;remove the hotkey so we don't jump around once we have started ;you start your script here $checkWin = WinExists ("Notepad") if $checkWin=1 then blurb() EndFunc Func blurb() $Stop=True While 1 If _IsPressed(11) Then $Stop= False Switch $Stop Case True sleep(1000) send("blurb") Case False then ExitLoop EndSwitch WEnd Call("Start()") EndFunc Func Start() $Stop=False $quit=False While 1 ;loop forever to wait for the keypress Sleep(1000) ;no need to kill the CPU if _IsPressed(14) Then $Stop=True Switch ($Stop) case True then ExitLoop EndSwitch if _IsPressed(11) And _IsPressed(12) then $quit=True Switch ($quit) case True then Exit EndSwitch WEnd Call("blurb()") EndFunc I seem to be able to get out of the first loop, the one that keeps saying blurb, but after that it seems to either not go to the start function, or the start function does something wrong. Link to comment Share on other sites More sharing options...
czardas Posted November 2, 2013 Share Posted November 2, 2013 (edited) Please post code inside code tags and don't start second topics about the same problem. Looking at what you have written I see many mistakes. Switch statements do not use the ketword Then. Before going ny further, whatever you are trying to do is the wrong approach. Your jungle is so overpopulated that you can't see the wood for the trees. In simple English, please describe what it is you are trying to do. Edited November 2, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
AutID Posted November 2, 2013 Share Posted November 2, 2013 Please post code inside code tagsNew rules?I have had an accident lately and i got operated my eyes. It is very difficult for me to read within code tags.I also have a friend who has a sickness, which i don't remember it's name, and it is impossible for him to read even normal letters without his glasses.I don't find this a good recomendation.Af for the OP. I am really booring.Here you go. BTW your script is a mess...#include <Misc.au3>Global $StopHotKeySet("!a", "Main")HotKeySet("e", "_exit")While 1Sleep(100)WEndFunc Main()HotKeySet("!a") ;Once you exit Main() you will not be able to restart it again$checkWin = WinExists("[CLASS:Notepad]")If $checkWin = 1 Thenblurb()EndIfEndFuncFunc blurb()$Stop = TrueWhile 1If _IsPressed("11") Then$Stop = FalseEndIfSwitch $StopCase Truesleep(100)ControlSend("[CLASS:Notepad]", "", "Edit1", "blurb")Case FalseExitLoopEndSwitchWEndCall("Start")EndFuncFunc Start()$Stop = False$quit = FalseWhile 1Sleep(10)if _IsPressed("14") Then $Stop = TrueSwitch $Stopcase TrueExitLoopEndSwitchif _IsPressed("11") And _IsPressed("12") then $quit = TrueSwitch $quitcase TrueExitEndSwitchWEndCall("blurb")EndFuncFunc _exit()ExitEndFunc https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
czardas Posted November 2, 2013 Share Posted November 2, 2013 Please post code inside code tags New rules? I have had an accident lately and i got operated my eyes. It is very difficult for me to read within code tags. I also have a friend who has a sickness, which i don't remember it's name, and it is impossible for him to read even normal letters without his glasses. I don't find this a good recomendation. Not rules but simply a request. It is good advice because reading syntax highlighted code is easier for most people. Furthermore correct indentation is useful to spot issues with nesting. Making your code more readable is going to get more responce. If you have an issue with the colours then use the popup option to read the code in b/w. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
AutID Posted November 2, 2013 Share Posted November 2, 2013 Not rules but simply a request.A request? I don't request things from people when i want to help them, i just help them.It is good advice because reading syntax highlighted code is easier for most people. Furthermore correct indentation is useful to spot issues with nesting. Making your code more readable is going to get more responce.Yep, that's why someone who didn't found it readable and not highlighted and couldn't spot the errors helped him and someone else spend 5 minutes to write 2 requesting posts instead of spending 1 minute to help him Anyway good luck everyone. https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
czardas Posted November 2, 2013 Share Posted November 2, 2013 (edited) A request? I don't request things from people when i want to help them, i just help them. Yep, that's why someone who didn't found it readable and not highlighted and couldn't spot the errors helped him and someone else spend 5 minutes to write 2 requesting posts instead of spending 1 minute to help him Anyway good luck everyone. AutID, I spent more than 5 minutes looking at the code and gave up trying to understand it. I don't personally care how people post their code. The request is a general request frequently made by forum members. That is the presentation most people prefer and it is good advice to use the forum features which were created for this purpose, even though I am aware some of the features have unresolved issues. Edited November 2, 2013 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Kidney Posted November 2, 2013 Share Posted November 2, 2013 your code is very redundant. for example: if _IsPressed(14) Then $Stop=True Switch ($Stop) case True then ExitLoop EndSwitch if _IsPressed(11) And _IsPressed(12) then $quit=True Switch ($quit) case True then Exit EndSwitch you have 6 lines of code that is not needed. both of these if statements can be 1 line each: if _IsPressed(14) Then ExitLoop if _IsPressed(11) And _IsPressed(12) Then Exit using switch for true and false is silly. if statements will clean up your code nicely since all you have to do is use an else. Before: If _IsPressed(11) Then $Stop= False Switch $Stop Case True sleep(1000) send("blurb") Case False then ExitLoop EndSwitch After: If _IsPressed(11) Then sleep(1000) send("blurb") Else ExitLoop EndIf Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 2, 2013 Moderators Share Posted November 2, 2013 Hackerr,Posting gamebot code as a first post is forgiveable. Opening a new account to ask exactly the same question with the game reference removed is not.Take a week's holiday to read and digest the Forum rules. If and when you return, please stick to them.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