Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 21:04

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

Advertisement



Help with Autoit v3 Image Search

Discussion on Help with Autoit v3 Image Search within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2014
Posts: 2
Received Thanks: 0
Exclamation Help with Autoit v3 Image Search

I play Saga of Ryzom, an old MMo that's still awesome, but that's besides the point.

Have been working on a script that would allow me to change weapons using f5-f12 (4weapons, 4 magic amplifiers) and decided o use image search. i downloaded the dll and au3 files for it and have placed them everywhere ive read they needed to be, hoping somebody can help!

Since i can't post pictures yet -_- i'll explain how it works. you have to click on ur right hand to open a menu with all weapons in ur inventory(hence the first mouse commands) then this is where i need image search to work.


Here's the first step of the code.
--------------

#RequireAdmin

#include <ImageSearch.au3>

HotKeySet("{f5}", "sworddagger")

$X = 0
$Y = 0

Func sworddagger()
MouseMove(1155, 121, 2)
MouseClick("left", 1155, 121, 1, 2)
sleep(300)
$Search = _ImageSearch(@scriptdir&"\OP1hsword.bmp", 1, $X, $Y, 0)
If $Search = 1 Then
MouseMove($X, $Y, 2)
MouseClick("left",$X, $Y, 1, 2)
EndIf
EndFunc

while 1
sleep(100)
WEnd


I'm not getting any errors, the script just stops after its initial click to open the inventory menu. I've also tried putting both the dll and au3 file in the folder where i have the images and using #include "imagesearch.au3" and nothing. also have dropped all bmp and png files to the Include folder and nothing, im all out of ideas. Someone please help, and thank you!
BucShotz is offline  
Old 06/23/2014, 15:37   #2
 
elite*gold: 15
Join Date: Aug 2012
Posts: 3,041
Received Thanks: 6,397
Why not use PixelSearch? ImageSearch seems unnecessary for me.

Code:
PixelSearch ( left, top, right, bottom, color [, shade-variation = 0 [, step = 1 [, hwnd]]] )
Here's an example:
Code:
; Find a pure red pixel in the range of Left 0 to Left 20 & Top 0 to Top 300
Local $aCoord = PixelSearch(0, 0, 20, 300, 0xFF0000)
If Not @error Then
    MsgBox(0, "", "X and Y are: " & $aCoord[0] & "," & $aCoord[1])
EndIf

; Find a pure red pixel or a red pixel within 10 shades variations of pure red
$aCoord = PixelSearch(0, 0, 20, 300, 0xFF0000, 10)
If Not @error Then
    MsgBox(0, "", "X and Y are: " & $aCoord[0] & "," & $aCoord[1])
EndIf
berkay2578 is offline  
Old 06/26/2014, 06:12   #3
 
flumio's Avatar
 
elite*gold: 50
Join Date: Feb 2009
Posts: 765
Received Thanks: 927
You need to be in Windowmode.
flumio is offline  
Old 07/11/2014, 06:38   #4
 
elite*gold: 0
Join Date: Nov 2009
Posts: 105
Received Thanks: 8
Quote:
Originally Posted by BucShotz View Post
I play Saga of Ryzom, an old MMo that's still awesome, but that's besides the point.

Have been working on a script that would allow me to change weapons using f5-f12 (4weapons, 4 magic amplifiers) and decided o use image search. i downloaded the dll and au3 files for it and have placed them everywhere ive read they needed to be, hoping somebody can help!

Since i can't post pictures yet -_- i'll explain how it works. you have to click on ur right hand to open a menu with all weapons in ur inventory(hence the first mouse commands) then this is where i need image search to work.


Here's the first step of the code.
--------------

#RequireAdmin

#include <ImageSearch.au3>

HotKeySet("{f5}", "sworddagger")

$X = 0
$Y = 0

Func sworddagger()
MouseMove(1155, 121, 2)
MouseClick("left", 1155, 121, 1, 2)
sleep(300)
$Search = _ImageSearch(@scriptdir&"\OP1hsword.bmp", 1, $X, $Y, 0)
If $Search = 1 Then
MouseMove($X, $Y, 2)
MouseClick("left",$X, $Y, 1, 2)
EndIf
EndFunc

