Jump to content
Sign in to follow this  
meowbits

How to click coordinates based on %'s

Recommended Posts

meowbits

Have it setup so the user defines the game dimensions. Those are set as $left, $top, $right, $bottom.

I have the coordinates of where I want to click in a percentage based off of the game dimensions that the user picked.

77.63%, 91.37%

How do I set it up so that it will click at that coordinate? - and effectively click in the same spot regardless of computer resolution/size

Your help is much appreciated!

Share this post


Link to post
Share on other sites
weaponx

Simple math here...

@DesktopWidth * (77.63/100)

@DesktopHeight * (91.37/100)

Share this post


Link to post
Share on other sites
meowbits

Simple math here...

@DesktopWidth * (77.63/100)

@DesktopHeight * (91.37/100)

Desktop isn't what I need.

When it starts, you're prompted to click the outside edges of the browsergame screen.

So the screen could be moved to the top left, or right.. ect.

I need a way to make it so the % is based off of the coordinates that the user picked.

Share this post


Link to post
Share on other sites
bluebearr

Maybe this?

$ClickX = Round(($right - $left)*(77.63/100), 0) + $left
$ClickY = Round(($bottom - $top)*(91.37/100), 0) + $top

BlueBearrOddly enough, this is what I do for fun.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.