Jump to content
Sign in to follow this  

Press A Key Based On Which Zone Mouse Is Clicked

Recommended Posts


Ok I've posted an image as well to show better what I mean. I'm using VisualBoyAdvanced to play old GameBoy roms. I was wondering if I could remove the need for the keyboard and incorporate all movement and selections into the mouse. The idea seems pretty basic if mouseclick = Coordinates send arrow key sequence for that coordinate. Only problem is its more of a range then a single coordinate.

Excuse the crappy paint job


L = Left Arrow

R = Right Arrow

U = Up Arrow

D = Down Arrow

x= Number of Times

So if I wanted to move to Lx2 the user would have to click anywhere in that Lx2 zone and then the script would send("Left,Left") but how do I get this range of coordinates.

Any help is greatly appreciated, and definitely feel free to point me in the right area in the help file

Share this post

Link to post
Share on other sites


You get a x/y coord. Make sure you set: AutoItSetOption( "MouseCoordMode", 2) before the calls.

There are 5 squares in front and behind you, and 2 sqaures (maybe 3) above and below you.

You need to 1) find out how many x/y pixels there are in each row/column.

Example: there are 111 pixels on the x axis (from left to right) of the game window and say 60 pixels on the y axis.

You would then get the mousepos, and then determine from there where it is.

If mouse X >= 60 its in the right side, if its lower then 50 (or equal) its on the left.

Then devide it by 10 (for 111pixels). IF it equals 5, then your are on the 5th square for whatever side. (round and drop the remainder).

Something like that will get you started, those are just my random thoughts but that is how you do a range. (atleast my way)

Let me know if that helps or just confuses you more.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this