Jump to content

Recommended Posts

Posted

Hey!

I'm really new in AutoIT (I started like 2 days ago), so that's why I need to ask few questions here :)

I love to learn on some practical examples, so I thought that I will make little script that will deal with "Anti-BOT" tool on private server of Tibia (I'm not even playing this game from few years). It looks like that:
base.PNG.70ddcda259677fa0f44b44b9a0057e9a.PNG
Random numbers from 1 to 10 so sum result is from 2-20.

so I used ImgSearch and I made this script:

Func PressExit()
    Exit
EndFunc

HotKeySet("+{ESC}", "PressExit")

While 1
    Global $a = 0 ;counter for 1st component of the sum
    Global $b = 0 ;counter for 2st component of the sum
    $start = _ImageSearch($afkMenu, 1, $x1, $y1, 0) ; look for windows to pop up
    if $start Then 
        Do
            $result = _ImageSearch($ImgArrayL[$a], 1, $x1, $y1, 0)
            ;$result = _ImageSearchArea($ImgArray[$a - 1], 1, 0, 0, 120, 80, $x1, $y1, 0)
            ConsoleWrite("A: " & $a+1 & "   " & $result & @CRLF) ; just for tests
            $a += 1
        Until $result = 1
        $result = 0
        Do
            $result = _ImageSearch($ImgArrayR[$b], 1, $x1, $y1, 0)
            ConsoleWrite("B: " & $b+1 & "   " & $result & @CRLF) ; just for tests
            $b += 1
        Until $result = 1
    EndIf
    if (($a > 0) & ($b > 0)) Then
        ConsoleWrite("Wynik: " & $a & " + " & $b & " = " & $a + $b & @CRLF)
        Sleep(5000)
    EndIf
WEnd

It worked perfectly for first few times (cause I was lucky) but after that it couldn't find some components of the sum.
This is why:
regular size:
5bf2689b0a320_porwnanie.png.a27dda1e864d0d90bd3fe1549098fc7c.png
bigger:
5bf268ab5b72d_dueporwnanie.PNG.0bae276005e41a42cccc568f7ba35364.PNG

In this example you can see that background isn't the same for number 7 cause background moves depending on how "wide" 1st number is (and this is not just for number 10, even 1 is wider than 3 etc).
I thought that's not a problem cause I will change $tolerance value and it will be ok, but it's not. When I set $tolerance >= 20 it's working but 8=0; 5=6 etc, if I make it lower it doesn't help at all.
 

($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance, $HBMP=0)

; Description:   Find the position of an image on the desktop
; Syntax:        _ImageSearchArea, _ImageSearch
; Parameter(s):
;                $findImage - the image to locate on the desktop
;                $tolerance - 0 for no tolerance (0-255). Needed when colors of
;                            image differ from desktop. e.g GIF
;                $resultPosition - Set where the returned x,y location of the image is.
;                                    1 for centre of image, 0 for top left of image
;                $x $y - Return the x and y location of the image
;
; Return Value(s): On Success - Returns 1
;                On Failure - Returns 0

Any idea other than making 100 screens with all sum variants xD because it's not like "programming".

Any kind of help will be much appreciated!

PS.
I just wanted to add that it is for scientific purposes so I want to use any working image recognition library.

Kings regards,
LoK

  • Developers
Posted
8 minutes ago, lokatylokacz said:

I will make little script that will deal with "Anti-BOT" tool on private server of Tibia (I'm not even playing this game from few years).

This still doesn't sound legitimate, so is not going to be allowed here.

Jos

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

  • Developers
Posted

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

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

Guest
This topic is now closed to further replies.
×
×
  • Create New...