Jump to content

Recommended Posts

Posted (edited)

I have a loop that I need to perform an action when a pixel changes color on my screen. I think I should make another separate function and call it but I am unclear when this is appropriate to do (and I dont know what the code looks like). Here's what I have now.

While 1
    MouseClick ("left",882,525,1)
    Call("GetColor")
    MouseClick ("left",1075,563)
    sleep (1000)
    MouseClick ("left",1075,563)
    sleep (1000)
wend

Func GetColor()
While 1
     x = PixelGetColor(821,306)
     Sleep(1000)
     If x = 0xFFFFFF Then MouseClick("Left",821,306,1)
     Else Call(GetColor)
     EndIf
Wend

I know Im close. Any help is appreciated. Thanks

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Posted

Global $COLOR = PixelGetColor(@DesktopWidth/2, @DesktopHeight/2)

While 1
Sleep(100)
If NOT PixelGetColor(@DesktopWidth/2, @DesktopHeight/2) = $COLOR then
_DoSomething()
$COLOR = PixelGetColor(@DesktopWidth/2, @DesktopHeight/2)
EndIf
WEnd

Func _DoSomething()
msgbox(64, 'Hurray', 'Color changed at the pixel')
EndFunc

Perhaps, this is what you want?

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Posted (edited)

  On 3/2/2013 at 6:51 AM, 'MKISH said:

Global $COLOR = PixelGetColor(@DesktopWidth/2, @DesktopHeight/2)

While 1
Sleep(100)
If NOT PixelGetColor(@DesktopWidth/2, @DesktopHeight/2) = $COLOR then
_DoSomething()
$COLOR = PixelGetColor(@DesktopWidth/2, @DesktopHeight/2)
EndIf
WEnd

Func _DoSomething()
msgbox(64, 'Hurray', 'Color changed at the pixel')
EndFunc

Perhaps, this is what you want?

I dont want to mold the function around this action but rather add this in a loop in the existing look. Here is what I came up with - that doesn't work.

MouseClick ("left",1080,374)
    sleep (4000)
    MouseClick ("left",882,525,1)
    While 1
        sleep(100)
    If NOT PixelGetColor(821,306) = $color then
        $color = PixelGetColor(821,306)
    EndIf
    WEnd
    MouseClick ("left",821,306)
    sleep (1000)

I am pretty sure that it is bad practice to put a while 1 loop in another loop. I think I want to make a function and call the function from within the other loop.

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Posted

  On 3/6/2013 at 4:18 AM, 'computergroove said:

I am pretty sure that it is bad practice to put a while 1 loop in another loop. I think I want to make a function and call the function from within the other loop.

It is not but I am not understanding what you are trying to loop???

I feel nothing.It feels great.

Posted

What do you want to achieve with your script? Wait for a button to change color or ....? Maybe there is an easier way to do what you want.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

  On 3/6/2013 at 2:02 PM, 'water said:

What do you want to achieve with your script? Wait for a button to change color or ....? Maybe there is an easier way to do what you want.

I have an old Iphone that I have jailbroken and installed both veency (it's the hackers version of VNC) and an app that gives me points for watching videos. When I get enough points then I get an amazon or itunes gift card. I have setup a script that is working right now to automatically gather points all day and night. I want to make my script more efficient. By being able to click on a specific pixel when it changes to the color I want, I shave off 30 seconds per video and almost double my efficiency.

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Posted (edited)

There you go

$x = PixelGetColor(821,306)

While (True)
Sleep(100)
$move = MouseMove(882,525)
While (True)
Sleep(100)
If $x = 0xFFFFFFThen
MouseClick("Left",821,306,1)
MsgBox(0,"Succed", "Pixel exists") ;Delete MsgBox it is only to explain
ExitLoop
Else
MsgBox(0,"Error", "Pixel doesn't exists") ;Delete MsgBox it is only to explain
ExitLoop
EndIf
WEnd
WEnd

Hope it is what you're looking for

Edited by ileandros

I feel nothing.It feels great.

  • Moderators
Posted

computergroove,

Having looked at what "App Trailers" is, I have decided that "fast hacking" it is not something we wish to support - wear out your own fingers if you want to earn "free money". Code deleted and thread closed. Do not ask any further questions on this. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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