This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
_removed's profile picture

mouse_hover event

Started by _removed, 20 February 2015 - 07:01 PM
_removed #1
Posted 20 February 2015 - 08:01 PM
As i do a lot of button related programming, I would like an event that gets the x and y of the cursor.


local event, x, y = os.pullEvent("mouse_hover")

I think it is cool and would be useful for people out there.
SquidDev #2
Posted 20 February 2015 - 08:30 PM
When would this be fired? When the mouse moves? So if I move the mouse from the left to the right of the screen I will end up firing about 50 events… And if multiple people are using the same computer at the same time then you have many, conflicting events.

The alternative would be os.getMousePosition() (and as has been suggested: os.isKeyPressed()). However this doesn't account for multiple users using the same computer, which seeing as Minecraft is multiplayer, ComputerCraft has to also account for.

Much as I can see the benefits for this, I just think it is too infeasible.
_removed #3
Posted 21 February 2015 - 11:14 AM
When would this be fired? When the mouse moves? So if I move the mouse from the left to the right of the screen I will end up firing about 50 events… And if multiple people are using the same computer at the same time then you have many, conflicting events.

The alternative would be os.getMousePosition() (and as has been suggested: os.isKeyPressed()). However this doesn't account for multiple users using the same computer, which seeing as Minecraft is multiplayer, ComputerCraft has to also account for.

Much as I can see the benefits for this, I just think it is too infeasible.

I see your point here, and will lookup os.getMousePosition(
SquidDev #4
Posted 21 February 2015 - 11:24 AM
I see your point here, and will lookup os.getMousePosition(

This doesn't exist, I was hypothesising it as an alternative suggestion, though I don't think this is practical either due to the nuisances of multi-player - who's cursor do you get, or if no one is using it what do you do then? I think there are benefits to this, though in the end, we just have to think up ways around it.
Edited on 21 February 2015 - 10:25 AM
wieselkatze #5
Posted 21 February 2015 - 03:24 PM
os.getMousePosition() could possibly return a table for each mouse of a player looking into the pc.
Nice would be if you could actually track, which cursor is which - a way to do that would be passing the player's name.
For example like that:


local player1, player2 = os.getMousePosition()

print( player1.x .. ":" .. player1.y .. " of player " .. player1.name )

I would definitely see a use for that - and I'd definitely be happy if this were implemented, though it's unlikely to happen.
Edited on 21 February 2015 - 02:25 PM
MKlegoman357 #6
Posted 21 February 2015 - 04:06 PM
In my opinion this just doesn't fit the mod really.
The_Cat #7
Posted 21 February 2015 - 06:28 PM
If this were implemented you could do somthing like a drop downmenu like you see on websites which are triggerd on a mouse hover.
TheOddByte #8
Posted 21 February 2015 - 10:45 PM
This wouldn't work, as it would just spam events and be even more horrible if multiple users uses the same computer at the same time Dx
Now something like os.getMousePosition() would be more feasible, as it could return a table with all the users on the screen, but it still doesn't feel like this will be added. We can only hope that it does.
Bomb Bloke #9
Posted 21 February 2015 - 11:01 PM
I can't see a function being added. If ("if") we get any more methods of picking up on user interaction, they'll likely be event based, and they likely won't identify users.

A basic "mouse_hover" event would function exactly like "mouse_drag" does now; only it'd be fired when the mouse button isn't held down. I don't actually reckon it'd cause all that much of a traffic issue, given that people don't wave their mouse over ComputerCraft GUIs unless they're actively interacting with them.

That said, I still say "mouse_release" would be much more useful.