Jump to content
Sign in to follow this  
Golden

Lil Assistance =/, Stuck as F*ck

Recommended Posts

Golden

Alright, for one, im utterly new to using autoit, but hey i thought id give it a try using commen sense to peice together something i need done. Now in my bot i want it to search an area near my mouse of about 100x100pixels, and find an colour and right click on it when i click a hotkey, now this is what i got so far.. its quite mangled so any help would be appreciated.

HotKeySet("z", "Start")
HotKeySet("x", "Pause")
HotKeySet("c", "Leave")

$pos = MouseGetPos()

$searchcolor = 0x94EB7B

While 1
Sleep(1000)
WEnd

Func Start()

While 1
    $coord = PixelSearch(($pos[0] - 100) , ($pos[1] - 100) , ($pos[0] + 100) , ($pos[1] + 100), $searchcolor) ; 
                If IsArray($coord) = 1 Then
         MouseClick( "right", $coord[0], $coord[1], 1, 0)

    Sleep(100)
     EndIf
      WEnd

EndFunc


Func Pause()
While 1
Sleep(1)
WEnd
EndFunc


Func Leave()
Exit
EndFunc

Share this post


Link to post
Share on other sites
jebus495

Alright, for one, im utterly new to using autoit, but hey i thought id give it a try using commen sense to peice together something i need done. Now in my bot i want it to search an area near my mouse of about 100x100pixels, and find an colour and right click on it when i click a hotkey, now this is what i got so far.. its quite mangled so any help would be appreciated.

HotKeySet("z", "Start")
HotKeySet("x", "Pause")
HotKeySet("c", "Leave")

$pos = MouseGetPos()

$searchcolor = 0x94EB7B

While 1
Sleep(1000)
WEnd

Func Start()

While 1
    $coord = PixelSearch(($pos[0] - 100) , ($pos[1] - 100) , ($pos[0] + 100) , ($pos[1] + 100), $searchcolor) ; 
                If IsArray($coord) = 1 Then
         MouseClick( "right", $coord[0], $coord[1], 1, 0)

    Sleep(100)
     EndIf
      WEnd

EndFunc


Func Pause()
While 1
Sleep(1)
WEnd
EndFunc


Func Leave()
Exit
EndFunc

HotKeySet("z", "Start")
HotKeySet("x", "Pause")
HotKeySet("c", "Leave")

Global $paused, $pos

Pause()

Func Start()
ToolTip("Searching", 0, 0)
While 1
    $coord = PixelSearch($pos[0] - 100 , $pos[1] - 100 , $pos[0] + 100 , $pos[1] + 100, 0x94EB7B)
        If Not @error Then
            MouseClick("right", $coord[0], $coord[1], 1, 0)
            Sleep(100)
        Else
            ExitLoop
        EndIf
WEnd
EndFunc

Func Pause()
$paused = Not $paused
While $paused
    Sleep(50)
    ToolTip("Paused", 0, 0)
WEnd
EndFunc 

Func Leave()
    Exit
EndFunc

The first while loop isn't really needed... You an just have it sit in Pause() until it needs to do something else.

Share this post


Link to post
Share on other sites
Golden

got any other advice to help me get where i need to be?

Share this post


Link to post
Share on other sites
jebus495

got any other advice to help me get where i need to be?

Maybe if we knew where you needed to be?

Share this post


Link to post
Share on other sites
JRowe

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  

×