Sign in to follow this  
Followers 0
salter

need help i have recursion error

6 posts in this topic

#1 ·  Posted (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:

; 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 by salter

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Can you please repost your code, the code posted dosn't work.

CODE
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

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)

$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))

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()

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 by gamerman2360

Share this post


Link to post
Share on other sites

o srry bout that lol its reposted now

Share this post


Link to post
Share on other sites

That requires a whole re-write of your code. You never end a function, you just keep calling other ones.


[center]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.[/center]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0