while 1
sleep(100)
WEnd


I'm not getting any errors, the script just stops after its initial click to open the inventory menu. I've also tried putting both the dll and au3 file in the folder where i have the images and using #include "imagesearch.au3" and nothing. also have dropped all bmp and png files to the Include folder and nothing, im all out of ideas. Someone please help, and thank you!
Hy all,

First of all, why u use mouse move order, then mouse click? Mouse click will be enough, since it will click on the correct coordinate, doesent matter on the mouse location before click. Other thing, i do not think so it will ever work like that. You should use pixelchecksum order instead of try to match a BMB pic with ING pic.

Other advice, if you do not know anything about what you are doing, you should learn or stop doing programcodeing. Cause copy paste will not work at all.

You should print the methode on your screen, what your script do, then you will know what is the problem. For that the easyest orders:
MsgBox
Tooltip

Your script is stopped, cause BMP not match with your screen stuff.

Quote:
@scriptdir&"\OP1hsword.bmp
Guess what is this?

P.S.: Copy Paste "cheaters"

//to berkay2578 - PixelSearch will search a pixel on the coordinate, he need area scan, not pixel...
VitorCornelius is offline  
Old 07/11/2014, 14:00   #5
 
elite*gold: 15
Join Date: Aug 2012
Posts: 3,041
Received Thanks: 6,397
Quote:
//to berkay2578 - PixelSearch will search a pixel on the coordinate, he need area scan, not pixel...
Not necessarily... he can find a special color for each item. It will be faster and it will work.
berkay2578 is offline  
Old 07/13/2014, 06:05   #6
 
elite*gold: 0
Join Date: Jun 2014
Posts: 2
Received Thanks: 0
got it working with pixelsearch. yes im new to this, figured out mouse click works fine alone. thanks all
BucShotz is offline  
Old 09/17/2015, 21:51   #7
 
elite*gold: 0
Join Date: Sep 2015
Posts: 1
Received Thanks: 0
I am having trouble getting my script to interact or recognize bluestacks. Are your coords desktop coords or window (hwnd) coords?
what_is_the_word is offline  
Old 09/17/2015, 22:00   #8

 
Moneypulation's Avatar
 
elite*gold: 138
Join Date: Apr 2012
Posts: 3,494
Received Thanks: 1,769
Quote:
Originally Posted by what_is_the_word View Post
I am having trouble getting my script to interact or recognize bluestacks. Are your coords desktop coords or window (hwnd) coords?

If you are using the normal Pixel- and ImageSearch functions, they will return absolute (desktop) coordinates
Moneypulation is offline  
Reply


Similar Threads Similar Threads
AutoIt Image Search Loop help.
11/18/2014 - AutoIt - 7 Replies
Hello people, how is it going? :) I have recently created a bot which is supposed to click on specific pictures in Clash of Clans with Bluestacks. My problem is, code does work once. Founds everything, clicks once. But it does not loop even with While 1 at start and WEnd at the end. But once I turn off the bot and re open it, everything starts to work again. If someone can help me out to find my problem, I'll be very glad guys. :handsdown: #include <ImageSearch.au3> #include <GDIPlus.au3>...
[Help]Image Search
02/24/2014 - AutoIt - 5 Replies
Im trying to use the library ImageSearch.au3, but it seens that doesnt work on all machines. I did my script to compare some images, and was working then I tried to change and test the same script on other pc and doesnt recognize the image. I did some search and people said that windows have differente color palletes for every computer. Can someone teach me how to apply imagesearch in universal cases ? Thanks
autoit image search
05/23/2013 - Metin2 Private Server - 3 Replies
Hey :D, ich hab mir mit AutoIt was geschrieben und habe dabei imagesearch benutzt, ich will die exe aber weiterschicken ohne, dass jemand die ganze bilder sieht ich dafür benötigt habe, gibts da ne einfache Lösung die bilder mit in die exe einzubinden? wenn ihr mehr infos zum script braucht sagt bescheid ;-). LG Tom
[UDF] Autoit Image Search
10/01/2010 - AutoIt - 8 Replies
We dont like racist forum fuc|< you.



All times are GMT +1. The time now is 21:05.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.