Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 13:37

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help with thinking this bot up

Discussion on Help with thinking this bot up within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2018
Posts: 2
Received Thanks: 0
Help with thinking this bot up

Hello everyone and thank you for allowing this awesome forum.

I'am trying to write a little bot here, for a mobile game in an emulator, you can see it in the image below.



the idea is to drag every 2 similar items together so they merge.

So the way I've been thinking I should do this is as follow:
1. Make a library for every weapon by taking a screenshot then use paint.exe to change it to .bmp format (one time only).

2. Capture a snapshot of the game.
3. Image search one weapon at a time into the snapshot and store the coordinates of the similar weapons in an array.
4. Click and drag from coordinate[i] to coordinate[i+1] in the array till it's done.
5. Repeat #3 and #4 for each weapon in the library.
6. Once done, wait x minutes and go to #2.

Any better way to do it?
I can't use PixelSearch here, right? Because the location of the items is not fixed.


I started by testing the imageSearchEX function but it never finds the weapon in the game.

Code:
#RequireAdmin
#AutoIt3Wrapper_UseX64=NO
#include <imageSearchEX.au3>


$Win_Title = "(GrowStone)"
$Image_Path = @ScriptDir  & "\Image_Lib\Donut.bmp"

$Image_Coordinates = imageSearchEX($Win_Title,$Image_Path)

If $Image_Coordinates <> 0 Then
	MsgBox(0,"BINGO",$Image_Coordinates[0] & " " & $Image_Coordinates[1])
 Else
    MsgBox(0,"NICHTS","Image Not Found",50)
 EndIf
Any insights what could be the reason?

Ich bedanke Ihnen.
tafradrasu is offline  
Old 04/21/2019, 16:30   #2
 
FacePalmMan's Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 426
Received Thanks: 129
1. Are you 100% sure the title and file path are correct?
2. I have not worke with imageSearch for a long time. Try to output the @error code and find out what it means.
3. If everything indicates that the image is really just not being found, try turning the tolerance value up a little. I think imageSearchEx has a parameter that goes from 0-255 with 255 finding only 100% exact match.

If that makes it work: Don't compare coordinate[i] + coordinate[i+1]. Have a 2D array that contains all values parsed to some form of item ID or name.
Then you do 2 for loops like this:
Code:
For $i = 0 To Ubound($coordinate, 1)
    For $j = 0 To Ubound($coordinate, 2)
        ;check surrounding and act
    Next
Next
In it you put the if clause that checks for a match, together with the MouseClickDrag.
Like this:
Code:
$aIsEqual = check($i, $j)
If IsArray($aIsEqual) Then
    MouseClickDrag("left", $aIsEqual[0][0], $aIsEqual[0][1], $aIsEqual[1][0], $aIsEqual[1][2])
EndIf
And check() should be defined at the end, looking sort of like this:
Code:
Func check($x, $y)
    Local $retX, $retY, $aRet[2] ;If something is found, it is saved into retX&Y. aRet is for output.
    If $x > 0 and $coordinate[$x][$y] == $coordinate[$x-1][y] Then ;If it is not on the very left, check to the left.
        $retX = $x - 1
        $retY = $y
    ElseIf $y > 0 and $coordinate[$x][$y] == $coordinate[$x][$y - 1] Then ;If it is not on the very top, check on top of it.
        $retX = $x
        $retY = $y - 1
    ElseIf $x < Ubound($coordinate, 1) - 1 and $coordinate[$x][$y] == $coordinate[$x+1][y] Then ;If it is not on the very right, check to the right.
        $retX = $x + 1
        $retY = $y
    ElseIf $y < Ubound($coordinate, 2) - 1 and $coordinate[$x][$y] == $coordinate[$x][$y + 1] Then ;If it is not on the very bottom, check beneath it.
        $retX = $x
        $retY = $y + 1
    EndIf
    $aRet[0] = $retX
    $aRet[1] = $retY ;Put the found (or not found) values into the return array
    Return (IsInt($retX)) ? ($aRet) : (False) ;"Ternary operator". If there is something in retX, $aRet (with retX,retY) will be returned, otherwise False.
EndFunc
This is how it could look like if you want to scan what is above and beneath it and match it like that. But that's just a suggestion.
FacePalmMan is offline  
Thanks
1 User
Old 04/22/2019, 01:23   #3
 
elite*gold: 0
Join Date: Jan 2018
Posts: 2
Received Thanks: 0
Quote:
Originally Posted by FacePalmMan View Post
1. Are you 100% sure the title and file path are correct?
2. I have not worke with imageSearch for a long time. Try to output the @error code and find out what it means.
3. If everything indicates that the image is really just not being found, try turning the tolerance value up a little. I think imageSearchEx has a parameter that goes from 0-255 with 255 finding only 100% exact match.

