Sign in to follow this  
Followers 0
Jon8c

Bot Trouble...

3 posts in this topic

Ok, I like to make mini-bots for 2Moons. There's a fishing feature in the game. Basically, you wait until you catch a bite or until a green progress bar completes. If you catch a bite, the green bar disappears and two blue bars appear. The top blue bar represents the tension of the line (lower=more tension) while the lower is the distance of the fish from your character (lower=closer to you). You hold the Space Bar or click-hold the Left Mouse Button to reel the fish in. However, as you reel in the fish, the tension of the line obviously goes higher (this all depends on some other stuff, though). Well, my problem is that I wrote a script to do exactly this, but it's not working for some reason I can't discover. Here's the code:

Do;line 1
    Send("l",1);line 2
    MouseClick("left",640,512,1,1);line 3
    Sleep(1000);line 4
    Do;line 5
        $pix1=PixelSearch(120,120,130,130,0x3A73CA,5);line 6
        $color1=@error;line 7
        $pix2=PixelGetColor(133,118);line 8
        If $color1=0 Then;line 9
            Do;line 10
                Do;line 11
                    Send("{Space Down}");line 12
                    $pix3=PixelSearch(170,120,180,130,0x3A73CA,5);line 13
                    $color3=@error;line 14
                Until $color3=1;line 15
                Send("{Space Up}");line 16
                Do;line 17
                    $pix4=PixelSearch(120,120,130,130,0x3A73CA,5);line 18
                    $color4=@error;line 19
                    $pix5=PixelSearch(270,120,280,130,0x3A73CA,5);line 20
                    $color5=@error;line 21
                Until $color4=1 Or $color5=0;line 22
                $pix6=PixelSearch(120,120,130,130,0x3A73CA,5);line 23
                $color6=@error;line 24
            Until $color6=1;line 25
        EndIf;line 26
    Until $color1=1 And Hex($pix2,6)<>0x24FF00;line 27
    Sleep(5000);line 28
Until WinExists("2Moons")=0;line 29

The script successfuly loops in all situations, but it never presses space (well, not noticeabley). I did some messing around, and I figured that the thing stopping me (for the moment) is something within lines 12-14. I had replaced the Do...Until (lines 11+15) statement with While 1...WEnd, and the bot basically got stuck in the loop. The only thing I could reason out is that the script isn't correctly holding down the Space Bar for long enough, because in some instances of running the bot, it holds the space bar for about 2-3 seconds but then just lets go. Not sure if that was just a stuck key, though. I appreciate it if you went through the trouble of reading all this. Thanks in advance.

Share this post


Link to post
Share on other sites



For starters, you should make sure you have "line numbers" turned on in scite or whatever editor you use. usually View>Line Numbers.

That way you dont have to comment every line making your code unreadable. Not to mention the trouble youll have when you go adding lines in there.

For the send part,

Do
                    Send("{Space Down}")
                    $pix3=PixelSearch(170,120,180,130,0x3A73CA,5)
                    $color3=@error
                Until $color3=1

You are sending space down every iteration until it detects another color. Instead, try a single space down before the do loop, once it detects the color it breaks it and sends space up.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I don't actually write in the lines. I just did that for here lol. Well, anyway, I think I've already tried putting Space down outside of the loop, but it still didn't work I think. I'll try again. Meanwhile, are there any other conflicts you may see?

Edited by Jon8c

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