Jump to content

help plz


1hit
 Share

Recommended Posts

ok im having troubles making the script check if there is a red bar and if there is make it continue the script and if there isnt start the script over

heres my script:

; Script Start - Add your code below here
;---------------------SETUP--------------------------------------------------
Dim $Color_One = 0xD4D2CE;monster color 
Dim $Color1_tolerance = 4 
;--------------Search Area Coords----------------------------------------------
Dim $Coord1_X = 288 
Dim $Coord2_Y = 281
Dim $Coord3_X = 669
Dim $Coord4_Y = 553
;-------------------------------------------------------------------------------
Opt("MouseCoordMode", 0); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Opt("PixelCoordMode", 0); Read the help file for "Opt" to see if you need to keep the '2' a '2', '1', or '0'
Hotkeyset("{HOME}","start")
Hotkeyset("{END}","stop")

Global $stop

Func start()
WinActivate ( 'SRO_Client' )
Sleep ( 300 )
$stop = NOT $stop
While $stop
; Script Start - Add your code below here

$coord = PixelSearch($Coord1_X,$Coord2_Y,$Coord3_X,$Coord4_Y, $Color_One, $Color1_tolerance, 1)
If Not @error And IsArray($coord) Then
Sleep(100)
MouseClick("left", $coord[0],$coord[1],1, 0)
Sleep(75)
If PixelSearch(441,42,608,52,0xFF3131,2,1) == 0xFF3131 then;<<<<this is where i start having troubles
Send("1")
Sleep(400)
EndIf
EndIf
WEnd
EndFunc 






Func stop()
Exit
EndFunc

While 1
Sleep(50)
WEnd

help me plz

Edited by 1hit
Link to comment
Share on other sites

Well, lets see. I read the helpfile, and this is what it said about PixelSearch.

PixelSearch

Searches a rectangle of pixels for the pixel color provided.

Return Value

Success: Returns a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y) Failure: Sets @error to 1 if color is not found.

That's why. It doesn't return a single value, it returns an array. You used it correctly above, do something like that again. Edited by greenmachine
Link to comment
Share on other sites

  • Moderators

greenmachine told you what was wrong: If PixelSearch(441,42,608,52,0xFF3131,2,1) == 0xFF3131 then Is wrong...

Are you using SciTe? It would show you an error there... Try this:

$Coord2 = PixelSearch(441,42,608,52,0xFF3131,2,1)
        If Not @error And IsArray($Coord2) Then
            Send("1")
            Sleep(400)
        EndIf
    EndIf

WEnd

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...