If that makes it work: Don't compare coordinate[i] + coordinate[i+1]. Have a 2D array that contains all values parsed to some form of item ID or name.
Then you do 2 for loops like this:
Code:
For $i = 0 To Ubound($coordinate, 1)
    For $j = 0 To Ubound($coordinate, 2)
        ;check surrounding and act
    Next
Next
In it you put the if clause that checks for a match, together with the MouseClickDrag.
Like this:
Code:
$aIsEqual = check($i, $j)
If IsArray($aIsEqual) Then
    MouseClickDrag("left", $aIsEqual[0][0], $aIsEqual[0][1], $aIsEqual[1][0], $aIsEqual[1][2])
EndIf
And check() should be defined at the end, looking sort of like this:
Code:
Func check($x, $y)
    Local $retX, $retY, $aRet[2] ;If something is found, it is saved into retX&Y. aRet is for output.
    If $x > 0 and $coordinate[$x][$y] == $coordinate[$x-1][y] Then ;If it is not on the very left, check to the left.
        $retX = $x - 1
        $retY = $y
    ElseIf $y > 0 and $coordinate[$x][$y] == $coordinate[$x][$y - 1] Then ;If it is not on the very top, check on top of it.
        $retX = $x
        $retY = $y - 1
    ElseIf $x < Ubound($coordinate, 1) - 1 and $coordinate[$x][$y] == $coordinate[$x+1][y] Then ;If it is not on the very right, check to the right.
        $retX = $x + 1
        $retY = $y
    ElseIf $y < Ubound($coordinate, 2) - 1 and $coordinate[$x][$y] == $coordinate[$x][$y + 1] Then ;If it is not on the very bottom, check beneath it.
        $retX = $x
        $retY = $y + 1
    EndIf
    $aRet[0] = $retX
    $aRet[1] = $retY ;Put the found (or not found) values into the return array
    Return (IsInt($retX)) ? ($aRet) : (False) ;"Ternary operator". If there is something in retX, $aRet (with retX,retY) will be returned, otherwise False.
EndFunc
This is how it could look like if you want to scan what is above and beneath it and match it like that. But that's just a suggestion.
Ok thank you for your reply, I'll give what you said some thought, do some testing and report back here
tafradrasu is offline  
Reply


Similar Threads Similar Threads
thinking of writing a bot
09/09/2013 - Runescape - 0 Replies
Hi, i've been working with c# and automation type stuff, and have been thinking of writing a bot/script deal for a game. I'm thinking RS, since I started the game about a couple weeks ago. I've been using an AutoIt script i wrote to mine and hunt. Since ive already reached around 50 mining and 50 in combat skills with melee, im guessing there's not much chance for them banning any type of software that doesn't mess with the client. (Im not too familiar with botting and detection - but i do...
Trick someone into thinking your dueling them
10/14/2006 - WoW Exploits, Hacks, Tools & Macros - 6 Replies
This works best for rogues. When the duel starts, wait for the countdown to reach "Duel is starting in 1" then /forfeit. It wont say "XXX has fled from XXX in a duel.". As a rogue, just stay stealthed, get out of range then go on with your buisness.
yo, somthing that had me thinking
08/31/2006 - Conquer Online 2 - 12 Replies
okay, since, they changed conquer so that u couldnt c war the metdove is, i was wondering if a program can, how would i say, locate the reviving birds after there killed. i mean, if the program can be tought to find any birds that have spawned in the last minute, or is dat also server sided to see wat is on the map?
just thinking.... i know its a bad thing.
07/15/2006 - Conquer Online 2 - 6 Replies
hey guys just started thinking a little. and heres what it was about. i was recently hacked. and it sucks severly. i had good gear and about 18kk, all of that was taken and all my wherehouses where cleaned out. i told the gms but as it turns out a few of u let me in on a little secret, if u dont buy they will let u cry. so i was wondering if someone could creat somthing like a tracer, for those of us who like to hold grudges. i was just thinking if it was possible or not. let me know. thanks
ok last night i was thinking about this...
09/20/2005 - Conquer Online 2 - 2 Replies
ok ok...i was thinking...maybe there is a way to kind of trick the server into thinking that a monster dropped a good item...elite+1,met,db....so on...is there any way to maybe block the servers packets and make ur own...or will that not work?...or...is there any way to maybe tell the server that monsters drop like 5k gold...(i heard that can be done...but if its too high the server realizes and fixes it)so...maybe sumthing here can work...sorry if i sounds stupid...thnx (i...



All times are GMT +2. The time now is 13:37.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.