Jump to content

Stop Script until Condition is Met


Recommended Posts

UPDATE: Ive been playing with this script all day and still it refuses to work.

Here's what i got so far.

$var1 = PixelGetColor(-5, -239)
$var2 = PixelGetColor(564, 388)
$var3 = PixelGetColor(565, 386)

While 1
    Send("{TAB}")
    Do
        Send("3")
    Until $var1 = PixelGetColor(-5, -239) = 0x293029
    If $var2 = PixelGetColor(564, 388) = 0xD9D9D9 Then
        Do
            Send("{SPACE}")
        Until $var3 = PixelGetColor(565, 386) = 0xFFFF00
        Else
    EndIf
WEnd

Not sure why but when using the script someone wrote to get Hex Values and Co-ords it showed the window im using this for was split into 2 as far as the co-ords are concerned, the middle of the screen is 0 and then values to the left are - numbers, values to the right are + numbers.

The above code is what i got so far, i did at one point have the stop section of this coding working perfectly, it repeated Send("3") until the action was complete then it ran through the script again and was perfect. The lower section of code wasnt working even though it was suppose to hit the space key it didnt seem to work but like i say the top half was working perfectly, however now its just getting stuck pressing 3, the Until statement doesnt seem to be working correctly.

In order for the PixelGetColor to work do i have to get the script to output the value you gets in order to check it against the color it should be before stopping the action?

Thanks for any help.

Edited by Ginseng
Link to comment
Share on other sites

Mmm.. so how do i get the script to:

Do

Send("3")

Until 0x293029 color appears on the screen at -5, -239

Then continue to the next section. I cant use the PixelSearch because i dont know the Bottom/Right values for the Search. If it was

Left: -5

Top: -239

Right: -5

Bottom: -240

Would that search 1 pixel? I dont want it to search a large area, i basically need the search to be on 1 pixel.

I cant believe i've had the most important part of this working once and then i screwed it up.

Link to comment
Share on other sites

What exactly happens on your system when you execute this script I wonder....

I still don't fully understand what is it's purpose, other than to jam up the TAB button.

You pixel coordinated are all messed up. You can't pixelgetcolor two negative coords and expect to get some result like 0x293029. They don't exist those pixels.

You need to look at AutoItSetOption "PixelCoordMode" here:

http://www.autoitscript.com/autoit3/docs/f...ItSetOption.htm

HotKeySet("{ESC}", "_Terminate")

$var1 = PixelGetColor(-5, -239)
$var2 = PixelGetColor(564, 388)
$var3 = PixelGetColor(565, 386)


While 1
    Send("{TAB}")
    Do
        Send("3")
        Sleep(100)
    Until PixelGetColor(5, 239) = 0x293029
    ;what the above piece of code would do, is press TAB once, and then continuously press 3 until PixelGetColor(5, 239) = 0x293029
    If PixelGetColor(564, 388) = 0xD9D9D9 Then
        ;If at this moment PixelGetColor(564, 388) = 0xD9D9D9 it will enter another loop until PixelGetColor(565, 386) = 0xFFFF00
        Do
            Send("{SPACE}")
            Sleep(100)
        Until PixelGetColor(565, 386) = 0xFFFF00
    EndIf
    ;The loop will restart and press TAB again
WEnd

Func _Terminate()
    Exit 0
EndFunc

You want to exit this WHile loop at some point I assume...

Link to comment
Share on other sites

I cant believe i've had the most important part of this working once and then i screwed it up.

can this help you?

;Returns a pixel color according to x,y pixel coordinates.
$var = PixelGetColor( 10 , 100 )
MsgBox(0,"", "0x"&Hex($var, 6)) ;<== PixelGetColor      "0x"&Hex($var, 6)       return it like 0xD9D9D9
;<== i dono why your trying to get color on -5, -239 coordinates, i dont see the point of that coordinates, as LogicalAI tolded you there isnt - cordinates, or maby we dono about them ^^




Global $var1,$var2,$var3    
While 1
    Sleep(1000)
    Send("{TAB}")
    Do
        Send("3")
        Sleep(1000)
        $var1 = "0x"&Hex(PixelGetColor(-5, -239), 6)
    Until $var1 = "0x293029"
    $var2 = "0x"&Hex(PixelGetColor(564, 388), 6)
    If $var2 = "0xD9D9D9" Then
        Do
            Send("{SPACE}")
            $var3 = "0x"&Hex(PixelGetColor(565, 386), 6)
            Sleep(1000)
        Until $var3 = "0xFFFF00"
    EndIf
WEnd

and im telling you as LogicalAI tolded you

0x293029 isnt color its probably unconverter "0x"&Hex(PixelGetColor ......... or something like that

where did you get that color?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

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