Jump to content

@error resets?


Recommended Posts

I've been messing around with this for about a week looking for ways around this but i didn't find any as good as this if it would work..

When i use PixelSearch and it doesnt find anything it sets @error to "1" but when it does has succes does it set @error back to "0" or Empty?

This is the code, please look into it, and tell me what i can do better..

Sorry for the {TAB}s hehe

While 1
            PixelSearch ( $ertscoord1[0] - 10, $ertscoord1[1] + 10, $ertscoord1[0] + 20, $ertscoord1[1] - 20, $ertskleur1, 5)
            If Not @Error Then
                MouseClick( "Left" , $ertscoord1[0] , $ertscoord1[1], Random(1,2,1))
                Tooltip(" Mijn 1 " , 0 , 0 )
                Sleep(4000)
                $keer = $keer + 1
            Else
                PixelSearch ( $ertscoord2[0] - 20, $ertscoord2[1] + 20, $ertscoord2[0] + 20, $ertscoord2[1] - 20, $ertskleur2, 5)
                If Not @error Then
                    MouseClick( "Left" , $ertscoord2[0] , $ertscoord2[1], Random(1,2,1))
                    Tooltip(" Mijn 2 " , 0 , 0 )
                    Sleep(4000)
                    $keer = $keer + 1
                Else
                    If $keer = "20" Then
                        Drop()
                    Else
                        Sleep(100)
                    Tooltip(" Sleep " , 0 , 0 )
                    EndIf
                EndIf
            EndIf
        WEnd
Edited by Manadar
Link to comment
Share on other sites

it should set @error back to 0 or blank, but as i'm not sure here i'd suggest that you give your pixelsearch a variable to write in so you can check the variable, but i'm not sure if this works for sure

just have a try ;)

I had quite a few tries ( 20+ ) and if i want to check the variable like in

$var = Pixelsearch etc.

If $var[0] <> "" Then

It will send back a error message $var[0] Not an array (or something like that...

:lmao:

Edited by Manadar
Link to comment
Share on other sites

I've tried to make it a bit smaller.. but it still doens't work..

While 1
    $px1 = PixelSearch ( $ertscoord1[0] - 10, $ertscoord1[1] + 10, $ertscoord1[0] + 10, $ertscoord1[1] - 10, $ertskleur1, 5)
    If $px1 <> "" Then
        MouseClick("Left", $ertscoord1[0], $ertscoord1[1])
        Sleep(4000)
        $px1 = ""
        $keer = $keer + 1
    Else
        Sleep(100)
    EndIf
    If $keer = "8" Then
        Droppen()
    EndIf
WEnd

Basically... $px1 <> ""

Doesnt work, because i need to check the array.

However.. using $px[0] <> ""

Doesn't work either, because it will send a error message telling that it's not a array.

I've also tried making it an array but i'm very unsure about how this actually works..

How do make an array? How do i overwrite ( or delete + write ) data in a array?

I've looked in help but it's unclear to me.. Examples please!

Link to comment
Share on other sites

try this

While 1
    $px1 = PixelSearch ( $ertscoord1[0] - 10, $ertscoord1[1] + 10, $ertscoord1[0] + 10, $ertscoord1[1] - 10, $ertskleur1, 5)
    If Not @error Then
        MouseClick("Left", $pxl[0], $pxl[1])
        Sleep(4000)
        $keer = $keer + 1
    Else
        Sleep(100)
    EndIf
    If $keer = "8" Then
        Droppen()
    EndIf
WEnd
Link to comment
Share on other sites

I think it's a bug of some sort...

Dim $px1[1]

$px1[0] = "1"

While 1

    If $px1[0] <> "1" Then
        MsgBox(0, "Uuh", "1")
    Else
        MsgBox(0, "Uuh", "2")
    EndIf
WEnd

This works as it should... This however doesn't:

Dim $px1[1]

$px1[0] = "1"

While 1
    $px1 = PixelSearch ( 10, 10, 20, 20, 0xFFFFFF, 5)
    If $px1[0] <> "1" Then
        MsgBox(0, "Uuh", "1")
    Else
        MsgBox(0, "Uuh", "2")
    EndIf
WEnd

Error message: arrays.au3 (7) : ==> Subscript used with non-Array variable.:

What on Earth should i do about this?

Edited by Manadar
Link to comment
Share on other sites

Yea i see what you mean...

This is what it does

Del var that i'm assigned to store data in

Search for pixel in assigned region

if it does work then write in var

if it doesn't work then end

I'd rather have it do this:

Search for pixel

if works del var write var

if doesn't then end

Anyway, can't have that done ...

So are there ways around this? Please think with me cause i am seriously stunned

Link to comment
Share on other sites

Dim $px11[1], $px1[1]

$px1[0] = "1"

While 1
    $px11 = PixelSearch ( 10, 10, 20, 20, 0xFFFFFF, 5)
    If Not @error Then
        $px1 = $px11
    EndIf
    If $px1[0] <> "1" Then
        MsgBox(0, "Uuh", "1")
    Else
        MsgBox(0, "Uuh", "2")
    EndIf
WEnd

I think this worked

Link to comment
Share on other sites

i tried this in scite (its a white screen) and it worked

While 1
    $px = PixelSearch ( 590, 590, 600, 600, 0xFFFFFF, 10)
    If @error Then
        MsgBox(0, "Uuh", "pixel not found")
    Else
        MsgBox(0, "Uuh", $px[0] & "," & $px[1])
    EndIf
WEnd
Link to comment
Share on other sites

Dim $px, $pxcheck

While 1
    $px = PixelSearch ( 461, 334, 496, 378, 0xFFFFFF, 5)
    If Not @error Then
        $pxcheck = "1"
    EndIf
    If $pxcheck = "1" Then
        MsgBox(0, "Message", "Center is white")
    Else
        MsgBox(0, "Message", "Center is not white")
    EndIf
    $pxcheck = "0"
WEnd

Hellbound Hackers

h4xx u ass off.

Edited by Manadar
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...