Sign in to follow this  
Followers 0
MasterX

Whats wrong with this script?

7 posts in this topic

I started to make a Pixelbot

ToolTip("Point at the mob to be fighted!")
Sleep(5000)
$m=MouseGetPos()
$color=PixelGetColor($m[0],$m[1]);Looks for the colour of the mob.
$coord = PixelSearch( 0, 0, 300, 300,$color );Searches the pixel
While 1
    MouseMove($coord[0],$coord[1]); Ok heres the problem it says $coord is not an array variable.
    Sleep(3000)
    MouseClick()
WEnd

Share this post


Link to post
Share on other sites



here try this:

ToolTip("Point at the mob to be fighted!")
Sleep(5000)
$m=MouseGetPos()
$color=PixelGetColor($m[0],$m[1]);Looks for the colour of the mob.
$coord = PixelSearch( 0, 0, 300, 300,$color );Searches the pixel
While 1
    If $coord IsArray Then
    MouseMove($coord[0],$coord[1]); Ok heres the problem it says $coord is not an array variable.
    Sleep(3000)
    MouseClick()
WEnd
Hope that helps, Clipper34

Share this post


Link to post
Share on other sites

Ok if i use IsArray there is an error, Error parsing function call Oo?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ToolTip("Point at the mob to be fighted!")
Sleep(5000)
$m=MouseGetPos()
$color=PixelGetColor($m[0],$m[1]);Looks for the colour of the mob.
$coord = PixelSearch( 0, 0, 300, 300,$color );Searches the pixel
While 1
    If $coord IsArray Then
    MouseMove($coord[0],$coord[1]); Ok heres the problem it says $coord is not an array variable.
    Sleep(3000)
    MouseClick()
ENDIF
WEnd

:)

Edited by Kiti

Share this post


Link to post
Share on other sites

Err i said there is an error^^

If $coord IsArray Then; Error parsing function call

Share this post


Link to post
Share on other sites

Err i said there is an error^^

If $coord IsArray Then; Error parsing function call

Ok i switched the pixelsearch to PixelSearch( 1,1, 1023, 767,$color ) now it works!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Incorrect usage of IsArray:

If $coord IsArray Then

Should be:

If IsArray($Coord) Then

Also, one might want to loop the PixelSearch too(note the use of the @error macro instead of IsArray):

ToolTip("Point at the mob to be fighted!")
Sleep(5000)
$m=MouseGetPos()
$color=PixelGetColor($m[0],$m[1]);Looks for the colour of the mob.
While 1
    $coord = PixelSearch( 0, 0, 300, 300,$color );Searches the pixel
    If Not @Error Then
        MouseMove($coord[0],$coord[1])
        Sleep(3000)
        MouseClick()
    EndIf
WEnd
Edited by FreeFry

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