Regards
Augustas
I think it should just return a table, because those can be iterated over.
local event = {os.pullEvent()}
I think it should just return a table, because those can be iterated over.local event = {os.pullEvent()}
I am not sure that this is easily possible. I believe LWJGL sends keys individually, so you'd need to have a system to collect all the keys pressed over a set amount of time into a set of return values.
Maybe we could have os.isKeyDown(keycode)?Though LWJGL has a method isKeyDown or something like that, but that'd be another suggestion. Actually, that is just this suggestion but in a wrapper.
Hmmm,Maybe we could have os.isKeyDown(keycode)?Though LWJGL has a method isKeyDown or something like that, but that'd be another suggestion. Actually, that is just this suggestion but in a wrapper.
I am not sure that this is easily possible. I believe LWJGL sends keys individually, so you'd need to have a system to collect all the keys pressed over a set amount of time into a set of return values.
while (Keyboard.next()) {
int key = Keyboard.getEventKey();
// Add key to return values.
}
That should work.Me tooHmmm,Maybe we could have os.isKeyDown(keycode)?Though LWJGL has a method isKeyDown or something like that, but that'd be another suggestion. Actually, that is just this suggestion but in a wrapper.
Dan likes to keep to an events based system.
But I'd like that.
True, but it can be difficult to do certain things with the event based system. (For games, continuous movement, repeated key combos, etc)Hmmm,Maybe we could have os.isKeyDown(keycode)?Though LWJGL has a method isKeyDown or something like that, but that'd be another suggestion. Actually, that is just this suggestion but in a wrapper.
Dan likes to keep to an events based system.
But I'd like that.
True, but it can be difficult to do certain things with the event based system. (For games, continuous movement, repeated key combos, etc)Hmmm,Maybe we could have os.isKeyDown(keycode)?Though LWJGL has a method isKeyDown or something like that, but that'd be another suggestion. Actually, that is just this suggestion but in a wrapper.
Dan likes to keep to an events based system.
But I'd like that.
This has been discussed many times, and I believe the general consensus is that it would not work within a multiplayer environment, since there would be no viable way to pick which player to test the key on.
The only way I can see something like this happening is if something like this: http://www.computerc...-side-programs/ (client side code) was added, and I don't think that will ever happen for reasons discussed in that thread.
You can have a packet sent to each client. Bam. Done. I don't see the need for polling a specific user: If someone presses a key on your keyboard, the key is still pressed and the computer will still know that regardless of who pressed it.True, but it can be difficult to do certain things with the event based system. (For games, continuous movement, repeated key combos, etc)Hmmm,Maybe we could have os.isKeyDown(keycode)?Though LWJGL has a method isKeyDown or something like that, but that'd be another suggestion. Actually, that is just this suggestion but in a wrapper.
Dan likes to keep to an events based system.
But I'd like that.
This has been discussed many times, and I believe the general consensus is that it would not work within a multiplayer environment, since there would be no viable way to pick which player to test the key on.
The only way I can see something like this happening is if something like this: http://www.computerc...-side-programs/ (client side code) was added, and I don't think that will ever happen for reasons discussed in that thread.
Base it on proximity. Only send packets to users in reaching range of a computer. The key presses will also be sent to the computer nearest to the client. There are better ways but I think this is the safest since it's completely server-side.You can have a packet sent to each client. Bam. Done. I don't see the need for polling a specific user: If someone presses a key on your keyboard, the key is still pressed and the computer will still know that regardless of who pressed it.
Base it on proximity. Only send packets to users in reaching range of a computer. The key presses will also be sent to the computer nearest to the client. There are better ways but I think this is the safest since it's completely server-side.You can have a packet sent to each client. Bam. Done. I don't see the need for polling a specific user: If someone presses a key on your keyboard, the key is still pressed and the computer will still know that regardless of who pressed it.
EDIT: Derp, I just realised what you meant: How do we know whether the user is in the GUI since they could be faking information?
Setting some kind of timeout should handle this… good ideaI'd prefer it if another event was raised when the user released a key. This means one can check if two keys are pressed at once. I guess the only issue would be is that someone could press a key, close the GUI, and then release the key. Then the terminal would still think the key was pressed and possibly muck up.
Unless the mod gets a rewrite in the backend constantly checking with LWJGL if each key on the keyboard is pressed for each player, this isn't going to happen.I'd prefer it if another event was raised when the user released a key. This means one can check if two keys are pressed at once. I guess the only issue would be is that someone could press a key, close the GUI, and then release the key. Then the terminal would still think the key was pressed and possibly muck up.
Yeah. I see now that it can't easily be done. I'm used to OpenGL which deals with both up and down key events. Forge/Minecraft only work with key 'type' events. This seems strange but then… Looks like it is impossible. Sigh.Unless the mod gets a rewrite in the backend constantly checking with LWJGL if each key on the keyboard is pressed for each player, this isn't going to happen.I'd prefer it if another event was raised when the user released a key. This means one can check if two keys are pressed at once. I guess the only issue would be is that someone could press a key, close the GUI, and then release the key. Then the terminal would still think the key was pressed and possibly muck up.
Unfortunately, yeah. That's one advantage CC emulators have over CC.Yeah. I see now that it can't easily be done. I'm used to OpenGL which deals with both up and down key events. Forge/Minecraft only work with key 'type' events. This seems strange but then… Looks like it is impossible. Sigh.Unless the mod gets a rewrite in the backend constantly checking with LWJGL if each key on the keyboard is pressed for each player, this isn't going to happen.I'd prefer it if another event was raised when the user released a key. This means one can check if two keys are pressed at once. I guess the only issue would be is that someone could press a key, close the GUI, and then release the key. Then the terminal would still think the key was pressed and possibly muck up.
local event,keya,keyb,keyc,keyd = os.pullEvent(1)
The
os.pullEvent(1)
could state how long it should wait for events to be triggered.Again, that's not exactly as easy as you think it would be. Doing so would require that we constantly check for which user is pressing the keys, and check if they've released the keys. In a multi-user environment, it's not exactly the easiest to do.
It is currently doing that anyway…Again, that's not exactly as easy as you think it would be. Doing so would require that we constantly check for which user is pressing the keys, and check if they've released the keys. In a multi-user environment, it's not exactly the easiest to do.
Example: Almost all computers right now can use multiple keyboards at once. The computer does differentiate which keys are pressed on which keyboard, since key modifiers need to be captured, such as ctrl, alt, and shift. So if we were to implement this in CC, we'd have to track the people who are pressing keys.What I don't get is why a release event would require such tracking in the first place. I'm not aware of any real-world operating systems that bother with it - they just hand you the event, and if you're using multiple input devices, then that's your problem.