Jump to content

Whats wrong with this script?


Recommended Posts

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
Link to comment
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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...