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

Key hold down [event]

Started by jag, 13 November 2012 - 08:48 PM
jag #1
Posted 13 November 2012 - 09:48 PM
Is it possible to check if a key is hold down with os.pullEvent() ?
I want this to check for multiple button event at the same time.

I want to check for shift and the arrow keys.
I know that if I want to check for shift + a letter I could just check for capitalized characters.
But is there a smart way to do what I need/want?
matejdro #2
Posted 13 November 2012 - 10:04 PM
Not possible yet.
Cruor #3
Posted 13 November 2012 - 11:52 PM
Not posible due to SMP. what if one guy is holding down all the keys just to troll?
matejdro #4
Posted 14 November 2012 - 01:09 AM
Then program would just register all keys as holding down. It does not really matter.
Cruor #5
Posted 14 November 2012 - 01:20 AM
it would block userinput, so it does matter :P/>/>

but it cant be added because of SMP stuff anyways, so yeah, thats it :)/>/>
jag #6
Posted 14 November 2012 - 01:40 AM
It would be great if we could have a button released and pressed event.
if event == "button_pressed" then
elseif event == "botton_released" then
end
Like for example now if you hold down a button it just spams events.
matejdro #7
Posted 14 November 2012 - 03:23 AM
it would block userinput, so it does matter :P/>/>

but it cant be added because of SMP stuff anyways, so yeah, thats it :)/>/>

What is the difference between troll holding keys or troll pressing random keys? It also blocks user input.
Cruor #8
Posted 14 November 2012 - 03:33 AM
lets do it Cloudy style:
It wont happend because it is confusing in a mulituser environment.
(90% quoted from IRC :P/>/>)
jag #9
Posted 14 November 2012 - 06:02 AM
lets do it Cloudy style:
It wont happend because it is confusing in a mulituser environment.
(90% quoted from IRC :P/>/>)
Oh yeah, multiple users would make it tricky.
Sammich Lord #10
Posted 14 November 2012 - 06:14 AM
They could just have the events return a table of all users using the computer currently, and the coder can make the script only detect key presses if it is done by the first person to open the terminal. There is still a very high chance of it not being added.

However, what you could, is see if the keys were pressed in sequence within x period of time. AfterLifeLochie has done this for one of his scripts I believe.
Jajnick #11
Posted 14 November 2012 - 06:29 AM
lets do it Cloudy style:
It wont happend because it is confusing in a mulituser environment.
(90% quoted from IRC :P/>/>)
Hmm… Wait, I know a multiuser environment with computers supporting key_up and key_down events! It's called real world. What is your problem, Cloudy? Are those events a paradox for you?
GopherAtl #12
Posted 14 November 2012 - 06:31 AM
jajnick, you frequently have someone next to you typing on the same keyboard in the real world? That seems inconvenient.
Jajnick #13
Posted 14 November 2012 - 06:59 AM
http://img849.imageshack.us/img849/153/img4033bg.jpg
DUM DUM DUUUM
matejdro #14
Posted 14 November 2012 - 07:18 AM
jajnick, you frequently have someone next to you typing on the same keyboard in the real world? That seems inconvenient.

But it still works.

Also it's not really frequent to have someone next to you typing on same PC in ComputerCraft either.
Cloudy #15
Posted 14 November 2012 - 08:43 AM
lets do it Cloudy style:
It wont happend because it is confusing in a mulituser environment.
(90% quoted from IRC :P/>/>)
Hmm… Wait, I know a multiuser environment with computers supporting key_up and key_down events! It's called real world. What is your problem, Cloudy? Are those events a paradox for you?

Don't be an ass. I don't reply with what people want to know when people are asses.
Jajnick #16
Posted 14 November 2012 - 09:24 AM
I'm sorry, but the answer is very important to me. I already have got many project ideas that won't realize without those events ._.
Sammich Lord #17
Posted 14 November 2012 - 09:40 AM
lets do it Cloudy style:
It wont happend because it is confusing in a mulituser environment.
(90% quoted from IRC :P/>/>)
Hmm… Wait, I know a multiuser environment with computers supporting key_up and key_down events! It's called real world. What is your problem, Cloudy? Are those events a paradox for you?

Don't be an ass. I don't reply with what people want to know when people are asses.
Cloudy is good at pwning people.
KaoS #18
Posted 14 November 2012 - 10:33 AM
–snip–
Cloudy is good at pwning people.

I'm sorry, "good" is just an understatement. I look up his profile regularly just to view all of his posts :P/>/> one of the few things that cheer me up while I'm dealing with a moronic client
Cloudy #19
Posted 15 November 2012 - 04:36 AM
No idea why this was locked. Fixed!
Lyqyd #20
Posted 15 November 2012 - 04:57 AM
Well, I had locked it because the original question had been answered and the topic had subsequently veered off topic. Seemed like there wasn't any reason to keep it open at that point. I must have been mistaken! :P/>/>
Cloudy #21
Posted 15 November 2012 - 05:18 AM
Ah, I would have kept it closed had you posted advising why it had been done - I didn't know who closed it due to IP Board's lacking logging facilities. Re-closed :P/>/>