Sign in to follow this  
Followers 0
Onisonic

Looping back to the beginning of a script

4 posts in this topic

I'm trying to edit my script to loop back to the beginning when the sleep at the end is complete but for some reason it won't work.

Any idea what I can do to fix it?

#include <ImageSearch.au3>

HotKeySet("{ESC}", "Terminate")

MsgBox(0,"Spirit Weapon Feeder","Work In Progress)                                                                                                                                              Enjoy!")


Global $x,$y        ; Default Coordinates
Global $gx,$gy      ; Give item Coordinates
Global $cx,$cy      ; Continue Coordinates
Global $fx,$fy      ; Feed Food Kit Coordinates
Global $ox,$oy      ; Ok Coordinates
Global $fcx,$fcy    ; Finish Conversation - When you feed last item in inventory she talks more than usual
Global $mx,$my      ; Manus Coordinates
Global $sx,$sy      ; Shop Coordinates
Global $px,$py      ; Food Kit Coordinates
Global $bx,$by      ; Buy Food Kit Coordinates
Global $ex,$ey      ; End Conversation Coordinates
Global Const $ms=0  ; Mouse speed

While 1
    TalkToEgo()

    Feed()

    BuyMoreFood()
WEnd

Func TalkToEgo()
    Send("{/}")
    Sleep(5000)
EndFunc

Func Feed()
     While 1
     ;Start an infinite loop
    _ImageSearch("Give.png",1,$gx,$gy,30)
    MouseClick("Primary", $gx, $gy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Feed.png",1,$fx,$fy,30)
    MouseClick("Primary", $fx, $fy, 1)
    Sleep(3000)
    _ImageSearch("Ok.png",1,$ox,$oy,30)
    MouseClick("Primary", $ox, $oy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Feed.png",1,$fx,$fy,30)
    MouseClick("Primary", $fx, $fy, 1)
    Sleep(3000)
    _ImageSearch("Ok.png",1,$ox,$oy,30)
    MouseClick("Primary", $ox, $oy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Feed.png",1,$fx,$fy,30)
    MouseClick("Primary", $fx, $fy, 1)
    Sleep(3000)
    _ImageSearch("Ok.png",1,$ox,$oy,30)
    MouseClick("Primary", $ox, $oy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Feed.png",1,$fx,$fy,30)
    MouseClick("Primary", $fx, $fy, 1)
    Sleep(3000)
    _ImageSearch("Ok.png",1,$ox,$oy,30)
    MouseClick("Primary", $ox, $oy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Feed.png",1,$fx,$fy,30)
    MouseClick("Primary", $fx, $fy, 1)
    Sleep(3000)
    _ImageSearch("Ok.png",1,$ox,$oy,30)
    MouseClick("Primary", $ox, $oy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
        _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(3000)
    _ImageSearch("FinishC.png",1,$fcx,$fcy,30)
    MouseClick("Primary", $fcx, $fcy, 1)
    Sleep(3000)
    _ImageSearch("End.png.",1,$ex,$ey,30)
    MouseClick("Primary", $ex, $ey, 1)
EndFunc

Func BuyMoreFood()
    Sleep(4000)
    _ImageSearch("Manus.png",1,$mx,$my,30)
    MouseClick("Primary", $mx, $my, 1)
    Sleep(5000)
    _ImageSearch("Continue.png",1,$cx,$cy,30)
    MouseClick("Primary", $cx, $cy, 1)
    Sleep(4000)
    _ImageSearch("Shop.png",1,$sx,$sy,30)
    MouseClick("Primary", $sx, $sy, 1)
    SLeep(4000) 
    _ImageSearch("BuyFood.png",0,$px,$py,50)
    MouseClick("Primary", $px, $py, 1)
    SLeep(4000)
    _ImageSearch("Buy.png",1,$bx,$by,30)
    MouseClick("Primary", $bx, $by, 1)
    Sleep(4000)
    MouseClick("Secondary")
    Sleep(1000)
    _ImageSearch("BuyFood.png",0,$px,$py,50)
    MouseClick("Primary", $px, $py, 1)
    SLeep(4000)
    _ImageSearch("Buy.png",1,$bx,$by,30)
    MouseClick("Primary", $bx, $by, 1)
    Sleep(4000)
    MouseClick("Secondary")
    Sleep(1000)
    _ImageSearch("BuyFood.png",0,$px,$py,50)
    MouseClick("Primary", $px, $py, 1)
    SLeep(4000)
    _ImageSearch("Buy.png",1,$bx,$by,30)
    MouseClick("Primary", $bx, $by, 1)
    Sleep(4000)
    MouseClick("Secondary")
    Sleep(1000)
    _ImageSearch("BuyFood.png",0,$px,$py,50)
    MouseClick("Primary", $px, $py, 1)
    SLeep(4000)
    _ImageSearch("Buy.png",1,$bx,$by,30)
    MouseClick("Primary", $bx, $by, 1)
    Sleep(4000)
    MouseClick("Secondary")
    Sleep(1000)
    _ImageSearch("BuyFood.png",0,$px,$py,50)
    MouseClick("Primary", $px, $py, 1)
    SLeep(4000)
    _ImageSearch("Buy.png",1,$bx,$by,30)
    MouseClick("Primary", $bx, $by, 1)
    Sleep(4000)
    MouseClick("Secondary")
    Sleep(1000)
    _ImageSearch("End.png",1,$ex,$ey,30)
    MouseClick("Primary", $ex, $ey, 1)
    Sleep(1800000)
EndFunc

Func Restart()
    WEnd
     ;Go back to start of infinite loop
EndFunc

Share this post


Link to post
Share on other sites



Func Restart()
    WEnd
     ;Go back to start of infinite loop
EndFunc

This makes no sense, and wont work.

For a start, the function is never called, it is stupid to make a bot in such a manner etc...

1. Remove the While 1 in your feed function, and its already going back to the start.

2. Stop making crap bots, its stupid.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Func Restart()
    WEnd
     ;Go back to start of infinite loop
EndFunc

This makes no sense, and wont work.

For a start, the function is never called, it is stupid to make a bot in such a manner etc...

1. Remove the While 1 in your feed function, and its already going back to the start.

2. Stop making crap bots, its stupid.

Thank you for your input I appreciate it.

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