Sign in to follow this  
Followers 0
Rydextillxixdiex

Fun Stop

17 posts in this topic

Is it possible for this functions loop to stop once the pixel is detected and the mouse has been clicked? If so how? :)

Func Enter()
    While 1
    $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
    If isArray($Coords) then
    MouseClick("Left",$Coords[0], $Coords[1],1,1)
    EndIf
    WEnd
    EndFunc

Thanks all.


...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites

I figured this one out on my own, not sure how but it seemed to work:

The full script was:

HotKeySet("{F9}", "Start")
HotKeySet("{F10}", "Stop")
AutoItSetOption("WinTitleMatchMode", 4)
Global $handle = WinGetHandle("classname=GxWindowClassD3d")
   WinSetState($handle, "", @SW_SHOW)
   WinSetState($handle, "", @SW_SHOWMAXIMIZED)
While 1
    Sleep(1000)
WEnd

    Func start()
      While 1       
        Global $show = 0
        Global $target = 0x6a0706
        MouseClick("Right", 652, 421, 1, 0)
        Sleep(5000)
        Join()
        Sleep(5000)
        Enter()
        If $show > 0 then ExitLoop
      WEnd
    EndFunc
    
    Func Join()
        $Coords = PixelSearch(180, 510, 328, 550, $target, 10)
        If isArray($Coords) then
        MouseClick("Left",$Coords[0], $Coords[1],1,1)
        EndIf
    EndFunc
    
    Func Enter()
        While 1
        $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
        If isArray($Coords) then
        MouseClick("Left",$Coords[0], $Coords[1],1,1)
        EndIf
        WEnd
    EndFunc
    
    Func stop()
        Global $show = 5
    EndFunc

And i added

$show = 1 =

Infront of the mouse click command and it continued the script!

Func Enter()
        While 1
        $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
        If isArray($Coords) then
        $show = 1 = MouseClick("Left",$Coords[0], $Coords[1],1,1)
        EndIf
        WEnd
    EndFunc

Hope this is helpful to comebody.


...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites

Is it possible for this functions loop to stop once the pixel is detected and the mouse has been clicked? If so how? :)

Func Enter()
    While 1
    $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
    If isArray($Coords) then
    MouseClick("Left",$Coords[0], $Coords[1],1,1)
    EndIf
    WEnd
    EndFunc

Thanks all.

Hi Rydextilxixdiex,

All you need is an exitloop tossed in there.

Func Enter()
    While 1
    $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
    If isArray($Coords) then
    MouseClick("Left",$Coords[0], $Coords[1],1,1)
    ExitLoop
    EndIf
    WEnd
    EndFunc

Share this post


Link to post
Share on other sites

If i toss the exit loop in there it will continue to loop UNTIL the mouse is clicked, correct?


...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites

Hi Rydextilxixdiex,

All you need is an exitloop tossed in there.

Func Enter()
    While 1
    $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
    If isArray($Coords) then
    MouseClick("Left",$Coords[0], $Coords[1],1,1)
    ExitLoop
    EndIf
    WEnd
    EndFunc

I tried this, the exitloop doesn't do what i want it to do. My objective is for it to keep searching for the pixel until it appears. Once the pixel appears then i would like it to click and exit the loop so that it can move onto the next Function in the lineup.


...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites

This should work aswell, it keeps looping the search untill its found, you may want to put a sleep in the loop though, to make it look every second or couple of seconds.

While $boolean  = 0
    $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
    $boolean = isArray($Coords)
    WEnd
    MouseClick("Left",$Coords[0], $Coords[1],1,1)

+==================================================================+| The Definition of Madness: Creating a GUI, with GUI automation scripts |+==================================================================+

Share this post


Link to post
Share on other sites

Im getting an error with your $boolean scripting, its telling me that the variable is used without being declared, can anyone explain what has been left out of this script? Thanks in Advance!

While $boolean = 0

$Coords = PixelSearch(472, 192, 640, 222, $target, 10)

$boolean = isArray($Coords)

WEnd

MouseClick("Left",$Coords[0], $Coords[1],1,1)


...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites

The $boolean line was giving me variable issues, so i tried a different approach, one which i didn't know could be done but it seems to work, can someone tell me if this CAN be used, or if i just got lucky and by some off chance my $attack variable causes my loop to quit on mouse click.

Func Enter()
        $sattack = 0
        While 1
        $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
        If isArray($Coords) then
        $sattack = 1 = MouseClick("Left",$Coords[0], $Coords[1],1,1)
        EndIf
        If $sattack > 0 then exitloop
        WEnd
    EndFunc

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites

ooh sorry you should set boolean to 0 before beginning the loop :)

Like this

$boolean = 0
While $boolean  = 0
 $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
 $boolean = isArray($Coords)
WEnd
MouseClick("Left",$Coords[0], $Coords[1],1,1)

+==================================================================+| The Definition of Madness: Creating a GUI, with GUI automation scripts |+==================================================================+

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

The $boolean line was giving me variable issues, so i tried a different approach, one which i didn't know could be done but it seems to work, can someone tell me if this CAN be used, or if i just got lucky and by some off chance my $attack variable causes my loop to quit on mouse click.

What you did here is about the same as i did.

But if you make your loop depended on $attack (while $attack = 0). And set $attack to 1 with $attack = IsArray($array), like i did with $boolean, its much shorter code :)

Edited by Prophet

+==================================================================+| The Definition of Madness: Creating a GUI, with GUI automation scripts |+==================================================================+

Share this post


Link to post
Share on other sites

You lost me there with the explination of how i could use my coding, could you maybe throw it in some

Brackets
in my code please so i can see what it is your talking about. Thanks for all of your help, either way, problem solved :)!

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Share this post


Link to post
Share on other sites

I was explaining it could work like this :)

CODE

Func Enter()

$sattack = 0

While $sattack = 0

$Coords = PixelSearch(472, 192, 640, 222, $target, 10)

$sattack = isArray($Coords)

WEnd

MouseClick("Left",$Coords[0], $Coords[1],1,1)

EndFunc


+==================================================================+| The Definition of Madness: Creating a GUI, with GUI automation scripts |+==================================================================+

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

But what if i want it to find a moving pixel? eg: In a game (Wolf team aim bot so i can shot them in the head easyer but they all ways move into a different place so

the pixel moves, it doesnt stay in the one place) :)

Edited by devilboy1324

Share this post


Link to post
Share on other sites

A lot harder, because then you have to deal with timing it and projected vectors. With AIM bots, people generally create custom skins for opposing teams, so that they appear entirely 1 color. This allows you to do a grid sampling of the game screen, and then use much simplified vector prediction to determine the target's position when you make your shot.

Share this post


Link to post
Share on other sites

$number = 100
$i = 0

while 1
    do
$coords = PixelSearch(0, 0, 1279, 1023, $vary2)
              If @error Then
                  $coords = PixelSearch(0, 0, 1279, 1023, $vary2)
              EndIf
          Until Not @error
       MouseClick("Left",$Coords[0], $Coords[1],1,1)
exitloop
wend

$i = $i + 1
until $i = $numb
Thanks for that code it works now :)

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