Sign in to follow this  
Followers 0
demodemo

sirs.. i need some assistance...

3 posts in this topic

I've looked around in the forum for samples

i look in some of the scripts and study how they work...

everything in my script works fine except for this part:

i want a script that acts like a Goaly protecting an egg ^^,

it wont allow an object(a ball for instance that needs to be selected by pixelsearch)

to hit a certain coordinate or pass through,

Goaly will secure the ball inside the save zone(consider two poles with different coordinates)

by mousemove command until the egg becomes a chick.

here's my script.

.. still cant get it to work

.. its not looping and doesnt check and keep the object in the save zone....

Please help! thanks in advance :rolleyes:

If PixelGetColor(306, 471) = 16737792 Then
    rod()
    EndIf

WEnd
$stop = NOT $stop
While $stop
    Wend
    EndFunc


Func rod()
MouseClick("left", 440, 440, 2)
sleep(800)
MouseClick("left", 440, 440, 2)
sleep(20)
steady()
EndFunc


Func steady()
Do
sleep(2)
Until PixelGetColor(523, 398) = 0xF8E114
sleep(1000)
gridleft()
EndFunc


Func gridleft()
;MouseClick("left", 300, 440, 2)
;MouseClick("left", 300, 440, 2)
;MouseClick("left", 300, 440, 2)
;MouseMove(400, 440, 2)
;:0x190303  Dec: 1639171 < bait

        
    While PixelGetColor(305, 473) = 664395;bait reaches 0 feet  
        If PixelSearch( 360, 410, 380 490, 0x000000, 2) Then
            MouseMove(700, 240, 10)
            sleep(700)
        ElseIf PixelSearch( 440, 410, 470 490, 0x000000, 2)Then
            MouseMove(200, 240, 10)
            sleep(700)
        EndIf
    WEnd
    start()
    EndFunc

        
Func stop()
Exit
EndFunc

While 1
Sleep(50)
WEnd

Share this post


Link to post
Share on other sites



My advice would be to start at the beginning and work your way up. Try creating a function that checks for the position of the egg/ball. Then it sounds like you need one that takes that egg position, and moves your goalie accordingly. Once you have those two functions done, combine them and then initiate a loop to do both for as long as you like.

Looking for the egg would look something like this:

$egg_color = 0xFF0000
$left = 0
$top = @DesktopHeight
$bottom = 0
$right = @DesktopWidth
$egg_x = ""
$egg_y = ""

Func LookForEgg()
    $search = PixelSearch($left, $top, $right, $bottom, $egg_color, 5)
    If IsArray($search) Then
        ;Egg has been found, pass coords to another var
        $egg_x = $search[0]
        $egg_y = $search[1]
    Else
        MsgBox(0, "Error", "Egg not found!")
    EndIf
EndFunc

What you do with the coords in relation to how you move the goalie is up to you. If it was me, I'd take a couple points from the balls path and compute a trajectory, then move the goalie to where the ball will pass the goal line.

Good luck.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

Ill study your script. I forgot to mention started "auto-itting" just now.

well i know its noticeable with my lazy script :rolleyes:) thanks again for the code and tips man. :rambo:

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