Jump to content

Recommended Posts

Posted (edited)

Hi, I encountered a problem in my script. Here's what my code is supposed to do:

If one of my 12 variables is not equal to zero then Exit.

The problem is that I'm sure that all Pixelgetcolors = "0" (100% sure) but the script always Exit. It's why I might think that the error came from the If statement. Is there anything wrong in this sample?

Edited by J0ker
Posted

Forgot to add the code:

$ColorUskForce1 = PixelGetColor(611,145)
$ColorUskForce2 = PixelGetColor(763,147)
$ColorUskForce3 = PixelGetColor(699,144)
$ColorUskForce4 = PixelGetColor(664,147)
$ColorUskForce5 = PixelGetColor(681,142)
$ColorUskForce6 = PixelGetColor(630,146)
$ColorUskForce7 = PixelGetColor(677,247)
$ColorUskForce8 = PixelGetColor(677,284)
$ColorUskForce9 = PixelGetColor(675,200)
$ColorUskForce10 = PixelGetColor(622,236)
$ColorUskForce11 = PixelGetColor(718,183)
$ColorUskForce12 = PixelGetColor(709,148)

If $ColorUskForce1 <> "0" OR $ColorUskForce2 <> "0" OR $ColorUskForce3 <> "0" OR $ColorUskForce4 <> "0" OR $ColorUskForce5 <> "0" OR $ColorUskForce6 <> "0" OR $ColorUskForce7 <> "0" OR $ColorUskForce8 <> "0" OR $ColorUskForce9 <> "0" OR $ColorUskForce10 <> "0" OR $ColorUskForce11 <> "0" OR $ColorUskForce12 <> "0" Then

Exit

Else

ConsoleWrite('Work' & @CRLF)

EndIf
Posted (edited)

You forgot a while-loop to keep the script alive

EDIT: Wait, I don't think that will help since you have Else that should execute if it's true

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Posted (edited)

Well I tested it and im not sure all that they all are 0.. since

$ColorUskForce1 = 0
$ColorUskForce2 = 0
$ColorUskForce3 = 0
$ColorUskForce4 = 0
$ColorUskForce5 = 0
$ColorUskForce6 = 0
$ColorUskForce7 = 0
$ColorUskForce8 = 0
$ColorUskForce9 = 0
$ColorUskForce10 = 0
$ColorUskForce11 = 0
$ColorUskForce12 = 0

If $ColorUskForce1 <> "0" OR $ColorUskForce2 <> "0" OR $ColorUskForce3 <> "0" OR $ColorUskForce4 <> "0" OR $ColorUskForce5 <> "0" OR $ColorUskForce6 <> "0" OR $ColorUskForce7 <> "0" OR $ColorUskForce8 <> "0" OR $ColorUskForce9 <> "0" OR $ColorUskForce10 <> "0" OR $ColorUskForce11 <> "0" OR $ColorUskForce12 <> "0" Then

Exit

Else

ConsoleWrite('Work' & @CRLF)

EndIf
Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Posted

Yes use the second code i wrote...

$ColorUskForce1 = PixelGetColor(611,145)
$ColorUskForce2 = PixelGetColor(763,147)
$ColorUskForce3 = PixelGetColor(699,144)
$ColorUskForce4 = PixelGetColor(664,147)
$ColorUskForce5 = PixelGetColor(681,142)
$ColorUskForce6 = PixelGetColor(630,146)
$ColorUskForce7 = PixelGetColor(677,247)
$ColorUskForce8 = PixelGetColor(677,284)
$ColorUskForce9 = PixelGetColor(675,200)
$ColorUskForce10 = PixelGetColor(622,236)
$ColorUskForce11 = PixelGetColor(718,183)
$ColorUskForce12 = PixelGetColor(709,148)



If $ColorUskForce1 <> "0" OR $ColorUskForce2 <> "0" OR $ColorUskForce3 <> "0" OR $ColorUskForce4 <> "0" OR $ColorUskForce5 <> "0" OR $ColorUskForce6 <> "0" OR $ColorUskForce7 <> "0" OR $ColorUskForce8 <> "0" OR $ColorUskForce9 <> "0" OR $ColorUskForce10 <> "0" OR $ColorUskForce11 <> "0" OR $ColorUskForce12 <> "0" Then
   
    For $i = 1 to 12
        If Eval("ColorUskForce" & $i) <> "0" Then ConsoleWrite("Failed: ColorUskForce" & $i & " is : -" & Eval("ColorUskForce" & $i) & "-" & @CRLF)
    Next
    Exit

Else

ConsoleWrite('Work' & @CRLF)

EndIf

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Posted (edited)

Thanks alot Shevilie! With your code I could find out wich pixels were not working. I realised that the AutoIt Active Window wasnt giving me the good decimal colors :).

With that said, is that possible to make a code that will scan a certain area of the screen and give me every coordinates that have a 0 decimal color?

That way, I can pick the coordinates I want without worrying about having the wrong color.

Edited by J0ker
Posted

Hmm i mean that there are some scanners on the forum, though you could easly make you own

For $i = 100 to 200
    For $j = 100 to 200
        $color = PixelGetColor($i, $j)
        If $color = 0 Then ConsoleWrite("Pixel: (" & $i & "," & $j & ") is black (0) " & @CRLF)
    Next
Next

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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
×
×
  • Create New...