salter Posted October 30, 2006 Share Posted October 30, 2006 (edited) hi i keep getting the recursion error after about an hour or so of running the script can someone help me fix it, i have no clue how to. Code Reposted heres my code: expandcollapse popup; BucaneerBot Global $monster Hotkeyset("{HOME}","start") Hotkeyset("{END}","stop") if Not WinExists("Pirate King Online 1.32 - 00005") then MsgBox(64, "BucaneerBot", "You must be running Pirate king online and WPE Pro") Exit EndIf MsgBox(64, "BucaneerBot", "First you must set up WPE PRO with the attack monster packet that you want to use, if you have press OK.") $waittime = InputBox("BucaneerBot", "How long do you want to wait after killing the monster", "", "") $CharNumber = InputBox("BucaneerBot", "What Char are you using 1,2 or 3", "", "") MsgBox(64, "BucaneerBot", "To Start the Bot Press the Home Key, and to stop press the End Key") Global $stop Func start() WinActivate ( 'Pirate King Online 1.32 - 00005' ) ToolTip("BucaneerBot: Setting Windows up.... ", 2, 0) Sleep(350) WinMove("Pirate King Online 1.32 - 00005","", 1, 106,806,632) Sleep(500) WinMove("WPE PRO - game.exe","", 806, 209,768,530) Sleep ( 500 ) while 1 If PixelGetColor(132, 162) = 4949153 Then Check() Else Attack() EndIf WEnd $stop = NOT $stop While $stop Wend EndFunc Func Check() ToolTip("BucaneerBot: Checking Hp ", 2, 0) WinActivate ( 'WPE PRO - game.exe' ) Sleep(Random(400,600)) MouseClick("left", 861,515) Sleep(Random(300,500)) WinActivate ( 'Pirate King Online 1.32 - 00005' ) Sleep(Random(250,500)) Send("{INSERT}") ToolTip("BucaneerBot: Healing... ", 2, 0) Sleep(6000) While 1 if PixelGetColor(181, 163) = 14976649 Then Sleep(Random(500,800)) Send("{INSERT}") Sleep(random(800,1500)) ExitLoop Else Sleep(Random(1000,1500)) EndIf Wend EndFunc Func Attack() ToolTip("BucaneerBot: Ready ", 2, 0) sleep(Random(120,350)) WinActivate ( 'WPE PRO - game.exe' ) While 1 MouseClick("left", 833,520) Sleep(400) MouseClick("left", 965,488) ToolTip("BucaneerBot: Sending Attack Packets ", 2, 0) sleep(Random(1500,2500)) MonsterCheck() WEnd EndFunc Func MonsterCheck() ToolTip("BucaneerBot: Monster Check ", 2, 0) $monster = 0 If PixelGetColor(64,591) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(58,589) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(76,593) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(103,592) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(123,591) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(137,593) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(142,592) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(154,592) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(157,591) = 16776960 Then $monster = $monster + 1 EndIf If $monster = 9 Then Pickup() Else Attack() EndIf EndFunc Func Pickup() ToolTip("BucaneerBot: Picking up Items ", 2, 0) WinActivate ( 'Pirate King Online 1.32 - 00005' ) sleep(Random(2000,3000)) Send("{CTRLDOWN}") Send("a") Sleep(Random(500,1000)) Send("{CTRLUP}") sleep(Random(1500,3000)) If PixelGetColor(132, 162) = 4949153 Then Check() EndIf EndFunc Func stop() Exit EndFunc While 1 $coord = PixelSearch(5,607,273,702, 0xFFB0D8, 10) If Not @error Then WinActivate ( 'Pirate King Online 1.32 - 00005' ) Sleep(Random(1000,1200)) Send ("{ESC}") Sleep(Random(800,1300)) MouseClick("left" , 397,479) Sleep(1000) ToolTip("BucaneerBot: GM Protection Activated ", 2, 0) Sleep(600000) If $CharNumber = 1 Then MouseClick("left" , 397,479) Sleep(1000) MouseClick("left" , 425,694) Sleep(7000) EndIf If $CharNumber = 2 Then MouseClick("left" , 435,456) Sleep(1000) MouseClick("left" , 425,694) Sleep(7000) EndIf If $CharNumber = 3 Then MouseClick("left" , 615,467) Sleep(1000) MouseClick("left" , 425,694) Sleep(7000) EndIf EndIf WEnd Edited October 31, 2006 by salter Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 30, 2006 Moderators Share Posted October 30, 2006 http://www.autoitscript.com/forum/index.ph...te=%2BRecursion Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
salter Posted October 31, 2006 Author Share Posted October 31, 2006 srry dont understand how i could restructure my code to stop the thing from calling funcs without ending them and have it do the same thing. When i get the error it says attack() If someone could give me a few tips on how i could change my code abit that would be great. Link to comment Share on other sites More sharing options...
gamerman2360 Posted October 31, 2006 Share Posted October 31, 2006 (edited) Can you please repost your code, the code posted dosn't work.CODEGlobal $monsterHotkeyset("{HOME}","start")Hotkeyset("{END}","stop")if Not WinExists("Pirate King Online 1.32 - 00005") then MsgBox(64, "BucaneerBot", "You must be running Pirate king online and WPE Pro") ExitEndIfMsgBox(64, "BucaneerBot", "First you must set up WPE PRO with the attack monster packet that you want to use, if you have press OK.")$waittime = InputBox("BucaneerBot", "How long do you want to wait after killing the monster", "", "")$CharNumber = InputBox("BucaneerBot", "What Char are you using 1,2 or 3", "", "") MsgBox(64, "BucaneerBot", "To Start the Bot Press the Home Key, and to stop press the End Key")Global $stopFunc start()WinActivate ( 'Pirate King Online 1.32 - 00005' )ToolTip("BucaneerBot: Setting Windows up.... ", 2, 0)Sleep(350)WinMove("Pirate King Online 1.32 - 00005","", 1, 106,806,632)Sleep(500)WinMove("WPE PRO - game.exe","", 806, 209,768,530)Sleep ( 500 )while 1 If PixelGetColor(132, 162) = 4949153 Then Check()ElseAttack()EndIfEndIfWEnd$stop = NOT $stopWhile $stop Wend EndFuncFunc Check() ToolTip("BucaneerBot: Checking Hp ", 2, 0) WinActivate ( 'WPE PRO - game.exe' ) Sleep(Random(400,600)) MouseClick("left", 861,515) Sleep(Random(300,500)) WinActivate ( 'Pirate King Online 1.32 - 00005' ) Sleep(Random(250,500)) Send("{INSERT}") ToolTip("BucaneerBot: Healing... ", 2, 0) $timer2 = TimerStart() While PixelGetColor(180, 163) = 4949153 if timerdiff($timer2) > 30 * 1000 then Send("{INSERT}") Sleep(Random(400,600)) Else Sleep(Random(1000,1500)) EndIf Wend Sleep(Random(500,800)) Send("{INSERT}") Sleep(random(800,1500)) EndFuncFunc Attack() ToolTip("BucaneerBot: Ready ", 2, 0) sleep(Random(120,350)) WinActivate ( 'WPE PRO - game.exe' ) While 1MouseClick("left", 833,520)Sleep(400)MouseClick("left", 965,488)ToolTip("BucaneerBot: Sending Attack Packets ", 2, 0)sleep(Random(1500,2500)) MonsterCheck()WEndEndFuncFunc MonsterCheck() ToolTip("BucaneerBot: Monster Check ", 2, 0) $monster = 0 If PixelGetColor(64,591) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(58,589) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(76,593) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(103,592) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(123,591) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(137,593) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(142,592) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(154,592) = 16776960 Then $monster = $monster + 1 EndIf If PixelGetColor(157,591) = 16776960 Then $monster = $monster + 1 EndIf If $monster = 9 Then Pickup() Else Attack() EndIf EndFuncFunc Pickup()ToolTip("BucaneerBot: Picking up Items ", 2, 0)WinActivate ( 'Pirate King Online 1.32 - 00005' )sleep(Random(2000,3000))Send("{CTRLDOWN}")Send("a")Sleep(Random(500,1000))Send("{CTRLUP}")sleep(Random(1500,3000))If PixelGetColor(132, 162) = 4949153 ThenCheck() EndFuncFunc stop()ExitEndFuncWhile 1$coord = PixelSearch(5,607,273,702, 0xFFB0D8, 10)If Not @error ThenWinActivate ( 'Pirate King Online 1.32 - 00005' ) Sleep(Random(1000,1200)) Send ("{ESC}") Sleep(Random(800,1300)) MouseClick("left" , 397,479) Sleep(1000)ToolTip("BucaneerBot: GM Protection Activated ", 2, 0)Sleep(600000)If $CharNumber = 1 ThenMouseClick("left" , 397,479)Sleep(1000)MouseClick("left" , 425,694)Sleep(7000)EndIfIf $CharNumber = 2 ThenMouseClick("left" , 435,456)Sleep(1000)MouseClick("left" , 425,694)Sleep(7000)EndIfIf $CharNumber = 3 ThenMouseClick("left" , 615,467)Sleep(1000)MouseClick("left" , 425,694)Sleep(7000)EndIf EndIfWEnd Edited October 31, 2006 by gamerman2360 Link to comment Share on other sites More sharing options...
salter Posted October 31, 2006 Author Share Posted October 31, 2006 o srry bout that lol its reposted now Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 31, 2006 Moderators Share Posted October 31, 2006 That requires a whole re-write of your code. You never end a function, you just keep calling other ones. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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