Jump to content

Need help on making a working script


Recommended Posts

no i just made up black, its more of a maroon color which im gonna use a dye and find correct color... anyways any idea on how to do this? and i also wanted to say,...if the script can --->"if theres no color-x, then do nothing until there is" and also for it to click 1 at a time

Link to comment
Share on other sites

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

I posted a 'find all pixels' function somewhere on another thread recently, you can search for that.

; This should do what you want, basically
While 1 
    $Find = _PixelFindAll(parameters here)
    
    For $i = 1 to $Find[0][0]
       ;stuff here for each pixel
    Next

    Sleep(60*1000)
WEnd

May have to add an If for sanity sake.

Edited by Insolence
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

I posted a 'find all pixels' function somewhere on another thread recently, you can search for that.

; This should do what you want, basically
While 1 
    $Find = _PixelFindAll(parameters here)
    
    For $i = 1 to $Find[0][0]
      ;stuff here for each pixel
    Next

    Sleep(60*1000)
WEnd

May have to add an If for sanity sake.

<{POST_SNAPBACK}>

wat am i supposed to put in parameter?
Link to comment
Share on other sites

lilandywandy, Use that link and read the first post. Read all of it. Cpy the code into your script. Then use this:
; This should do what you want, basically
While 1 
    $Find = _PixelFindAll(parameters here)
    
    For $i = 1 to $Find[0][0]
     ;stuff here for each pixel
    Next

    Sleep(60*1000)
WEnd

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

Aye, you'll have to LOOK at my function to put the right parameters in -.-

If you haven't used PixelSearch yet you're looking a bit too far ahead I'm afraid.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

; This should do what you want, basically

While 1

$Find = _PixelFindAll(Func _PixelFindAll($i_PosLeft, $i_PosTop, $i_Width, $i_Height, $i_Color, $i_Shade = 0, $i_Step = 1)

If $i_PosLeft <> Abs(Int($i_PosLeft)) Or $i_PosTop <> Abs(Int($i_PosTop)) Or $i_Width <> Abs(Int($i_Width)) Or $i_Height <> Abs(Int($i_Height)) Or $i_Color <> Abs(Int($i_Color)) Or $i_Shade < 0 Or $i_Shade <> Abs(Int($i_Shade)) Or $i_Step = 0 Or $i_Step <> Abs(Int($i_Step)) Or $i_Color > 0xFFFFFF Or $i_PosLeft + $i_Width > @DesktopWidth Or $i_PosTop + $i_Height > @DesktopHeight Then

Local $ai_Return[1][1]

$ai_Return[0][0] = 0

SetError(1)

Return $ai_Return

EndIf

Local $ai_Return[$i_Width * $i_Height + 1][2]

Local $ai_Original[3]

Local $i_Count

Local $i_Count_X

Local $i_Count_Y

Local $i_Found

$ai_Return[0][0] = 0

$ai_Return[0][1] = $i_Color

$ai_Original[0] = BitAND(BitShift($i_Color, 16), 0xff)

$ai_Original[1] = BitAND(BitShift($i_Color, 8), 0xff)

$ai_Original[2] = BitAND($i_Color, 0xff)

If $i_Width / $i_Step <> Int($i_Width / $i_Step) Then

Do

$i_Width = $i_Width - 1

Until $i_Width / $i_Step = Int($i_Width / $i_Step) Or $i_Width = 0

EndIf

If $i_Height / $i_Step <> Int($i_Height / $i_Step) Then

Do

$i_Height = $i_Height - 1

Until $i_Height / $i_Step = Int($i_Height / $i_Step) Or $i_Height = 0

EndIf

If $i_Width = 0 And $i_Height = 0 Then

Local $ai_Return[1][1]

$ai_Return[0][0] = 0

SetError(1)

Return $ai_Return

EndIf

For $i_Count_X = $i_PosLeft To $i_PosLeft + $i_Width - 1 Step $i_Step

For $i_Count_Y = $i_PosTop To $i_PosTop + $i_Height - 1 Step $i_Step

$i_Found = PixelGetColor($i_Count_X, $i_Count_Y)

If Abs(BitAND(BitShift($i_Found, 16), 0xff) - $ai_Original[0]) + Abs(BitAND(BitShift($i_Found, 8), 0xff) - $ai_Original[1]) + Abs(BitAND($i_Found, 0xff) - $ai_Original[2]) <= $i_Shade Then

$i_Count = $ai_Return[0][0] + 1

$ai_Return[0][0] = $i_Count

$ai_Return[$i_Count][0] = $i_Count_X

$ai_Return[$i_Count][1] = $i_Count_Y

EndIf

Next

Next

$i_Count = $ai_Return[0][0]

ReDim $ai_Return[$i_Count + 1][2]

Return $ai_Return

EndFunc ;==>_PixelFindAll)

