Sign in to follow this  
Followers 0
1hit

help plz

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



bump someone help me plz

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

well for some reason it doesnt continie the script and hit 1 it just sits there so i dunno wat is wrong

Share this post


Link to post
Share on other sites

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


[center]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.[/center]

Share this post


Link to post
Share on other sites

wats scite a script writer? cuz im using notepad lol

ok nvm everyone i figured it out

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