Sign in to follow this  
Followers 0
akasson1

Need help with my variable!!

6 posts in this topic

#1 ·  Posted (edited)

1. $SearchResult = PixelSearch(414, 158, 425, 163, 0x770200, 10, 1)

2. $q=@error=10

3. Sleep(5000)

4. send("{h}")

5. sleep(1000)

6. MouseClick("Primary", 90, 460, 1, 5)

7. sleep(1000)

8. MouseClick("Primary", 168, 436, 1, 5)

9. until $q=@error<10

10.

11. mouseclick("Primary", 415, 156)

Okay so here's my problem. What i'm trying to get this part of the script to do is press h, then after sleeping for 5secs click one thing (line 6), sleep for a second, then click something different (line 8). Then once the square on my screen with top left coords 414, 158 and bottom right coords 425, 163 have turned to the color 0x770200, click at where line 11 indicates. whats happening is that everything goes good except after line 8 it just clicks where line 11 says , no matter what color the area is. i think my problem is i put the variable as the @error which im not even sure you can do(i'm kind of a noob to this stuff), my intention being that once it recognized that the @error was less than 10(meaning that it would be the right color) then it would click at that spot. i might be going at this completely wrong i really dont know, please help.

Edited by akasson1

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

until is the end of the do loop:

do

something

until condition

search do...until in the help file.

probably something like

do

$SearchResult = PixelSearch(414, 158, 425, 163, 0x770200, 10, 1)

mouseclick("Primary", 415, 156)

until $SearchResult=1

or you could use

$SearchResult = PixelSearch(414, 158, 425, 163, 0x770200, 10, 1)

while $SearchResult<>1

$SearchResult = PixelSearch(414, 158, 425, 163, 0x770200, 10, 1)

mouseclick("Primary", 415, 156)

wend

what both of these do is each time the loop runs, checks the color to see if it has changed.

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

until is the end of the do loop:

do

something

until condition

search do...until in the help file.

probably something like

do

$SearchResult = PixelSearch(414, 158, 425, 163, 0x770200, 10, 1)

mouseclick("Primary", 415, 156)

until $SearchResult=1

or you could use

$SearchResult = PixelSearch(414, 158, 425, 163, 0x770200, 10, 1)

while $SearchResult<>1

$SearchResult = PixelSearch(414, 158, 425, 163, 0x770200, 10, 1)

mouseclick("Primary", 415, 156)

wend

what both of these do is each time the loop runs, checks the color to see if it has changed.

oh okay yeah that makes sense

let me mess with it for a a minute and see if it works

thanks bro

Share this post


Link to post
Share on other sites

not working

it still just clicks on 415,156 right after 168,436

:mellow:

Share this post


Link to post
Share on other sites

First, You are using

Do

;the stuff

Until TheCondition

but are you updating the condition? I don't see that in the code you provided?

It looks like you want to click on the thing located at line 6 and 8 until that pixelsearch is true, try to check for condition based on search result,

or

If Not @error Then

or

some thing like that,

I don't really find, the point in setting @error to 10, and one more thing,as you are always setting @error to 10 so how will @error be less than 10, which you checked in until.

So, try turning your code to function based on @error or NOT @error or $SearchResult<>1 or something related, and see if that works.

Share this post


Link to post
Share on other sites

not working

it still just clicks on 415,156 right after 168,436

:mellow:

you will need another loop after the 168,436 to pause (sleep) and check the $SearchResult until the color you want shows up, then move on to the next loop.

Or you could put them both in the same loop and use an If...ElseIf...EndIf.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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