EasyCo Posted January 24, 2008 Posted January 24, 2008 (edited) Hi, I need help with an error.Image of error:My script can run for 2-4 hours then will randomly crash and I receive this error.Anyone know what could cause this?My script is for a game Diablo II.expandcollapse popup#include <GUIConstants.au3> FileInstall("C:\Documents and Settings\Administrator\Desktop\1UP v1.0(dev)\DoNotRemove.bmp", "C:\") HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{END}", "ext") HotKeySet("{HOME}", "channelcheck") HotKeySet("{INSERT}", "act") GUICreate("1UP v1.0",470,500, 805,0) GUISetBkColor (0); will change background color $Background = GuiCtrlCreatePic("C:\DoNotRemove.bmp",0,0, 470,500, $GUI_DISABLE) $user = GUICtrlCreateDummy() $Button_1 = GUICtrlCreateButton ("Disabled for the moment.", 20, 463, 130) $Button_2 = GUICtrlCreateButton ( "Show HotKeys", 170, 463, 130) $Button_3 = GUICtrlCreateButton ( "About..", 320, 463, 130) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $Button_1 ;filter() Case $msg = $Button_2 showhotkeys() Case $msg = $Button_3 info() EndSelect Wend Func channelcheck() ToolTip("Channel Check", 0, 0) Sleep(2000) $coord = PixelSearch(403, 467, 403, 467, 2636900) If Not @error Then search1() Else ingamecheck2() EndIf EndFunc Func searchgame();used for redvex game filter ToolTip("1UP v1.0: Starting! ", 0, 0) Sleep(10000) joingame() Sleep(6000) ingamecheck() EndFunc Func search1() ToolTip("1UP v1.0: Starting!.", 0, 0) Sleep(2000) MouseClick("left",711,454,1,2) Sleep(2000) MouseClick("left",576,224,1,2) Sleep(1400) b1() ingamecheck() EndFunc Func b1() $coord = PixelSearch( 427, 216, 557, 391, 16526336) If Not @error Then a1() Else search2() endif EndFunc Func a1() $coord = PixelSearch( 427, 216, 557, 391, 16569436) If Not @error Then l1() Else search2() EndIf EndFunc Func l1() $coord = PixelSearch( 427, 216, 557, 391, 88) If Not @error Then number1() Else search2() EndIf EndFunc Func number1() $coord = PixelSearch( 427, 216, 557, 391, 7373880) If Not @error Then $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) search2() EndIf EndIf EndFunc Func b2() $coord = PixelSearch( 427, 216, 557, 391, 16526336) If Not @error Then a2() Else search3() EndIf EndFunc Func a2() $coord = PixelSearch( 427, 216, 557, 391, 16569436) If Not @error Then l2() Else search3() EndIf EndFunc Func l2() $coord = PixelSearch( 427, 216, 557, 391, 88) If Not @error Then number2() Else search3() EndIf EndFunc Func number2() $coord = PixelSearch( 427, 216, 557, 391, 7373880) If Not @error Then $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) search3() EndIf EndIf EndFunc Func b3() $coord = PixelSearch( 427, 216, 557, 391, 16526336) If Not @error Then a3() Else search4() EndIf EndFunc Func a3() $coord = PixelSearch( 427, 216, 557, 391, 16569436) If Not @error Then l3() Else search4() EndIf EndFunc Func l3() $coord = PixelSearch( 427, 216, 557, 391, 88) If Not @error Then number3() Else search4() EndIf EndFunc Func number3() $coord = PixelSearch( 427, 216, 557, 391, 7373880) If Not @error Then $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) search4() EndIf EndIf EndFunc Func b4() $coord = PixelSearch( 427, 216, 557, 391, 16526336) If Not @error Then a4() Else search5() EndIf EndFunc Func a4() $coord = PixelSearch( 427, 216, 557, 391, 16569436) If Not @error Then l4() Else search5() EndIf EndFunc Func l4() $coord = PixelSearch( 427, 216, 557, 391, 88) If Not @error Then number4() Else search5() EndIf EndFunc Func number4() $coord = PixelSearch( 427, 216, 557, 391, 7373880) If Not @error Then $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) search5() EndIf EndIf EndFunc Func b5() $coord = PixelSearch( 427, 216, 557, 391, 16526336) If Not @error Then a5() Else search6() EndIf EndFunc Func a5() $coord = PixelSearch( 427, 216, 557, 391, 16569436) If Not @error Then l5() Else search6() EndIf EndFunc Func l5() $coord = PixelSearch( 427, 216, 557, 391, 88) If Not @error Then number5() Else search6() EndIf EndFunc Func number5() $coord = PixelSearch( 427, 216, 557, 391, 7373880) If Not @error Then $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) search6() EndIf EndIf EndFunc Func search2() Send("{DOWN}") Sleep(1400) b2() EndFunc Func search3() Send("{DOWN}") Sleep(1400) b3() EndFunc Func search4() Send("{DOWN}") Sleep(1400) b4() EndFunc Func search5() Send("{DOWN}") Sleep(1400) b5() EndFunc Func search6() ToolTip("Failed to Find game..Trying again.",0,0) MouseClick("left",473,418,1,2) Sleep(1000) search1() EndFunc Func autoleech() ;ingamecheck(); In game Check ( incase fail to join) Sleep(4000) pty() ;Send("{TAB}"); Enable automap for towh check Sleep(4000) intowncheck(); Take tp to throne Sleep(19000) intowncheck();Check to see if a tp taken Sleep(15000) ;pty() intowncheck() Sleep(10000) intowncheck();Check to see if a tp taken Sleep(10000) intowncheck() Sleep(10000) ;pty() Sleep(5000) intowncheck() Sleep(10000) intowncheck() Sleep(10000) ToolTip("New Game In: 30 Seconds. ", 0, 0) Sleep(30000) exitgame() Sleep(5000) channelcheck() EndFunc Func sgame1() Send("{DOWN}") Sleep(1200) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) sgame2() EndIf EndFunc Func sgame2() Send("{DOWN}") Sleep(1200) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) joingame2() EndIf EndFunc Func ssgame1() Send("{DOWN}") Sleep(1200) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) ssgame2() EndIf EndFunc Func ssgame2() Send("{DOWN}") Sleep(1200) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) joingame3() EndIf EndFunc Func sssgame1() Send("{DOWN}") Sleep(1200) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) sssgame2() EndIf EndFunc Func sssgame2() Send("{DOWN}") Sleep(1200) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) joingame2() EndIf EndFunc Func joingame() ;Channel Join game ToolTip("Attempting To Join a Game.", 0, 0) Sleep(2000) ;Send("New Game Now.") ;Sleep(100) ;Send("{ENTER}") Sleep(3000) MouseClick("left",711,454,1,2) Sleep(950) MouseClick("left",481,226,1,2) Sleep(1000) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) sgame1() EndIf EndFunc Func joingame2() ;Channel Join game ToolTip("Failed To Find Game. Trying again..", 0, 0) Sleep(2000) MouseClick("left",473,418,1,2) ;Send("New Game Now.") ;Sleep(100) ;Send("{ENTER}") Sleep(3000) MouseClick("left",711,454,1,2) Sleep(800) MouseClick("left",481,226,1,2) Sleep(1000) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) ssgame1() EndIf EndFunc Func joingame3() ;Channel Join game ToolTip("Failed To Find Game. Trying again...", 0, 0) Sleep(2000) MouseClick("left",473,418,1,2) ;Send("New Game Now.") ;Sleep(100) ;Send("{ENTER}") Sleep(3000) MouseClick("left",711,454,1,2) Sleep(800) MouseClick("left",481,226,1,2) Sleep(1000) $coord = PixelSearch(724, 204, 724, 204, 12624000) If Not @error Then Sleep(900) MouseClick("left",675,412,1,2) Sleep(6000) Else Sleep(1000) sssgame1() EndIf EndFunc ;Take Tp ;Func tp(); OLD METHOD ### MOUSE CLICKS ONLY### ;MouseClick("left",394,227,1,2) ;Sleep(2600) ;MouseClick("left",493,179,1,2) ;Sleep(2600) ;MouseClick("left",440,342,1,2) ;Sleep(2600) ;EndFunc Func tp() ToolTip("Attempting To Take A Town Portal.", 0, 0) Sleep(2000) MouseMove(635, 398,1) $coord = PixelSearch( 44, 75, 600, 500, 1057896) If Not @error Then MouseMove($coord[0], $coord[1],1) Sleep(1000) MouseClick("left",$coord[0], $coord[1],2,1) Sleep(3000) thronechk() EndIf EndFunc ;now should be in throne! precast bo & holyshield Func precast() ToolTip("Attempting To Precast.", 0, 0) Send("z") Sleep(1000) Send("1") Sleep(900) MouseClick("right",593,422,1,2) Send("2") Sleep(900) MouseClick("right",593,422,1,2) Send("v") Sleep(900) MouseClick("right",593,422,1,2) Sleep(1000) Send("z") EndFunc ;Exit game now Func exitgame() MouseClick("left",472,541,1,2) Sleep(500) MouseClick("left",386,253,1,2) ;now in channel EndFunc Func ingamecheck() ToolTip("Checking To See If In Game.", 0, 0) sleep(2000) Send("{TAB}") Sleep(1000) $coord = PixelSearch( 290, 581, 290, 581, 11569224) If Not @error Then move() EndIf If @error Then exitgame() Sleep(4000) channelcheck() EndIf EndFUnc Func TogglePause() $Paused = True While $Paused sleep(200) ToolTip('1UP is now Paused.',0,0) WEnd ToolTip("") EndFunc Func ingamecheck2() ToolTip("Checking To See If In Game.", 0, 0) sleep(2000) Send("{TAB}") Sleep(1000) $coord = PixelSearch( 290, 581, 290, 581, 11569224) If Not @error Then exitgame() Sleep(4000) channelcheck() EndIf If @error Then Sleep(10000) EndIf EndFUnc Func move() MouseClick("left",666,299,1,2) Sleep(2000) MouseClick("left",666,299,1,2) questcheck() Sleep(2000) EndFunc Func ext() Exit EndFunc Func showhotkeys() MsgBox(0,"1UP v1.0 HotKeys/ Other info","<Key(s)> <what it does>" & @CR & "HOME Starts the bot" & @CR & "INSERT Activates Diablo II Window" & @CR & "PAUSE Pauses the bot" & @CR & "END Exits the Bot" & @CR &" " & @CR & "Precast keys (Set your skill keys in game to the following)" & @CR & "z = swap weapons" & @CR & "1 = battle command" & @CR & "2 = battle orders" & @CR & "v = 3rd precast (depending on the character)" & @CR & " " & @CR & "IMPORTANT Must have the mini panel open.(Used for exiting game)" & @CR & " " & @CR & "For more detailed info see the readme." & @CR & "thats all for now...") EndFunc Func info() MsgBox(0,"1UP.. about..","I made this for leeching exp in pub baal runs." & @CR & " " & @CR & "This bot will: Join random public baal games, Check for Baal quest, Auto party, Take town portals to throne, Precast, Leech xp!,") EndFunc Func intowncheck() ToolTip("In Town Check.", 0, 0) Sleep(2000) $coord = PixelSearch(607, 33, 607, 33, 13665312) If Not @error Then tp() EndIf EndFunc Func thronechk() ToolTip("In Throne Check.", 0, 0) Sleep(2000) $coord = PixelSearch(544, 32, 544, 32, 16777215) If Not @error Then ToolTip("In Throne Check: OK!", 0, 0) Sleep(2000) precast() EndIf EndFunc Func pty() ToolTip("Checking For party Invites.", 0, 0) Sleep(2000) Send("P") Sleep(400) MouseClick("left",292,136,1,2) sleep(50) MouseClick("left",292,173,1,2) sleep(50) MouseClick("left",292,212,1,2) sleep(50) MouseClick("left",292,249,1,2) sleep(50) MouseClick("left",292,286,1,2) sleep(50) MouseClick("left",292,326,1,2) sleep(50) MouseClick("left",292,365,1,2) sleep(50) Send("p") Sleep(100) EndFunc Func questcheck() ToolTip("Baal Quest Check", 0, 0) Sleep(2000) Send("l") Sleep(500) MouseClick("left", 334,236,1,2) Sleep(400) $coord = PixelSearch(118, 320, 118, 320, 6842472) If Not @error Then Send("l") ToolTip("Baal Quest Check: OK!", 0, 0) Sleep(2000) autoleech() Else Send("l") ToolTip("Baal Quest Check: Failed!", 0, 0) Sleep(2000) exitgame() Sleep(17000) channelcheck() EndIf EndFunc Func filter() WinActivate("d1") WinWaitActive("d1") WinMove("d1", "", 1, 1) Sleep(1000) Send(".filter Baal") Sleep(900) Send("{ENTER}") EndFunc Func act() WinActivate("d1") WinWaitActive("d1") WinMove("d1", "", 1, 1) EndFuncThanks for any help. Edited January 24, 2008 by EasyCo
therks Posted January 24, 2008 Posted January 24, 2008 I see a total rewrite coming...The problem you're having (after a quick glance) is that you never finish anything. The issue you're having is recursion, which means that you're functions keep calling eachother and none of them ever quit.For example, I'm just going to follow along one possible branch of code here:search1()->b1()->a1()->l1()->number1()->search2()->b2()->a2()->l2()->search3()->b3()->a3()->l3()->number3()->search4()->b4()->a4()->l4()->number4()->search5()->b5()->search6()->search1()That's just one branch. Now, what's happened here, is you've started 23 functions, and ended NONE of them, not only that, but the 22nd, is starting the first one again, so that means another loop. If it follows that same branch, that's another 23 functions, so now you're at 64, and so on and so on. It becomes an endless loop, and once you've got 384 functions going, it crashes.I don't have any direct advice, and I'm really not going to get myself tangled up in that spaghetti, but hopefully I've at least shed some light on why you're having this problem. My AutoIt Stuff | My Github
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