MZ Finding x y tile of mouse/screen/canvas position.

Dear math people, send help! 😢
Screen Dimensions: 1024x575
Tilesize: 32

So what I found to get x/y tile of your mouse you set an event at 0,0 then use that event as a base to find the mouse tile x.
This is what that looks like using my tilesize(32) which my screen width(1024) is divisible into!

1610085518608.png


However, my screen HEIGHT(575) is not cleanly divisible into my tilesize(32), so using this method produces one tile over or under positions, does anyone know how I can get the correct Y tile?
I can't even math but maybe there's some magical math fix to this problem? 😤
You can use $gameMap.canvasToMapX(#) to find X where # is the screen position in question. Also $gameMap.canvasToMapY(#) for Y.
What a freaking lifesaver-!! I don't know why I couldn't find that super easy answer through google (either it fails me or my human-eyeballs do!) 😊 Thanks!
You lucked out really, I came across it just a few days ago when I was building a map on top of the map but only on the screen the player is currently on.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/finding-x-y-tile-of-mouse-screen-canvas-position.131953/