Jump to content

Possible to change the mouse cursor position?


Recommended Posts

I know there are more than a few ways to get the x and y coordinates of the cursor's current position on screen, TheSim:GetPosition() being one of the simplest.

But is there any way to move the mouse cursor by itself? Say I wanted to take the cursor's current position and bump it down a little. Or just set it's position to 0,0 to get it out of the way. Is that even possible? I've been digging through code for a while and it's starting to look like it might not be possible, but I wanted to know if anyone else knew of a way

Link to comment
Share on other sites

19 hours ago, CarlZalph said:

@pickleplayer

TheInputProxy has: GetOSCursorPos + SetOSCursorPos.

If you're in a window, then these functions will work for the entire window space including the title bar.  They return 0,0 at the bottom left and the max window size at the top right in the format of horizontal,vertical.

Wow, it worked!! That's fantastic! Thank you so much!

How did you find out about that, just curious? I don't recall it being used at all in the game.

Link to comment
Share on other sites

5 minutes ago, pickleplayer said:

Wow, it worked!! That's fantastic! Thank you so much!

How did you find out about that, just curious? I don't recall it being used at all in the game.

For any userdata object, Klei left the metatable accessible to prod at.

for k,v in pairs(getmetatable(TheInputProxy).__index) do print(k,v) end

 

This is useful for seeing all userdatas with their functions:

    for k,v in pairs(_G)
    do
        if type(v) == "userdata"
        then
            print(k,v)
            for k,v in pairs(getmetatable(v).__index)
            do
                print("->", k, v)
            end
        end
    end

Which as of this time prints out:

https://pastebin.com/M59JCGW2

Edited by CarlZalph
Link to comment
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
 Share

×
  • Create New...