Jump to content
Sign in to follow this  
Nirvana6

short question about "and"

Recommended Posts

how i use the function "and" in

if ($pixel1 = 0x44943) and

$pixel2 = 0x44943 and

$pixel3 = 0x44943 and

$pixel4 = 0x44943 and

($pixel1b = 0x44943) and

($pixel2b = 0x44943) and

($pixel3b = 0x44943) and

($pixel4b = 0x44943) and

($pixel1c = 0x44943) and

($pixel2c = 0x44943) and

($pixel3c = 0x44943) and

($pixel4c = 0x44943) and

($pixel1d = 0x44943) and

($pixel2d = 0x44943) and

($pixel3d = 0x44943) and

($pixel4d = 0x44943)

then

when i compile i get this

if ($pixel1 = 0x44943) and

????????????????????????????????????????????????????????????????????????

and i want to know if i used correct if....then :)

Edited by AlexStoian

Share this post


Link to post
Share on other sites

Maybe try this way

$X = StringSplit("22,44,15,27,55,33", ",")

$Y = StringSplit("22,44,15,27,55,33", ",")

$match = ""

For $i = 1 To $X[0]
    If PixelGetColor($X[$i], $Y[$i]) = 0x44943 Then $match += 1
Next

If $match = $X[0] Then
    ; do this
    ; because they all match that color
EndIf

8)

Edited by Valuater

Share this post


Link to post
Share on other sites

For $i = 1 To $X[0]

If PixelGetColor($X[$i], $Y[$i]) = 0x44943 Then $match = $i

Next

Shouldn't that be changed to:

If PixelGetColor($X[$i], $Y[$i]) = 0x44943 Then $match +=1

To count the number of matches?


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

Share this post


Link to post
Share on other sites

Shouldn't that be changed to:

If PixelGetColor($X[$i], $Y[$i]) = 0x44943 Then $match +=1

To count the number of matches?

I did notice that when I wrote it, however he was using "and" throughout his OP, I figured if $match = $i then he would have goten all the colors correct, however if he wanted to check how many were a match your way would be better. Then there is the other thought of knowing the actual number of "whitch ones" did match...

I was just to lazy to go that far... :)

8)

Edited by Valuater

Share this post


Link to post
Share on other sites

I did notice that when I wrote it, however he was using "and" throughout his OP, I figured if $match = $i then he would have gootn all the colors correct, however if he wanted to check how many were a match your way would be better. The there is the other tought of knowing the actual numbner of "witch ones" did match...

I was just to lazy to go that far... :)

8)

... but the current way is wrong since the final test will always be true when the Last PixelGetColor() is true ... right ?

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

Share this post


Link to post
Share on other sites

Yes, you're right!... didn't see that :(

will fix

thx

8)

Sometimes its the simple things that go wrong ... just makes us human. :)

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

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  

×
×
  • Create New...