famouswelshman Posted March 21, 2009 Report Posted March 21, 2009 Hi Pete Might seem a really basic question!! After mapping a switch to action a basic light on and off command, how can I make sure that on loading FS that the hardware switch is in sync with the one on the sims panel? In other words, if I close down FS and didnt turn the switch off then upon re-loading the switch would appear in the opposite direction and action the on/off sequence back to front?!! Is there something within the program which recognises hardware positions upon startup? Or is it just a case of making sure I turn this switch to its off position before FS shutdown. Cheers J
Pete Dowson Posted March 21, 2009 Report Posted March 21, 2009 Might seem a really basic question!! After mapping a switch to action a basic light on and off command, how can I make sure that on loading FS that the hardware switch is in sync with the one on the sims panel? In other words, if I close down FS and didnt turn the switch off then upon re-loading the switch would appear in the opposite direction and action the on/off sequence back to front?!! That would only be the case where your switch is programmed to operate a "toggle" event or control in FS. Most switches can be operated with On or Off controls, or, failing that, by using the Offset controls to change FS internals. All the lights are mapped to bits in offset 0D0C, so you can use Offset Word Setbits to switch them on and Offset Word Clearbits to switch therm off, individually. The mapping is shown in the FSUIPC SDK document listing all the offsets. That would make sure your switches still operated correctly in the on/off sense, but of course it doesn't deal with general synchronisation when you start up or when you load a new flight. The easy way to deal with that is to make it a matter of procedure to flick all your switches up and down initially, and after loading a flight, to get everything in synch. If you were more ambitious you could write a Lua plug-in which could either be run initially, when FS is ready, or when a flight is loaded (or both), which scans your switches and sends the appropriate commands to FS. Regards Pete
famouswelshman Posted March 22, 2009 Author Report Posted March 22, 2009 Cheers for the reply. Much appreciated, another lesson learnt! Jay
AUA144 Posted March 24, 2009 Report Posted March 24, 2009 Hi Peter, another question: runs Ipcready.lua automatically again if i start my standard flight with the default Cessna and then i change the aircraft e.g. to any PMDG? Sometimes during a longer flight a "Scenery Reload" happens due to Time-Sync with FSRealTime, has this any effect to the Ipcready.lua ?
Pete Dowson Posted March 24, 2009 Report Posted March 24, 2009 runs Ipcready.lua automatically again if i start my standard flight with the default Cessna and then i change the aircraft e.g. to any PMDG? No, it only runs at start-up. Really the main idea of ipcReady is to load and run any Event-monitoring routines you want. You could get ipcReady to run a Lua plug-in which monitors changes to the aircraft name offset (0x3D00, string, length 256), then take action when it does. Sometimes during a longer flight a "Scenery Reload" happens due to Time-Sync with FSRealTime, has this any effect to the Ipcready.lua ? No. None. ipcInit and ipcReady are run at FSUIPC startup and FS first "ready to fly". That's it. No other times. Functions installed by the Event library stay loaded for the whole session, unless you explicitly Kill them, or have an ipc.exit call in the Event receiving function, or an event.cancel call to cancel the function. Event functions can monitor FSUIPC offsets, joystick buttons, keypresses, and FS controls ("key events"). Regards Pete
AUA144 Posted March 24, 2009 Report Posted March 24, 2009 Hello Pete, thank you for the explanation. I found a simple solution to run the ipcready.lua after an one-time aircraft-change: ipc.sleep(90000) at the first position inside the file is approx. the time needed to change the aircraft. (a space of 10 seconds added). Then the LUA proceeds (depending on the loaded aircraft) as programmed.
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