Sign in to follow this  
Followers 0
Jostein

Questions about "while"

6 posts in this topic

Was just wondering how i did the While "Not" code, like I want the script to pause when the value im asking for is not true

like

$value = PixelGetColor(1,1)

while $value (were the value is not true)

sleep(100)

wend

MouseMove(12, 765)
    Sleep(100)
    MouseDown("left")
    MouseUp("left")

Or if i can do it this way

do
$randomwait = random(100,500,1)
$value = PixelGetColor(1,1)
sleep($randomwait)
until $value = (the spesefic collor im looking for)

    MouseMove(12, 765)
    Sleep(100)
    MouseDown("left")
    MouseUp("left")

Dont know if im totaly lost here, but Atleast what i want is the script to pause while the pixelgetcolor dont find its true color.

Tried lots of different types of doing it, and I havent gotten it to work. And somhow Pixelgetcolor shows up whit the same value, even if the pixel is an different color.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Well.. you mean something like this?

While Not $Value
    blah blah
Wend

:P

-edit-

Oops, sorry. That's not what you wanted. Have you tried this?

do
$randomwait = random(100,500,1);Not really necessary, just use Sleep()
$value = PixelGetColor(1,1)
sleep($randomwait)
until $value = (the spesefic collor im looking for)

That should do what you want.

Edited by Nahuel

Share this post


Link to post
Share on other sites

Was just wondering how i did the While "Not" code, like I want the script to pause when the value im asking for is not true

like

$value = PixelGetColor(1,1)

while $value (were the value is not true)

sleep(100)

wend

MouseMove(12, 765)
    Sleep(100)
    MouseDown("left")
    MouseUp("left")

Or if i can do it this way

do
$randomwait = random(100,500,1)
$value = PixelGetColor(1,1)
sleep($randomwait)
until $value = (the spesefic collor im looking for)

    MouseMove(12, 765)
    Sleep(100)
    MouseDown("left")
    MouseUp("left")

Dont know if im totaly lost here, but Atleast what i want is the script to pause while the pixelgetcolor dont find its true color.

Tried lots of different types of doing it, and I havent gotten it to work. And somhow Pixelgetcolor shows up whit the same value, even if the pixel is an different color.

Use

Sleep(1)

Share this post


Link to post
Share on other sites

issue solved:D

this code works.

#include "color.au3"
HotKeySet("{esc}", "terminate")
do
$value = PixelGetColor (19, 241)
sleep(1)
msgbox(2, $value, "Still not the right color",  15)
until $value = (16777215)
func terminate()
    Exit
    EndFunc

Share this post


Link to post
Share on other sites

well Nahuel, I now its not needed. But there is an good reason for it to be there:D Random times is importain for my script. But the (1) is to ofthen, only need a check each sec or 2, and i want the script to act randomly. when it comes to times it uses to perform actions

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

this would also work for you (not tested):

#include "color.au3"
HotKeySet("{esc}", "terminate")

while $value <> 16777215
  $value = PixelGetColor (19, 241)
  sleep(1)
  msgbox(2, $value, "Still not the right color",  15)
wend

func terminate()
    Exit
EndFunc

<> means 'not equal to'

Also, try using Traytips instead of message boxes, personally I feel they get the job done better in most cases as theyre less obtrusive

Edited by ame1011

[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

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