Help with Findimagepos

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
beattie282
Newbie
Posts: 6
Joined: Wed Dec 17, 2008 2:11 am

Help with Findimagepos

Post by beattie282 » Wed Dec 17, 2008 2:28 am

hello iam new to your scripting program but iam not new to programing
i have made a script to log onto a game and sign in and so on then i came to the part to make the macro move me from one place to another so i dident have to sit their and do it my self all the time. i thort i would do it once programing the macro then its all sorted but here is the code iam useing.

wait>10
GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\stationundock.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\undock_station.bmp,C:\stationundock.bmp,20,1,Xpos,Ypos,imgs3

If>imgs3>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
wait>20

press CTRL
send>
release CTRL

wait>10

GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\selectwarptozid.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\nextstargate.bmp,C:\selectwarptozid.bmp,20,1,Xpos,Ypos,imgs4
If>imgs4>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif

as far as i kno that should work, everything else is fine just when i get to this bit it decides to flsh the cursor then do nothing i was woundering if the icon iam trying to click is to small for the image reccognition system
here is the icon iam trying to click

http://img165.imageshack.us/img165/5525 ... atejb2.jpg

As you can see the icon is small but i need the macro to beable to see this otherwise the macro is useless

Thankyou in Advance Beattie282

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Dec 17, 2008 5:57 am

If the icon is always in the same position you could use MouseMove> or MouseMoveRel> command.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

Hope this helps

Post by Aaron » Wed Dec 17, 2008 6:18 am

First I noticed where you wrote
press CTRL
send>
release CTRL
There is nothing sent.

Second I noticed Imgs3, Imgs4.
I replaced them with a simple Imgs>0, If 0 images are found then there is no longer anything for the script to do.
Imgs3 & Imgs4 mean nothing.

Third, I check to see if i could get MS to find the image and it worked great, so there is no need to worry about it being to small.

Forth, I noticed in your post the image address was http://img165.imageshack.us/img165/5525 ... atejb2.jpg
Are you using this nextstargatejb2.jpg or is it a bmp.
Make sure you are saving them as bmp as I could not get it to run untill I saved all images as bmp and made sure my script also had them as bmp

Try the script below and check your img types

Code: Select all

wait>10 
GetScreenRes>X,Y
wait>02
ScreenCapture>0,0,X,Y,C:\stationundock.bmp

label>loop
wait>1
IfFileExists>C:\stationundock.bmp,FirstFileFound
goto>loop
Label>FirstFileFound

FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\undock_station.bmp,C:\stationundock.bmp,0,1,X,Y,NumFound
If>NumFound>0
MouseMove>X_0,Y_0
Lclick 
Endif 
wait>20


press CTRL 
send> 
release CTRL 

wait>10 

GetScreenRes>X,Y
ScreenCapture>0,0,X,Y,C:\selectwarptozid.bmp

label>NextLoop
wait>1
IfFileExists>C:\stationundock.bmp,SecondFileFound
goto>NextLoop
Label>SecondFileFound
 
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\nextstargate.bmp,C:\selectwarptozid.bmp,0,1,X,Y,NumFound
If>NumFound>0 
MouseMove>Xpos_0,Ypos_0 
Lclick 
Endif

Best of luck and let me now if you have success.
Aaron

beattie282
Newbie
Posts: 6
Joined: Wed Dec 17, 2008 2:11 am

Post by beattie282 » Wed Dec 17, 2008 11:11 am

thankyou for your help..

the control command sends a "space" its a shortcut within the game to stop the ojbect from moving

also i just uploaded the image as a jpeg because am lazy :P

but anyway back to the matter of my scrip
wait>30

GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\stationundock.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\undock_station.bmp,C:\stationundock.bmp,20,1,Xpos,Ypos,imgs3

If>imgs3>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif

wait>20
press CTRL
send>
release CTRL

wait>10

GetScreenRes>X,Y
ScreenCapture>0,0,X,Y,C:\selectwarptozid.bmp

label>NextLoop
wait>1
IfFileExists>C:\stationundock.bmp,SecondFileFound
goto>NextLoop
Label>SecondFileFound

FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\nextstargate.bmp,C:\selectwarptozid.bmp,20,1,Xpos,Ypos,NumFound
If>NumFound>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
what this does at the min is undocks me from the station then stops my ship this is where the problem is because i think the script thinks its pressing the picture because it jumps out of the loop

but the cursor ingame does not move

the cursor just flickers on the bottom left of the screen as if it is looking for the image but it must find it because it leaves the loop it just does not select the image.

also i cannot do the mouse,pos system because i want to send the script to a few mates of mine.

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Checking for wrong secondfile

Post by gdyvig » Wed Dec 17, 2008 4:09 pm

Do you mean

IfFileExists>C:\selectwarptozid.bmp,SecondFileFound

?

Gale

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Dec 17, 2008 4:33 pm

You are alredy using MouseMove, so your mates may have problem with this one also.

If you use MouseMoveRel vs. MouseMove, then your mates may probably be able to use the script because the X/Y positions will be relative to the window position and size.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Dec 17, 2008 4:38 pm

Bob Hansen wrote:You are alredy using MouseMove, so your mates may have problem with this one also.
Yes, but he's using MouseMove to move to a position determined by FindImagePos. Therefore it does not matter where the object is as it is found and it's position determined for the MouseMove.

To the OP: Remember to capture your bitmaps using the built in Image Capture tool in Macro Scheduler.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

beattie282
Newbie
Posts: 6
Joined: Wed Dec 17, 2008 2:11 am

Post by beattie282 » Wed Dec 17, 2008 4:52 pm

well thankyou for all your help but iam not going to be giving this to my mates after all so i have decided to just you the cursor positions (movemouse) and it is working fine.

seriously thankyou all :)

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Dec 17, 2008 5:08 pm

Yes, but he's using MouseMove to move to a position determined by FindImagePos. Therefore it does not matter where the object is as it is found and it's position determined for the MouseMove.
You are right, good catch Marcus, I missed that fine detail with just a brief scan of the commands.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts