ark1320 Posted December 2, 2013 Report Posted December 2, 2013 Hi Pete, Using FSUIPC4 I have "assigned" different keyboard and numpad keys to "activate" different LUA scripts. The activated script then looks at the ipcPARAM value associated with the keypress and processes it accordingly. My question is a conceptual one. My understanding is when a keypress occurs, it is intercepted by FSUIPC4. It if one of the keys assocaited with a LUA script, FSUIPC4 calls (activates) the script, and passes the associated ipcPARAM value to the script. In this case neither the script or FSX actually "sees" the value of the particular key (the key code) that was pressed and so the only thing that matters is the value of ipcPARAM. On the other hand, if the keypress is not assocaited with a script, FSUIPC4 passes the keypress keycode on to FSX or perhaps uses it in some other previously programmed way. Is my understanding correct? If not, where am I going wrong? Thanks very much, Al
Pete Dowson Posted December 3, 2013 Report Posted December 3, 2013 Using FSUIPC4 I have "assigned" different keyboard and numpad keys to "activate" different LUA scripts. The activated script then looks at the ipcPARAM value associated with the keypress and processes it accordingly. My question is a conceptual one. My understanding is when a keypress occurs, it is intercepted by FSUIPC4. It if one of the keys assocaited with a LUA script, FSUIPC4 calls (activates) the script, and passes the associated ipcPARAM value to the script. In this case neither the script or FSX actually "sees" the value of the particular key (the key code) that was pressed and so the only thing that matters is the value of ipcPARAM. Yes. The keypress or button is the instigator, whatever you program it to do is the reslut. That might be to send a control + parameter to FS, or, in this case to run a plug-in with a parameter. On the other hand, if the keypress is not assocaited with a script, FSUIPC4 passes the keypress keycode on to FSX or perhaps uses it in some other previously programmed way. Is my understanding correct? If not, where am I going wrong? Yes. If the key is not assigned at all in FSUIPC, either in the Hot Keys section, or the Keys section applicable to the current profile, then it passes on to FS. I'm not really sure why your question arises? What else could it do? Pete
ark1320 Posted December 3, 2013 Author Report Posted December 3, 2013 Pete, Besides making sure I understood the big picture, part of my motivation for the original post had to do with the Enter key on the numpad. I wanted to make sure that if the Enter key (or any key) was used to instigate a Lua script, it (the key code) would not also get passed on to FSX. So using the Enter key to instigate a Lua script is no different than using any other key, and thus the Enter key does not require special handling in some way. Thanks very much for your help. Al
Pete Dowson Posted December 3, 2013 Report Posted December 3, 2013 Besides making sure I understood the big picture, part of my motivation for the original post had to do with the Enter key on the numpad. I wanted to make sure that if the Enter key was used to instigate a Lua script, it (the key code) would not also get passed on to FSX. So using the Enter key to instigate a Lua script is no different than using any other key, and thus the Enter key does not require special handling in some way. There are some keys which will be seen by other parts of the system before FSUIPC can get them -- the ALT key is the main one to avoid. I'd guess keys like Print Screen, Scroll Lock, and so on might also be problematic too. Also some other things can get keys before fSUIPC. Other programs may make themselves intercept earlier in the queue, for example, and certainly things like menus and dialogues divert all keypresses to their own ends. Regards Pete
ark1320 Posted December 3, 2013 Author Report Posted December 3, 2013 Pete, Very helpful info -- thanks again! Al
ark1320 Posted December 3, 2013 Author Report Posted December 3, 2013 Pete, More info on Numpad Enter key: If I use the keyboard Return key via FSUIPC to setup and then instigate a Lua script all works well. AND then even the numpad Enter key will also instigate the script. But if I try to use FSUIPC to setup the numpad Enter key to instigate the script, nothing works (including the Return key). Any ideas on what might be happing? Thanks, Al
Pete Dowson Posted December 4, 2013 Report Posted December 4, 2013 If I use the keyboard Return key via FSUIPC to setup and then instigate a Lua script all works well. AND then even the numpad Enter key will also instigate the script. But if I try to use FSUIPC to setup the numpad Enter key to instigate the script, nothing works (including the Return key). Any ideas on what might be happing? Sorry, I can't quite get my head around that. You set it up and it works, but you can't set it up? Pete
ark1320 Posted December 4, 2013 Author Report Posted December 4, 2013 It all works if the main keyboard Return key is assigned via FSUIPC as the instigator for the Lau script, but does not work if the numpad Enter key is assigned via FSUIPC as the instigator for the Lau script. I am trying to figure out what is different between the Return and Enter keys that might explain why one works and one doesn't as the instigator. All default uses of the Enter key in FSX had been removed. Hope that is a little clearer. Al
Pete Dowson Posted December 4, 2013 Report Posted December 4, 2013 It all works if the main keyboard Return key is assigned via FSUIPC as the instigator for the Lau script, but does not work if the numpad Enter key is assigned via FSUIPC as the instigator for the Lau script. I am trying to figure out what is different between the Return and Enter keys that might explain why one works and one doesn't as the instigator. All default uses of the Enter key in FSX had been removed. Hope that is a little clearer. Aha! Now I see. Although the assignment dialogue in FSUIPC's Keys tab recognises one as "Rtn" and the other as "Enter", the code received by the routine which invokes the action is the same for both - the ASCII 13 for 'return'. This won't match the numpad 'Enter' keycode placed in the INI file, so nothing will happen if only Enter is assigned and not Rtn. If Rtn is assigned then both do the same thing. Interesting that you found this after it has been like this now for 12 years, in all versions of FSUIPC since key programming was first added! I'm left wondering if the same applies to other NumPad keys. Too late here now to experiment -- I'm off to bed! I might look at changing this. It would mean doing more code to get the extra data distinguishing the keys. However, I'm also a little worried than changing this at this stage, after 12 years, might mess up some folks' settings. Regards Pete
ark1320 Posted December 4, 2013 Author Report Posted December 4, 2013 Pete, Thanks for solving another puzzle for a FSUIPC user. The support you provide is amazing! Please post here if you do decide to make any FSUIPC changes regarding treatment of the numpad Enter key so it can be used as a "stand alone" Lau script instigator. And yes, get some well deserved sleep. Al
ark1320 Posted December 11, 2013 Author Report Posted December 11, 2013 Pete, Thanks very much for fixing the keyboard Return key vs Numpad Enter key issue in FSUIPC4.924a so the Enter key can now be used to initiate Lua scripts. Much appreciated. Best, Al
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now