599 posts
Location
LeLua
Posted 29 June 2015 - 07:03 PM
Hello developer/developer's of ComputerCraft
What I mean is adding like: "mouse_release" ; "key_press" ; "key_release"
With this, we could make better stuff and I REALLY WANT like: "mouse_pos"
you get the mouse position so that we can make like: if mouseX == objX then self.highlight=true end
Edited on 29 June 2015 - 05:04 PM
2679 posts
Location
You will never find me, muhahahahahaha
Posted 29 June 2015 - 07:14 PM
What is there are several users at a time in mulitplayer on the same computer? How does it know which mouse to use?
599 posts
Location
LeLua
Posted 29 June 2015 - 07:30 PM
I dont think that they can interact with one PC.
546 posts
Location
Wageningen, The Netherlands
Posted 29 June 2015 - 07:35 PM
Have you even looked at the newest version?
It has the new "mouse_up" and "key_up" events:
http://www.computercraft.info/
1140 posts
Location
Kaunas, Lithuania
Posted 29 June 2015 - 07:44 PM
The 'key' event also got an upgrade: a third argument indicating whether the key is being held. The problem with getting the current mouse position is, as stated above by Creator, multi-user environment. Yes, multiple user can look and interact with the same computer at the same time.
599 posts
Location
LeLua
Posted 29 June 2015 - 07:58 PM
Oh ok, then what about mouse position? If that would be implemented, then that would be awesome!
2679 posts
Location
You will never find me, muhahahahahaha
Posted 29 June 2015 - 08:09 PM
Same thing, multiple users!
1220 posts
Location
Earth orbit
Posted 29 June 2015 - 08:26 PM
Not to mention, that would require CC to spam the server constantly with cursor position data while the mouse is being moved. Multiply that increase by the number of users moving mice on a relatively populated server and, well, you probably get the idea…
599 posts
Location
LeLua
Posted 30 June 2015 - 11:32 AM
Hmm solution:
in while loop you could check if mouse == radius then updatemystuff end
and if the ain't moving then os.pullEvent would freeze and wait for other events.
Edited on 30 June 2015 - 09:33 AM
7083 posts
Location
Tasmania (AU)
Posted 30 June 2015 - 12:38 PM
If the mouse's position is reported via events, then "multiple users" aren't much of a problem (as opposed to if you get it via a function call, in which case they very much are). Event spam, on the other hand, would be an issue - you'd need the events to come in pretty much constantly.
If a "position" event only fired when the mouse actually moved, then how would you get it if the user didn't move the mouse after starting your script?
Beats me as to what the actual performance hit would be, though.
599 posts
Location
LeLua
Posted 08 July 2015 - 11:05 AM
I have a sulotuion for mouse position update for servers, when mouse if moved, server will not send it but it will wait for a function whenever to send the mouse position, when the developer decides, ok I need to update the mouse he will send mouse pos with for ex calling this function sendMousePacket(x, y).
Edited on 08 July 2015 - 09:05 AM
797 posts
Posted 08 July 2015 - 11:46 AM
I don't see how sending 2 bytes of information (51x19 every time the mouse moves to a different CC pixel would cause a load of lag.
Most people leave computers doing automated tasks, the majority of the rest probably just use command line stuff. Sure, if everyone on the server of 100 players were all spamming their mouse around the screen, it would be pretty intensive, but many people play on small servers with around 10 people and with a large focus being minecraft survival so they're not constantly on a computer. The benefits, however, would be immense. Imagine being able to hover over a button and see it slide slightly to the left or change colour. Imagine tooltips. Imagine hovering on one side of the screen and a GUI sliding in.
-snip-
If a "position" event only fired when the mouse actually moved, then how would you get it if the user didn't move the mouse after starting your script?
-snip-
I'm assuming the main usage of this would be interactive interfaces. Is it really necessary to know the position of the mouse to do that? My love2d UI demo used the love.mousemoved callback to determine the mouse position and that worked fine. Even if programs had an issue when first being launched, I'd certainly say it is worth it.