For $i = 1 to $Find[0][0]

;stuff here for each pixel

Next

Sleep(60*1000)

WEnd

can someone bold me the parts im supposed to modify... im not sure what to do

Link to comment
Share on other sites

lol

That's VERY complicated code, I can't read it, and it looks like you didn't read it either.

Why don't you start on something smaller? Or atleast put

tags around your code so it's readable.
"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

yes, please use the tags and indent it so we can read it easily

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

  • Developers

Your code has syntax problems... cannot have an EndFunc inside a While...Wend loop.

See below result when ran through Tidy:

; This should do what you want, basically
While 1
    $Find = _PixelFindAll (Func _PixelFindAll ($i_PosLeft, $i_PosTop, $i_Width, $i_Height, $i_Color, $i_Shade = 0, $i_Step = 1)
    If $i_PosLeft <> Abs(Int($i_PosLeft)) Or $i_PosTop <> Abs(Int($i_PosTop)) Or $i_Width <> Abs(Int($i_Width)) Or $i_Height <> Abs(Int($i_Height)) Or $i_Color <> Abs(Int($i_Color)) Or $i_Shade < 0 Or $i_Shade <> Abs(Int($i_Shade)) Or $i_Step = 0 Or $i_Step <> Abs(Int($i_Step)) Or $i_Color > 0xFFFFFF Or $i_PosLeft + $i_Width > @DesktopWidth Or $i_PosTop + $i_Height > @DesktopHeight Then
        Local $ai_Return[1][1]
        $ai_Return[0][0] = 0
        SetError(1)
        Return $ai_Return
    EndIf
    Local $ai_Return[$i_Width * $i_Height + 1][2]
    Local $ai_Original[3]
    Local $i_Count
    Local $i_Count_X
    Local $i_Count_Y
    Local $i_Found
    $ai_Return[0][0] = 0
    $ai_Return[0][1] = $i_Color
    $ai_Original[0] = BitAND(BitShift($i_Color, 16), 0xff)
    $ai_Original[1] = BitAND(BitShift($i_Color, 8), 0xff)
    $ai_Original[2] = BitAND($i_Color, 0xff)
    If $i_Width / $i_Step <> Int($i_Width / $i_Step) Then
        Do
            $i_Width = $i_Width - 1
        Until $i_Width / $i_Step = Int($i_Width / $i_Step) Or $i_Width = 0
    EndIf
    If $i_Height / $i_Step <> Int($i_Height / $i_Step) Then
        Do
            $i_Height = $i_Height - 1
        Until $i_Height / $i_Step = Int($i_Height / $i_Step) Or $i_Height = 0
    EndIf
    If $i_Width = 0 And $i_Height = 0 Then
        Local $ai_Return[1][1]
        $ai_Return[0][0] = 0
        SetError(1)
        Return $ai_Return
    EndIf
    For $i_Count_X = $i_PosLeft To $i_PosLeft + $i_Width - 1 Step $i_Step
        For $i_Count_Y = $i_PosTop To $i_PosTop + $i_Height - 1 Step $i_Step
            $i_Found = PixelGetColor($i_Count_X, $i_Count_Y)
            If Abs(BitAND(BitShift($i_Found, 16), 0xff) - $ai_Original[0]) + Abs(BitAND(BitShift($i_Found, 8), 0xff) - $ai_Original[1]) + Abs(BitAND($i_Found, 0xff) - $ai_Original[2]) <= $i_Shade Then
                $i_Count = $ai_Return[0][0] + 1
                $ai_Return[0][0] = $i_Count
                $ai_Return[$i_Count][0] = $i_Count_X
                $ai_Return[$i_Count][1] = $i_Count_Y
            EndIf
        Next
    Next
    $i_Count = $ai_Return[0][0]
    ReDim $ai_Return[$i_Count + 1][2]
    Return $ai_Return
;### Tidy Error: Level error -> EndFunc is closing previous While
EndFunc  ;==>

For $i = 1 To $Find[0][0]
;stuff here for each pixel
Next

Sleep(60 * 1000)
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
WEnd

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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