Jump to content

Recommended Posts

Posted

Hi, i made a code which contain:

while 1
    $get_costumer_data = PixelSearch(-498, 350, -366, 351, 0x254C1D, 1)
    If Not @error Then
        MouseClick ("left", $get_costumer_data[0], $get_costumer_data[1],1,1)
        ContinueLoop
    EndIf

    $correct = PixelSearch(-813, 356,-810, 361, 0x214866, 1)
    if not @error Then
        MouseClick ("left", -1196, 437,1,1)
        ContinueLoop
    EndIf

    $false = PixelSearch(-813, 356,-810, 361, 0xF36D25, 1)
    If Not @error Then
        MouseClick ("left", -474, 832,1,1)  ;ask_for_new_data
        MouseClick("left", -267, 358, 1, 1) ;ban_user
        ContinueLoop
    EndIf
WEnd

i want to make $false to  ;ask_for_new_data limited to 3 times, if it still get $false then ;ban_user, 

i've searched the forum but didn't get any result, help please.

Posted

Maybe this?

$var = 0
Do
    $false = PixelSearch(-813, 356,-810, 361, 0xF36D25, 1)
    If $false = @error Then
        ExitLoop
    Else
        $var = $var + 1
        ConsoleWrite('ask_for_new_data - '&@MSEC&@CRLF)
        MouseClick("left", -474, 832,1,1)  ;ask_for_new_data
        If $var = 3 Then
        ConsoleWrite('ban_user - '&@MSEC&@CRLF)
        MouseClick("left", -267, 358, 1, 1) ;ban_user
        EndIf
    EndIf
Until $var = 3 Or $false <> @error

There are many ways to do the same.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

@careca : i try to understand your script but something isn't clear for me. Could you please be so kind and explain it to me ?

If $false = @error Then
   ExitLoop
Else ...

How could $false = @error ever happen because :
1) If the pixel is found, @error = 0, $false is now an array so testing $false and hoping it will be equal to 0 (or "" or False) to exit the loop, it will not work.

2) If the pixel is not found, @error = 1, $false = 0 . There too, ExitLoop will never happen.

Also re-using @error in the last line of the script (the Until part of the loop) seems very dangerous, especially @error has been reset to 0 after each function of the Else statement (thanks to the help file)

Personnally, i always add immediately a line like this, when I need to test @error later in the script :
$iKeep_error = @error
Then you can test $iKeep_error wherever you want, with an incredible peace of mind :)

"I think you are searching a bug where there is no bug... don't listen to bad advice."

Posted (edited)

"How could $false = @error ever happen"

Pixel is not found > @error, what is the doubt?

Pixel is found, no error, so the code will jump to the else bit.

3) I see what you mean, it's a valid point, anyway this is to serve as a guide, something to build uppon.

Edited by careca
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted
  On 9/8/2018 at 11:14 AM, careca said:

Maybe this?

$var = 0
Do
    $false = PixelSearch(-813, 356,-810, 361, 0xF36D25, 1)
    If $false = @error Then
        ExitLoop
    Else
        $var = $var + 1
        ConsoleWrite('ask_for_new_data - '&@MSEC&@CRLF)
        MouseClick("left", -474, 832,1,1)  ;ask_for_new_data
        If $var = 3 Then
        ConsoleWrite('ban_user - '&@MSEC&@CRLF)
        MouseClick("left", -267, 358, 1, 1) ;ban_user
        EndIf
    EndIf
Until $var = 3 Or $false <> @error

There are many ways to do the same.

Expand  

i'm sorry, i still confused. should i put $var & Do inside while? outside while? or replace while with do..until?

it tried what you suggested but after ask_for_new_data happened 3 times and went back to the top it will do infinity loop again.

p.s. please bear with me, i just started this scripting thingy days ago :'(

Posted (edited)

Did you set it up like this?

While 1
    $get_costumer_data = PixelSearch(-498, 350, -366, 351, 0x254C1D, 1)
    If Not @error Then
        MouseClick("left", $get_costumer_data[0], $get_costumer_data[1], 1, 1)
        ContinueLoop
    EndIf

    $correct = PixelSearch(-813, 356, -810, 361, 0x214866, 1)
    If Not @error Then
        MouseClick("left", -1196, 437, 1, 1)
        ContinueLoop
    EndIf
    ;=============================================================================
    $var = 0 ;we reset the var "count" to zero before the loop
    Do
        $false = PixelSearch(-813, 356, -810, 361, 0xF36D25, 1)
        If $false = @error Then ;found pixel so don't do any action and leave loop
            ExitLoop
        Else
            $var = $var + 1 ;increase var count
            ConsoleWrite('ask_for_new_data - ' & @MSEC & @CRLF)
            MouseClick("left", -474, 832, 1, 1) ;ask_for_new_data
            If $var = 3 Then ;if it's the third and last time in the loop, ban user.
                ConsoleWrite('ban_user - ' & @MSEC & @CRLF)
                MouseClick("left", -267, 358, 1, 1) ;ban_user
            EndIf
        EndIf
    Until $var = 3 Or $false <> @error ;leave loop if pixelsearch didn't give error, or it's the third loop.
    ;=============================================================================
WEnd

 

Edited by careca
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

This is such a strange concept for me... how can someone be in an administrative position where they have the authority to possibly ban someone but yet it's based off of pixel search and generic mouse clicks?... I'd think any administrator would have access to more intuitive parts of a program or whatever the user is trying to access.

This seems like an attempt to mask another program and make the user enter info and give like a pseudo ban by preventing the user from using the program

Edited by markyrocks
  • Moderators
Posted

markyrocks,

I quite agree - so why did you not report the thread so that the Mods are aware? We cannot see everything and it was purely by chance that I read this thread in detail. So in future please help us and use the "Report" button if you suspect anything.

awfstieg,

Given the doubts expressed above, please give some more details of just what you are trying to do and why you need to do it in such a roundabout way.

M23

P.S. And just to be absolutely clear - because apparently it still needs to be emphasised:

This is the Mod team determining the legality of the thread, so everyone else please keep out.

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
  On 9/9/2018 at 1:28 AM, markyrocks said:

This is such a strange concept for me... how can someone be in an administrative position where they have the authority to possibly ban someone but yet it's based off of pixel search and generic mouse clicks?... I'd think any administrator would have access to more intuitive parts of a program or whatever the user is trying to access.

This seems like an attempt to mask another program and make the user enter info and give like a pseudo ban by preventing the user from using the program

Expand  

 

  On 9/9/2018 at 8:08 AM, Melba23 said:

markyrocks,

I quite agree - so why did you not report the thread so that the Mods are aware? We cannot see everything and it was purely by chance that I read this thread in detail. So in future please help us and use the "Report" button if you suspect anything.

awfstieg,

Given the doubts expressed above, please give some more details of just what you are trying to do and why you need to do it in such a roundabout way.

M23

P.S. And just to be absolutely clear - because apparently it still needs to be emphasised:

This is the Mod team determining the legality of the thread, so everyone else please keep out.

Expand  

No, i'm not making a program to harm anyone. i'm currently making a game automaton to earn exp for myself. 

And i know that's ilegal, that's why i changed all the words in it. 

you can ban me after this. 

thank you for everything, and i am sorry. 

  • Moderators
Posted (edited)

awfstieg,

No-one is going to ban you at the moment - just please stick to the Forum rules in future. Thread locked.

M23

 

Edited by Melba23
Fixed formatting

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...