SixWingedFreak Posted February 28, 2008 Share Posted February 28, 2008 (edited) Here's a snippet of the section that's giving me trouble. When I hit the Start Button, it goes into the "MainLoop," which is the entire basis for the rest of the code. But then, my GUI buttons become in-operable. I assume it's something glaringly obvious, but I can't figure it out for the life of me. It's been kicking my behind for the last several days. :\Any help or suggestions are greatly appreciated at this point. Thanks.expandcollapse popup;; ---------------------------------------- ;; MainLoop ;; ---------------------------------------- LoadSettings() RunGUI() Func MainLoop() CheckGUI() LogOn() ActivateWindow() CenterCursor() Do Prepare() Undock() CenterCursor() Sleep($CheckWait * 1000) UndockCheck() WarpToBelt() CenterCursor() Sleep($CheckWait * 1000) WarpToBeltCheck() LaunchDrones() Target() CenterCursor() Sleep($LockWait * 1000) FireLasers() CenterCursor() Sleep($CheckWait * 1000) MiningCheck() MiningTimer() ReturnDrones() Dock() CenterCursor() Sleep($CheckWait * 1000) DockCheck() Sleep(10000) MoveCargo() CenterCursor() Sleep(2000) $RepeatCounter = $RepeatCounter + 1 LogOffDT() Until $RepeatCounter = $RepeatAmount LogOff() EndFunc ;==>MainLoop ;; ---------------------------------------- ;; GUI ;; ---------------------------------------- Func RunGUI() While 1 $tMsg = TrayGetMsg() $gMsg = GUIGetMsg() Switch $tMsg Case $TrayRunEVE Run($EVELocation & "eve.exe") Case $TrayOptions WinSetState("AutoOre v" & $Version, "", @SW_RESTORE) Case $TrayExit Exit EndSwitch Switch $gMsg Case $GUI_EVENT_MINIMIZE WinSetState("AutoOre v" & $Version, "", @SW_HIDE) Case $GUI_EVENT_CLOSE Exit Case $GUI_EVE_LogOn If GUICtrlRead($GUI_EVE_LogOn) = $GUI_UNCHECKED Then GUICtrlSetState($GUI_EVE_Pass, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_PassSave, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_Wait, $GUI_DISABLE) ElseIf GUICtrlRead($GUI_EVE_LogOn) = $GUI_CHECKED Then GUICtrlSetState($GUI_EVE_Pass, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_PassSave, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_Wait, $GUI_ENABLE) EndIf Case $GUI_EVE_LogOffDT If GUICtrlRead($GUI_EVE_LogOffDT) = $GUI_UNCHECKED Then GUICtrlSetState($GUI_EVE_LogOffHH, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_LogOffMM, $GUI_DISABLE) ElseIf GUICtrlRead($GUI_EVE_LogOffDT) = $GUI_CHECKED Then GUICtrlSetState($GUI_EVE_LogOffHH, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_LogOffMM, $GUI_ENABLE) EndIf Case $GUI_EVE_MouseSpeed GUICtrlSetData($GUI_EVE_MouseSpeedInput, GUICtrlRead($GUI_EVE_MouseSpeed)) Case $GUI_EVE_Lasers GUICtrlSetData($GUI_EVE_LasersInput, GUICtrlRead($GUI_EVE_Lasers)) Case $GUI_EVE_Targets GUICtrlSetData($GUI_EVE_TargetsInput, GUICtrlRead($GUI_EVE_Targets)) Case $GUI_EVE_MiningCheck GUICtrlSetState($GUI_EVE_MiningTime, $GUI_DISABLE) Case $GUI_EVE_MiningTimer GUICtrlSetState($GUI_EVE_MiningTime, $GUI_ENABLE) Case $GUI_EVE_SaveSettingsButton SaveSettings() Case $GUI_EVE_LoadSettingsButton LoadSettings() Case $GUI_EVE_StartButton WinSetState("AutoOre v" & $Version, "", @SW_HIDE) MainLoop() Case $GUI_EVE_PauseButton If GUICtrlRead($GUI_EVE_PauseButton) = $GUI_CHECKED Then $Paused = Not $Paused Do Sleep(100) ToolTip("Paused", 0, 0, "AutoOre v" & $Version) Until GUICtrlRead($GUI_EVE_PauseButton) = $GUI_UNCHECKED ToolTip("", 0, 0, "") EndIf Case $GUI_EVE_StopButton Exit EndSwitch WEnd EndFunc ;==>RunGUI Edited February 28, 2008 by SixWingedFreak Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 I'd say that you're doing too much other stuff while checking the gui so it becomes inresponsive, try using OnEventMode (search the helpfile for instructions for how to use it) Link to comment Share on other sites More sharing options...
SixWingedFreak Posted February 28, 2008 Author Share Posted February 28, 2008 I also tried this a moment ago, as suggested by another user. I inserted the mainloop directly into the StartButton, removed the Do/Until, and removed the function to activate the GUI. However, this still doesn't work. Once I press Start, it goes about it's business as usual, but every GUI button, checkbox, and radiobutton stops working. expandcollapse popupWhile 1 $tMsg = TrayGetMsg() $gMsg = GUIGetMsg() Switch $tMsg Case $TrayRunEVE Run($EVELocation & "eve.exe") Case $TrayOptions WinSetState("AutoOre v" & $Version, "", @SW_RESTORE) Case $TrayExit Exit EndSwitch Switch $gMsg Case $GUI_EVENT_MINIMIZE WinSetState("AutoOre v" & $Version, "", @SW_HIDE) Case $GUI_EVENT_CLOSE Exit Case $GUI_EVE_LogOn If GUICtrlRead($GUI_EVE_LogOn) = $GUI_UNCHECKED Then GUICtrlSetState($GUI_EVE_Pass, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_PassSave, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_Wait, $GUI_DISABLE) ElseIf GUICtrlRead($GUI_EVE_LogOn) = $GUI_CHECKED Then GUICtrlSetState($GUI_EVE_Pass, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_PassSave, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_Wait, $GUI_ENABLE) EndIf Case $GUI_EVE_LogOffDT If GUICtrlRead($GUI_EVE_LogOffDT) = $GUI_UNCHECKED Then GUICtrlSetState($GUI_EVE_LogOffHH, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_LogOffMM, $GUI_DISABLE) ElseIf GUICtrlRead($GUI_EVE_LogOffDT) = $GUI_CHECKED Then GUICtrlSetState($GUI_EVE_LogOffHH, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_LogOffMM, $GUI_ENABLE) EndIf Case $GUI_EVE_MouseSpeed GUICtrlSetData($GUI_EVE_MouseSpeedInput, GUICtrlRead($GUI_EVE_MouseSpeed)) Case $GUI_EVE_Lasers GUICtrlSetData($GUI_EVE_LasersInput, GUICtrlRead($GUI_EVE_Lasers)) Case $GUI_EVE_Targets GUICtrlSetData($GUI_EVE_TargetsInput, GUICtrlRead($GUI_EVE_Targets)) Case $GUI_EVE_MiningCheck GUICtrlSetState($GUI_EVE_MiningTime, $GUI_DISABLE) Case $GUI_EVE_MiningTimer GUICtrlSetState($GUI_EVE_MiningTime, $GUI_ENABLE) Case $GUI_EVE_SaveSettingsButton SaveSettings() Case $GUI_EVE_LoadSettingsButton LoadSettings() Case $GUI_EVE_StartButton CheckGUI() LogOn() ActivateWindow() CenterCursor() Prepare() Undock() CenterCursor() Sleep($CheckWait * 1000) UndockCheck() WarpToBelt() CenterCursor() Sleep($CheckWait * 1000) WarpToBeltCheck() LaunchDrones() Target() CenterCursor() Sleep($LockWait * 1000) FireLasers() CenterCursor() Sleep($CheckWait * 1000) MiningCheck() MiningTimer() ReturnDrones() Dock() CenterCursor() Sleep($CheckWait * 1000) DockCheck() Sleep(10000) MoveCargo() CenterCursor() Sleep(2000) $RepeatCounter = $RepeatCounter + 1 LogOffDT() LogOff() Case $GUI_EVE_PauseButton If GUICtrlRead($GUI_EVE_PauseButton) = $GUI_CHECKED Then $Paused = Not $Paused Do Sleep(100) ToolTip("Paused", 0, 0, "AutoOre v" & $Version) Until GUICtrlRead($GUI_EVE_PauseButton) = $GUI_UNCHECKED ToolTip("", 0, 0, "") EndIf Case $GUI_EVE_StopButton Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
SixWingedFreak Posted February 28, 2008 Author Share Posted February 28, 2008 (edited) I'd say that you're doing too much other stuff while checking the gui so it becomes inresponsive, try using OnEventMode (search the helpfile for instructions for how to use it)Mm, I was trying to avoid using OnEventMode hoping I could pull it off normally, but I guess I can give it a shot eventually.Also, I don't mean unresponsive by lag or anything.. I simply mean they cease to function entirely. I can't close or pause it at all once it starts, aside from using a hotkey. It's very odd. Edited February 28, 2008 by SixWingedFreak Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 Mm, I was trying to avoid using OnEventMode hoping I could pull it off normally, but I guess I can give it a shot eventually.Also, I don't mean unresponsive by lag or anything.. I simply mean they cease to function entirely. I can't close or pause it without using a hotkey.Yeah, I assumed that's what you meant.I'm not totally sure I understand how your script works, but as I can see, when you go into your MainLoop function, you never call your RunGUI function again, which is probably why it becomes unresponsive, unless you do message handling in your CheckGUI function.. Link to comment Share on other sites More sharing options...
SixWingedFreak Posted February 28, 2008 Author Share Posted February 28, 2008 (edited) Yeah, I assumed that's what you meant. I'm not totally sure I understand how your script works, but as I can see, when you go into your MainLoop function, you never call your RunGUI function again, which is probably why it becomes unresponsive, unless you do message handling in your CheckGUI function.. I've also tried putting RunGUI into the MainLoop, in various different spots. When I have it arranged like this: expandcollapse popupLoadSettings() RunGUI() ;; ---------------------------------------- ;; MainLoop ;; ---------------------------------------- Func MainLoop() RunGUI() CheckGUI() LogOn() ActivateWindow() CenterCursor() Do Prepare() Undock() CenterCursor() Sleep($CheckWait * 1000) UndockCheck() WarpToBelt() CenterCursor() Sleep($CheckWait * 1000) WarpToBeltCheck() LaunchDrones() Target() CenterCursor() Sleep($LockWait * 1000) FireLasers() CenterCursor() Sleep($CheckWait * 1000) MiningCheck() MiningTimer() ReturnDrones() Dock() CenterCursor() Sleep($CheckWait * 1000) DockCheck() Sleep(10000) MoveCargo() CenterCursor() Sleep(2000) $RepeatCounter = $RepeatCounter + 1 LogOffDT() Until $RepeatCounter = $RepeatAmount LogOff() EndFunc ;==>MainLoopoÝ÷ Ù8^nëm¢{0¢¹ºÛaxÆ¢º(¥Ú²}ý¶H)ÀqÊ+v)à¶äëk"¢pÞnè(¦Ø¨+wöË-YbØ^Z¥zZ(§^Z½è±ën¦Øb³²!Ú'ßÛd0«fzËèZÙb¬nëaz··öÀ¡yÉP§Ë²Rwè®Û§j×¥Èh¹»b·lÂÊ·ö·jY"¢ëZºÚ"µÍÎÈKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKBÎÈÚXÚÑÕRBÎÈKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKB[ÈÚXÚÑÕRJ BIÌÍÑUSØØ][ÛHÕRPÝXY ÌÍÑÕRWÑUWÓØØ][ÛBIÌÍÓÙÓÛHÕRPÝXY ÌÍÑÕRWÑUWÓÙÓÛBIÌÍÑUTÜÈHÕRPÝXY ÌÍÑÕRWÑUWÔÜÊBIÌÍÑUTÜÔØ]HHÕRPÝXY ÌÍÑÕRWÑUWÔÜÔØ]JBIÌÍÑUUØZ]HÕRPÝXY ÌÍÑÕRWÑUWÕØZ] BIÌÍÓÙÓÙHÕRPÝXY ÌÍÑÕRWÑUWÓÙÓÙBIÌÍÓÙÓÙHÕRPÝXY ÌÍÑÕRWÑUWÓÙÓÙ BIÌÍÓÙÓÙHÕRPÝXY ÌÍÑÕRWÑUWÓÙÓÙ BIÌÍÓÙÓÙSHHÕRPÝXY ÌÍÑÕRWÑUWÓÙÓÙSJBIÌÍÓ[ÝÙTÜYYHÕRPÝXY ÌÍÑÕRWÑUWÓ[ÝÙTÜYY BIÌÍÓÙÈHÕRPÝXY ÌÍÑÕRWÑUWÓÙÊBIÌÍÕÙ]ÈHÕRPÝXY ÌÍÑÕRWÑUWÕÙ]ÊBIÌÍÑÛÈHÕRPÝXY ÌÍÑÕRWÑUWÑÛÊBIÌÍÐÛÚÛXÈHÕRPÝXY ÌÍÑÕRWÑUWÐÛÚÛXÊBIÌÍÐÛÚÛXÕØZ]HÕRPÝXY ÌÍÑÕRWÑUWÐÛÚÛXÕØZ] BIÌÍÓØÚÕØZ]HÕRPÝXY ÌÍÑÕRWÑUWÓØÚÕØZ] BIÌÍÑØÚÕ[YHHÕRPÝXY ÌÍÑÕRWÑUWÑØÚÕ[YJBIÌÍÓZ[[ÐÚXÚÈHÕRPÝXY ÌÍÑÕRWÑUWÓZ[[ÐÚXÚÊBIÌÍÓZ[[Õ[YHÕRPÝXY ÌÍÑÕRWÑUWÓZ[[Õ[YBIÌÍÓZ[[Õ[YHHÕRPÝXY ÌÍÑÕRWÑUWÓZ[[Õ[YJBIÌÍÔX][[Ý[HÕRPÝXY ÌÍÑÕRWÑUWÔX][[Ý[ B[[ÈÏOIÝÐÚXÚÑÕR I've attached my GUI, just in case it helps any. This one small part has been defeating my intelligence for days now..gui1.au3 Edited February 28, 2008 by SixWingedFreak Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 The mainloop doesn't kick in becaues you have a While 1 loop in your RunGUI function. I advise you to make a While 1 loop outside the functions, and from that call the RunGUI function constantly(remove the While 1 loop from RunGUI), that way you can call it from inside the MainLoop function to handle the gui. What I meant by message handling is just handling the gui(like you do in RunGUI) Link to comment Share on other sites More sharing options...
SixWingedFreak Posted February 28, 2008 Author Share Posted February 28, 2008 (edited) The mainloop doesn't kick in becaues you have a While 1 loop in your RunGUI function. I advise you to make a While 1 loop outside the functions, and from that call the RunGUI function constantly(remove the While 1 loop from RunGUI), that way you can call it from inside the MainLoop function to handle the gui. What I meant by message handling is just handling the gui(like you do in RunGUI) I cut down the GUI handling to the most important buttons to debug it a little easier, and make it easier to read. I hope this is what you meant: expandcollapse popup;; ---------------------------------------- ;; MainLoop ;; ---------------------------------------- LoadSettings() While 1 RunGUI() WEnd Func MainLoop() RunGUI() CheckGUI() LogOn() ActivateWindow() CenterCursor() Do Prepare() Undock() CenterCursor() Sleep($CheckWait * 1000) UndockCheck() WarpToBelt() CenterCursor() Sleep($CheckWait * 1000) WarpToBeltCheck() LaunchDrones() Target() CenterCursor() Sleep($LockWait * 1000) FireLasers() CenterCursor() Sleep($CheckWait * 1000) MiningCheck() MiningTimer() ReturnDrones() Dock() CenterCursor() Sleep($CheckWait * 1000) DockCheck() Sleep(10000) MoveCargo() CenterCursor() Sleep(2000) $RepeatCounter = $RepeatCounter + 1 LogOffDT() Until $RepeatCounter = $RepeatAmount LogOff() EndFunc ;==>MainLoop ;; ---------------------------------------- ;; GUI ;; ---------------------------------------- Func RunGUI() $gMsg = GUIGetMsg() Switch $gMsg Case $GUI_EVE_SaveSettingsButton SaveSettings() Case $GUI_EVE_LoadSettingsButton LoadSettings() Case $GUI_EVE_StartButton MainLoop() Case $GUI_EVE_StopButton Exit EndSwitch EndFunc ;==>RunGUI But that didn't work either, it does the same thing. Blah. Unless I followed your instructions wrong... Edited February 28, 2008 by SixWingedFreak Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 Hmm, mind posting the full code? Link to comment Share on other sites More sharing options...
SixWingedFreak Posted February 28, 2008 Author Share Posted February 28, 2008 (edited) Hmm, mind posting the full code?Yep, no problem.main.au3gui.au3vars.au3 Edited February 28, 2008 by SixWingedFreak Link to comment Share on other sites More sharing options...
Yeik Posted February 28, 2008 Share Posted February 28, 2008 Yep, no problem.Just a thought/suggestion, have you tried to comment out all the sleep states?Instead maybe have a popup, saying you would normally have a sleep state, waiting for you to hit ok.sleep() inside of a loop renders everything useless until the sleep() is done. func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 I don't see why you have separated the script into 3 scripts. :/ Also there's some problems with your conditional checks, ex: If $Bookmark = "1" Then MouseClick("right", $Bookmark1[0], $Bookmark1[1], 1, $MouseSpeed) MouseClick("left", $Bookmark1Warp[0], $Bookmark1Warp[1], 1, $MouseSpeed) EndIf If $Bookmark = "2" Then MouseClick("right", $Bookmark2[0], $Bookmark2[1], 1, $MouseSpeed) MouseClick("left", $Bookmark2Warp[0], $Bookmark2Warp[1], 1, $MouseSpeed) EndIf If $Bookmark is 1 then it can't be 2, so a correct usage would be: If $Bookmark = "1" Then MouseClick("right", $Bookmark1[0], $Bookmark1[1], 1, $MouseSpeed) MouseClick("left", $Bookmark1Warp[0], $Bookmark1Warp[1], 1, $MouseSpeed) ElseIf $Bookmark = "2" Then MouseClick("right", $Bookmark2[0], $Bookmark2[1], 1, $MouseSpeed) MouseClick("left", $Bookmark2Warp[0], $Bookmark2Warp[1], 1, $MouseSpeed) EndIf But my preferred way to do something like that, is by using Switch: Switch $Bookmark Case 1 MouseClick("right", $Bookmark1[0], $Bookmark1[1], 1, $MouseSpeed) MouseClick("left", $Bookmark1Warp[0], $Bookmark1Warp[1], 1, $MouseSpeed) Case 2 MouseClick("right", $Bookmark2[0], $Bookmark2[1], 1, $MouseSpeed) MouseClick("left", $Bookmark2Warp[0], $Bookmark2Warp[1], 1, $MouseSpeed) ;etc. EndSwitch And the solution to your problem with the inresponsive gui would probably be to remove the Sleeps all over in your code, and/or adding the function that handles your GUI to all your "big" loops, or perhaps using it with AdlibEnable, OR(perhaps the best solution) would be to make a separate script that does all the stuff in your mainloop when it's run. Link to comment Share on other sites More sharing options...
Yeik Posted February 28, 2008 Share Posted February 28, 2008 I don't see why you have separated the script into 3 scripts. :/ Also there's some problems with your conditional checks, ex: If $Bookmark = "1" Then MouseClick("right", $Bookmark1[0], $Bookmark1[1], 1, $MouseSpeed) MouseClick("left", $Bookmark1Warp[0], $Bookmark1Warp[1], 1, $MouseSpeed) EndIf If $Bookmark = "2" Then MouseClick("right", $Bookmark2[0], $Bookmark2[1], 1, $MouseSpeed) MouseClick("left", $Bookmark2Warp[0], $Bookmark2Warp[1], 1, $MouseSpeed) EndIf If $Bookmark is 1 then it can't be 2, so a correct usage would be: If $Bookmark = "1" Then MouseClick("right", $Bookmark1[0], $Bookmark1[1], 1, $MouseSpeed) MouseClick("left", $Bookmark1Warp[0], $Bookmark1Warp[1], 1, $MouseSpeed) ElseIf $Bookmark = "2" Then MouseClick("right", $Bookmark2[0], $Bookmark2[1], 1, $MouseSpeed) MouseClick("left", $Bookmark2Warp[0], $Bookmark2Warp[1], 1, $MouseSpeed) EndIf But my preferred way to do something like that, is by using Switch: Switch $Bookmark Case 1 MouseClick("right", $Bookmark1[0], $Bookmark1[1], 1, $MouseSpeed) MouseClick("left", $Bookmark1Warp[0], $Bookmark1Warp[1], 1, $MouseSpeed) Case 2 MouseClick("right", $Bookmark2[0], $Bookmark2[1], 1, $MouseSpeed) MouseClick("left", $Bookmark2Warp[0], $Bookmark2Warp[1], 1, $MouseSpeed) ;etc. EndSwitch And the solution to your problem with the inresponsive gui would probably be to remove the Sleeps all over in your code, and/or adding the function that handles your GUI to all your "big" loops, or perhaps using it with AdlibEnable, OR(perhaps the best solution) would be to make a separate script that does all the stuff in your mainloop when it's run. most of that is just the correct way to do the if, elseif, it wont error out the way it is, just no need to check something both times, as its a little inefficient, although i dont think anybody that uses AutoIT is worried about efficiency and the resources that it uses, esp when they are using a GUI with a loop. func get_quote() local $quote switch random(1, 3, 1) case 1 $quote = '"' & "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, " & _ "design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give " & _ "orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, " & _ "fight efficiently, die gallantly. Specialization is for insects." & '"' & " Robert A. Heinlein" case 2 $quote = '"' & "Within each of us lies the power of our consent to health and sickness, to riches and poverty, to freedom " & _ "and to slavery. It is we who control these, and not another." & '"' & " Richard Bach (Illusions)" case 3 $quote ='"' & "Don't handicap your children by making their lives easy." & '"' & " Robert A. Heinlein" EndSwitch MsgBox(0, "Quote for the moment", $quote & @CRLF) EndFunc get_quote() Link to comment Share on other sites More sharing options...
FreeFry Posted February 28, 2008 Share Posted February 28, 2008 most of that is just the correct way to do the if, elseif, it wont error out the way it is, just no need to check something both times, as its a little inefficient, although i dont think anybody that uses AutoIT is worried about efficiency and the resources that it uses, esp when they are using a GUI with a loop.Yes, well it's a good practice to try and make the code as efficient as possible. And it just looks more 'correct' in my eyes. Link to comment Share on other sites More sharing options...
Ealric Posted February 28, 2008 Share Posted February 28, 2008 Er, well from the looks of this you are creating an EVE Mining bot. I checked out your code from start to finish and you have a ton of errors. I'll start with some of the obvious: At the start of your script you notice that your main windows and even the pause button works fine? System tray works fine too. Once you push the left side start button (which isn't labeled) you make a call to hide your GUI. I see that you also start a check of reading the variables and then you go through logon process if it's checked. Although, I think some of that code needs some serious work but I'm not going there right now. Once that's done, you are moving along and get stuck in the function below: Func ActivateWindow() WinWait("EVE") WinActivate("EVE") WinWaitActive("EVE") EndFunc ;==>ActivateWindowoÝ÷ ÙhbrÞq«¬z+wöË-¹É"ØZ¶qêr^Ê«¶¶²mç(ë"§-÷Û(vay»¶ì"wÚrØßÛ ¢)à¶Z¦§|¨º°èÕ'¶)e¢Z³¥÷«²Ú¬¥æ¤x¢¼!jܨ¹ªÞ¶¼¢hiÇ(b²Þ²Ø§ èÕ'¶)bÈy¥¡W µg§vZ(¦+²H§ú+¦ºé¬¶rêÀ*'zí²W¦È²ÛªÞ§Újë¶Ø«yhbè-ÁéÝ)¶jÇ¡û§rب.ç¶Þ¶§0Ê°j{r¢êæj)å¢m£ +8^¦ºé¢²0Êè(xnÒÊ°j{m¢Úè¹¹^²(¶Ø^Ë.{*.².Öu©¬º1¶ay· yâ z÷«Éû§rب)ò¢êæj)å¢i¢»b¢z¶¬r¸©µ*&zØb")Z®Ú-çèZ0xºÚ"µÍ[ÈXÝ]]UÚ[ÝÊ BSÙÐÞ ][ÝÐXÝ]]UÚ[ÝÊ I][ÝË ][ÝÒIÌÎNÛHÝÈ[È[Ý[Û][ÝÊBUÚ[ØZ] ][ÝÑUI][ÝÊBUÚ[XÝ]]J ][ÝÑUI][ÝÊBUÚ[ØZ]XÝ]J ][ÝÑUI][ÝÊB[[ÈÏOIÝÐXÝ]]UÚ[Ý Do that for every function in that mainloop() portion of your script. When you hit a message box, click through it. When the message box prompts stop, remember the last one you clicked and you know where the script froze at. Once you reach that point, come back and let me know and I'll help you through it. Personally speaking, I'd rewrite about 60% of the code you posted but it wouldn't be something I'd like to do considering I don't play EVE and a lot of the testing involves being in that game directly. I hope that helps. My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic] Link to comment Share on other sites More sharing options...
Ealric Posted February 28, 2008 Share Posted February 28, 2008 Also, while I don't mind helping and assisting people with code and programming, I stopped doing BOTS a looooong time ago. So, I'm not particularly in agreement with others using them. However, to each his or her own. The last time I wrote a bot with autoit was way back in ffxi. My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic] Link to comment Share on other sites More sharing options...
SixWingedFreak Posted February 29, 2008 Author Share Posted February 29, 2008 (edited) Thanks for the help guys. You have no idea how much all this helps. I started taking FreeFry's advice, and fixed all of my functions with the multiple Ifs to use ElseIf instead. I fixed the "MiningCheck" function as well. I also moved the scipt back as one file. I had it split into three files to make it easier for myself to read and manage. Oh, the buttons show up as blank because I use AutoIt3Wrapper to include them in the resource adding part. I'm sure you now know, the left button is Play, middle is Pause, and right is Stop.I have attached a slightly revised version with the changes above. I don't know about needing the MessageBox however, as the whole script runs and goes about executing the MainLoop absolutely fine. It doesn't get hung on the ActivateWindow function when I use it. Or on any part for that matter. It either activates the EVE window or runs eve.exe, and goes on it's merry way all through the night, with no issue.As for the Do/Untils... well, which one are you talking about exactly? The one in the MainLoop? I've removed the Do/Until from that function before, and it didn't help. Maybe I'm missing what you're saying. I also tried removing the ActivateWindow function, and even as it's just moving the mouse on my desktop, I still can't use the Pause and Stop buttons after I hit Play.I don't know... I guess I'll have to tinker with it more.I know you said you didn't want to get into it in your post, but how would you go about reading and checking the variables? You said that part needs serious work, so now you have my attention on that.And sorry my script is morally questionable..? xP I can't stand the drone and bore of mining in this game, especially after playing it for two years now. Staring at giant space rocks for hours on end is never fun.Any more suggestions and help regarding what I'm doing wrong to make my buttons stop working is appreciated. Or help making my code more efficient... that's always a good thing, too.AutoOre_v9.1b.au3 Edited February 29, 2008 by SixWingedFreak Link to comment Share on other sites More sharing options...
Ealric Posted February 29, 2008 Share Posted February 29, 2008 Heya mate, I was only stating my position because I do community work in other games and don't want people assuming that I promote botting. That's all Okay, I took a peek at your new code. Some of the optimizations look a little better now and having it all in one file is easier to read. My advice to you would be to do the following: 1. Clean up the code first -- All of those GuiSet... statements that have (-1, - change them to ($variablename . While it's not 100% necessary, it is more proper and makes finding those variables later on a little bit easier. Starting at line 490.. Those GuiCtrlReads should be using: If BitOR(GUICtrlRead($GUI_EVE_LogOn), $GUI_UNCHECKED) = $GUI_UNCHECKED ThenoÝ÷ Øjë¶ç$n^²·º¹æº[b¦W¬µ«^±.ç¶!yɨ§²Ûa¢Ç¬µ«^³`v«¨µ×º" ®¢ÛhÊ«r^ë,j£¬j·§ßÛ`¢)à¶Þ¦»z{[ºÜ!jܨºÈhºW]¢+)§²¶§©hazX§zÊjëh×6#include <Date.au3> Global $debug = 1 Func _debugmyvar($var,$read) If $debug = 1 Then $file = FileOpen("path\filename.ext",1) ; append to end of file FileWrite($file, _DateTimeFormat( _NowCalc(),0)) ; write date/time FileWrite($file, @CRLF) FileWrite($file, "Variable " & $var & " = " & $read & @CRLF) EndIf EndFunc Func _debugmyfuncpos($funcname) If $debug = 1 Then $file = FileOpen("path\filename.ext",1) ; append to end of file FileWrite($file, _DateTimeFormat( _NowCalc(),0)) ; write date/time FileWrite($file, @CRLF) FileWrite($file, "Entering the " & $funcname & " function.) EndIf EndFuncoÝ÷ Ù8^*.i×mçèZ0x~׫¶¯j¸nW¬ªê-{"uꮢܨº·îËb¢{(©ò«z)íë®*mÊ°j{m¡È^rKaza1jjeyf«¥:z[_ºw-ϧ¶¥w¬®(!µ§íz»ayû§rب«¢+Ù}ÕµåÕ¹Á½Ì ÅÕ½Ðí]ÉÁQ½ ±ÐÅÕ½Ðì¤(%}ÕµåÙÈ ÅÕ½ÐíA½Á±A±Í=Á¹lÁtÅÕ½Ðì°ÀÌØíA½Á±A±Í=Á¹lÁt¤(%}ÕµåÙÈ ÅÕ½ÐíA½Á±A±Í=Á¹lÅtÅÕ½Ðì°ÀÌØíA½Á±A±Í=Á¹lÅt Remember, this is only an example. By adding debug code you can determine when to write and when not to write. When you finish using your script you would have an idea of what the variables were that you wanted to check, what position/function you are reaching and at what point it was freezing, if any, and have the time as well. I hope it helps you out. My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic] Link to comment Share on other sites More sharing options...
Ealric Posted February 29, 2008 Share Posted February 29, 2008 (edited) Those functions should appear more like: Func _debugmyvar($var,$read) If $debug = 1 Then $file = FileOpen("path\filename.ext",1) ; append to end of file FileWrite($file, _DateTimeFormat( _NowCalc(),0)) ; write date/time FileWrite($file, @CRLF) FileWrite($file, "Variable " & $var & " = " & $read & @CRLF) FileClose($file) EndIf EndFunc Func _debugmyfuncpos($funcname) If $debug = 1 Then $file = FileOpen("path\filename.ext",1) ; append to end of file FileWrite($file, _DateTimeFormat( _NowCalc(),0)) ; write date/time FileWrite($file, @CRLF) FileWrite($file, "Entering the " & $funcname & " function.") FileClose($file) EndIf EndFunc Sorry, I had forgot to close the files. Edited February 29, 2008 by Ealric My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic] Link to comment Share on other sites More sharing options...
SixWingedFreak Posted February 29, 2008 Author Share Posted February 29, 2008 (edited) I did as you said. All of step one, anyway. Will work on step two (debugging) in a little bit. Those GuiCtrlReads should be using: If BitOR(GUICtrlRead($GUI_EVE_LogOn), $GUI_UNCHECKED) = $GUI_UNCHECKED ThenoÝ÷ Øjë¶ç$n^²·º¹æº[b¦W¬µ«^±.ç¶!yɨ§²Ûa¢Ç¬µ«^³ú®¢×²Øb±Ê+ç-¶§~Ú[azȦV«B¶¹Qy§l#¬ºÈ§)Ë¡§RzÛbÚZ®Û(~l)^)jëh×6If BitOR(GUICtrlRead($GUI_EVE_LogOn), $GUI_UNCHECKED) = $GUI_UNCHECKED Then GUICtrlSetState($GUI_EVE_Pass, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_PassSave, $GUI_DISABLE) GUICtrlSetState($GUI_EVE_Wait, $GUI_DISABLE) ElseIf BitOR(GUICtrlRead($GUI_EVE_LogOn), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($GUI_EVE_Pass, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_PassSave, $GUI_ENABLE) GUICtrlSetState($GUI_EVE_Wait, $GUI_ENABLE) EndIf Edited February 29, 2008 by SixWingedFreak 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