7508 posts
Location
Australia
Posted 16 December 2012 - 01:14 AM
Does anyone know if its possible to do multi-key press bindings?
for example, something like this
event = { os.pullEvent() }
if event[1] == "key" and (event[2] == keys.ctrl and event[2] == keys.c) then
print("ctrl + c has been pressed")
end
818 posts
Posted 16 December 2012 - 01:17 AM
I assume the last event[2] is ment to have a 3 in it, and no, sadly not. Though, a held down key will spam keyevents, which could be used as a check for a held down key. But any easy way that doesn't use up 100 lines? Sadly, nope :(/>
7508 posts
Location
Australia
Posted 16 December 2012 - 01:20 AM
I assume the last event[2] is ment to have a 3 in it, and no, sadly not. Though, a held down key will spam keyevents, which could be used as a check for a held down key. But any easy way that doesn't use up 100 lines? Sadly, nope :(/>
damn :(/> there goes that plan :P/>
{ os.pullEvent() } for a key returns the event and 1 parameter. so the table would look like this { "key", 23 } where 23 is a key code. so that last 2 was deliberate.
302 posts
Posted 16 December 2012 - 01:49 AM
Well, if you use a multitasking framework, it's easy to run a task in the background that listens for char and key events, and keeps track of the last time a key was pressed. Mine has more than 1000, I think, but that's not a bad thing!
EDIT: oh, your signature…
7508 posts
Location
Australia
Posted 16 December 2012 - 01:53 AM
Well, if you use a multitasking framework, it's easy to run a task in the background that listens for char and key events, and keeps track of the last time a key was pressed. Mine has more than 1000, I think, but that's not a bad thing!
food for thought, and a later day when its the last feature to implement
EDIT: oh, your signature…
you like? :P/>
302 posts
Posted 16 December 2012 - 02:06 AM
and a later day when its the last feature to implement
What do you mean?
7508 posts
Location
Australia
Posted 16 December 2012 - 02:07 AM
I will get around to implementing the multikey bindings in my program when its the last feature :P/> since all the other features are easier :P/>
818 posts
Posted 16 December 2012 - 02:50 AM
Yeah that's a very good idea.