Im making a program that needs to listen to multiple events so os.pullEvent("char") wont work...and i need to be able to turn keycodes into chars because for some reason the "char" event is never fired when i press a key
I have also tried string.char(p1) but i guess the mc keycodes are different to lua ones because it never returns the right value
Please help!
converting keycode to char
Started by Exerro, Jan 20 2013 01:46 AM
4 replies to this topic
#1
Posted 20 January 2013 - 01:46 AM
#2
Posted 20 January 2013 - 01:51 AM
awsumben13, on 20 January 2013 - 01:46 AM, said:
Im making a program that needs to listen to multiple events so os.pullEvent("char") wont work...and i need to be able to turn keycodes into chars because for some reason the "char" event is never fired when i press a key
I have also tried string.char(p1) but i guess the mc keycodes are different to lua ones because it never returns the right value
Please help!
I have also tried string.char(p1) but i guess the mc keycodes are different to lua ones because it never returns the right value
Please help!
#3
Posted 20 January 2013 - 02:06 AM
its about 1000 lines spread across 5 programs...so i cant really show code...but i use a program that sleeps between os.pullEvent() so if char and key is fired next to eachother it might not pick up the char
edit: thanks for the help...keys.getName(p1) works
edit: thanks for the help...keys.getName(p1) works
#4
Posted 20 January 2013 - 02:14 AM
can't even show the main loop where you are trying to read the char/key?
ahhh your using sleep... thats eats events... meaning your program will sometimes miss some, you should avoid sleeps when using an event loop and instead use timers ( which is how sleep works anyways )...
ahhh your using sleep... thats eats events... meaning your program will sometimes miss some, you should avoid sleeps when using an event loop and instead use timers ( which is how sleep works anyways )...
#5
Posted 20 January 2013 - 02:18 AM
oh yeah re-read my code it starts a timer and does os.pullEvent() but if a key is repeatedly pressed it would bypass this so it sleeps if it wasnt the timer that triggered the event...
and the input code:
and the input code:
Spoiler
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











