Achilles Philippopoulos Posted September 5, 2009 Report Posted September 5, 2009 Hi, A quick question. In fs9, when we entering the menu, fsuipc does not work. Can lua control fs in this case? My idea is to read payload offset from fsuipc and when this value changes to send keystrokes to fs from lua to enter to menu(with key compinations) and refresh the payload. If yes, a small sample just to begin from somewhere? Thanks in advance Achilles
Pete Dowson Posted September 5, 2009 Report Posted September 5, 2009 In fs9, when we entering the menu, fsuipc does not work. Can lua control fs in this case? Hmm. The Lua threads are still running when you are in the menu. The question becomes -- do the methods available to send keypresses from Lua to FS manage to get to the menu dialogues? It is actually quite possible, but it would need testing. Certainly, keypresses sent via WideFS from a Client PC work okay in Menus, but WideServer sends the keys directly. I'm not sure that's the case with Lua as it is at present. My idea is to read payload offset from fsuipc and when this value changes to send keystrokes to fs from lua to enter to menu(with key compinations) and refresh the payload. Could you first just try a short Lua program and see how you get on? Let me know. I would test it myself but I'm really tied up for a few days. If it doesn't work, maybe I can add some extra Lua library procedures to allow it to work just as WideServer's actions do. Regards Pete
Achilles Philippopoulos Posted September 11, 2009 Author Report Posted September 11, 2009 Hi Pete, A quick question. I will need a flag to read at the Lua file in order to activate the logic of Lua for the menu. What if I use an offset that not exists at FS9? Like 341C? So, if possible to write to offset 341C at fsuipc version 3.9xx and read it from the Lua file, the job will be done. What do you think?
Pete Dowson Posted September 11, 2009 Report Posted September 11, 2009 I will need a flag to read at the Lua file in order to activate the logic of Lua for the menu. What if I use an offset that not exists at FS9? Like 341C? No, never use unlisted offsets. They might simply be mapped to unknowns in FS, or get allocated and used in a later version. There are 64 bytes of user offsets, for any use you like, at 66C0. This is listed. However, I'm not sure why you'd need to do this? There are assignable Lua controls to set and clear sets of 32 flags specific to each running Lua program, testable in Lua by special library functions. You can send any Lua command via offset 0D70 (parameter in 0D6C). Regards Pete
Achilles Philippopoulos Posted September 11, 2009 Author Report Posted September 11, 2009 Ok, I am not familiar with Lua so I took a look at the documents. As far as I understant, I need somethink like the below? if not ipc.keypress(0) then ipc.keypress(12) ipc.sleep(50) ipc.keypress(12) ipc.sleep(50) ipc.keypress(13) ipc.sleep(50) ipc.keypress(12) ipc.sleep(50) ipc.keypress(13) else ipc.keypress(24) end ipc.keypress(65) ipc.sleep(50) ipc.keypress(70) ipc.sleep(50) ipc.keypress(80) ipc.sleep(50) ipc.keypress(0) If this is ok, then I can make it run from fsuipc. Am I close to the solution?
Pete Dowson Posted September 11, 2009 Report Posted September 11, 2009 Ok, I am not familiar with Lua so I took a look at the documents. As far as I understant, I need somethink like the below?if not ipc.keypress(0) then What are you trying to test here? The keypress function doesn't return a result, it is a request TO FSUIPC to send a keypress. Are you perhaps wanting to test a Flag? As with if not ipc.testflag(0) then ...? Again, what does sending a keypress of 0 do for you? ipc.keypress(0) Perhaps if I knew what this plug-in is supposed to do, exactly, I'd be better able to comment. Am I close to the solution? Quite honestly I do not know. Have you done what i suggested, to see if I need to make a change first? You remember, surely, I said this: Could you first just try a short Lua program and see how you get on? Let me know. I would test it myself but I'm really tied up for a few days.If it doesn't work, maybe I can add some extra Lua library procedures to allow it to work just as WideServer's actions do. In other words, without testing I just don't know if the ipc.keypress() function will send its keypress in a way which gets it processed inside FS's dialogues. If it does, well and good, if not, I think I know how to make it do so easily enough. Regards Pete
Achilles Philippopoulos Posted September 30, 2009 Author Report Posted September 30, 2009 Hi Pete, I set offsets 0D6C 4 to a value of 0 I set offsets 0D70 40 to Lua myLua First I used display vals as myLua to check if it works. And worked fine. I show the vars at FS screen. Then I created MyLua with the bellow inside ipc.keypress(65, 16) ipc.sleep(50) ipc.exit() Result - The keypress works but sends the keystrokes to my application and not inside FS. What I do wrong? Must I focus first to FS window? Maybe I must use event instead of keypress? Best regards, Achilles
Pete Dowson Posted September 30, 2009 Report Posted September 30, 2009 What I do wrong? Must I focus first to FS window? Yes. The keypress facility is merely emulating the user pressing keys. It isn't sending KEYDOWN and KEYUP messages to a specific Window. If you wanted to do that you could do it direct from your application, if it is running locally. In the normal use of your program, wouldn't FS have the focus in any case? You lose sound if it doesn't have the focus. Incidentally, you don't need to explicitly exit at the end of the Lua program -- it exits automatically at the end in any case. The exit facility is provided for conditional premature exits, earlier in a Lua program. Regards Pete
Achilles Philippopoulos Posted September 30, 2009 Author Report Posted September 30, 2009 Thanks for the reply. I will keep you informed when I found the most suitable solution for local and non-local calls. What I do wrong? Must I focus first to FS window? Yes. The keypress facility is merely emulating the user pressing keys. It isn't sending KEYDOWN and KEYUP messages to a specific Window. If you wanted to do that you could do it direct from your application, if it is running locally. In the normal use of your program, wouldn't FS have the focus in any case? You lose sound if it doesn't have the focus. Incidentally, you don't need to explicitly exit at the end of the Lua program -- it exits automatically at the end in any case. The exit facility is provided for conditional premature exits, earlier in a Lua program. Regards Pete
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