Avi8orJH Posted August 27, 2008 Report Posted August 27, 2008 Hi Pete, I am just now starting to delve into working with the FSUIPC.ini file for adding a conditional keypress. I've read the manual, the advanced users guide, the programmers guide, and downloaded the SDK. I have a basic grasp of the concepts for the most part but, suffice to say that I am a complete neophyte when it comes to programming. You've been programming computer code for two years longer than I've been alive so, I have a question I hope you can help me with. I'm using FS9.1, FSUIPC 3.82, and my question relates to Dreamfleet's Piper Dakota. This aircraft has a pulselight system with a three position toggle; off, steady, and pulse. I am trying to create a condition where if the aircraft is on the ground and/or flaps are extended, the keypress will toggle between the off and steady states. When airborne, the same keypress would toggle between the off and pulse states. I also have a concern about the transition of the two conditions, i.e. after takeoff and flaps up, the lights would be in the steady state; would the keypress toggle to the off state, the pulse state, or would it just mess things up? Also, is there a way to determine the offsets used for this light system, short of talking to the developer? I'm sure it uses 0D0C but I don't know which bits it uses. I would be grateful for any insight you can share. I'm not one who's given to overt flattery but, as this is my first post here, I'll make an exception. I want to say thanks to you for your many years of dedication to the flight simming community. Flight Simulator would most certainly not be what it is today without your hard work on, and commitment to FSUIPC. It's stunning that you find the time to answer virtually every question asked of you on this forum too. If there were a Flight Simulator Hall of Fame, you would doubtless be a first ballot inductee! Right along with Bruce Artwick. Oh, and Happy Birthday! Best Regards, Jeff *EDIT* BTW Pete, I meant to point out a minor bug in 3.82. If I click on create mouse macro and then hit cancel without having input anything in the macro name dialog box, FS C'sTD. Just a note for the next release.
Pete Dowson Posted August 27, 2008 Report Posted August 27, 2008 I am just now starting to delve into working with the FSUIPC.ini file for adding a conditional keypress. Keypress? I don't provide any programming facilities for conditions on keypresses, only buttons. You vould conceivably do it by programming a keypress to operate a "virtual button" and then programming that, with conditions, but it gets pretty weird and complicated. This aircraft has a pulselight system with a three position toggle; off, steady, and pulse. Same as a 737's strobes switch. How is the switch operated? Only by mouse? I assume the normal Strobes control from FS only selects off and one of the on states? I am trying to create a condition where if the aircraft is on the ground and/or flaps are extended, the keypress will toggle between the off and steady states. When airborne, the same keypress would toggle between the off and pulse states. Well, you can do that with buttons, or for a keypress programmed to operate a virtual button, but since there's no shortage of keypress combinations I don't understand why you don't simply use a separate keypress for each requirement. After all, in the real aircraft you would have to think about this and do it correctly, it isn't automatically going to change, is it? I also have a concern about the transition of the two conditions, i.e. after takeoff and flaps up, the lights would be in the steady state; would the keypress toggle to the off state, the pulse state, or would it just mess things up? The virtual button could be programmed to do your bidding, including mess things up if you wanted it to. ;-) Also, is there a way to determine the offsets used for this light system, short of talking to the developer? I'm sure it uses 0D0C but I don't know which bits it uses. 0D0C deals with FS supported lights, not any add-on ones. Without monitoring 0D0C (which you can do in the right-hand side of the Logging page -- offset 0D0C, type U16) there's no way of knowing what the aircraft uses. I doubt it uses any FSUIPC offsets at all for his extra values -- add-on programs only use extra FSUIPC offsets to communicate with external modules, and then they need to apply to me for an allocation. Oh, and Happy Birthday! Oh, did I publish my birthday someplace? Thank you. Yes, I am 65 today. But I'm not counting any more! ;-) BTW Pete, I meant to point out a minor bug in 3.82. If I click on create mouse macro and then hit cancel without having input anything in the macro name dialog box, FS C'sTD. Just a note for the next release. Oh, thanks. That's odd. I'll just try it here ... ... Ugh! So it does. That's not very nice! Thanks for letting me know! Regards Pete
Avi8orJH Posted August 27, 2008 Author Report Posted August 27, 2008 Thanks for the fast response Pete. Keypress? I don't provide any programming facilities for conditions on keypresses, only buttons. You vould conceivably do it by programming a keypress to operate a "virtual button" and then programming that, with conditions, but it gets pretty weird and complicated. I read this in the Advanced users guide. Perhaps I misunderstood. "ADDING OFFSET CONDITIONS As well as all the above (and below, for Keys) any or all entries in all Buttons and Keys sections of FSUIPC.INI can each contain a single condition based on the value of bits, bytes, words or double words in the FSUIPC IPC interface. These values are addressed by an offset value in hexadecimal and include just about anything you can think of about what is happening in FS." ...and under keyboard programming: "The second reason is to add FSUIPC offset conditions. The facilities for making Button presses conditional upon assorted FS internals all apply to Key programming too, and the format and other details are the same as for Buttons. Please refer to the section above entitled adding Offset Conditions." Now that I think about it though, It makes sense that the specific condition, in this case on the ground and/or flaps extended, would need for you to program a specific offset for it. Am I understanding that right? Same as a 737's strobes switch. How is the switch operated? Only by mouse? I assume the normal Strobes control from FS only selects off and one of the on states? Well actually this is more a wing mounted taxi light. The regular taxi light switch has no effect. I can create a mouse macro to operate the switch but, of course, that requires a seperate key for each macro. Well, you can do that with buttons, or for a keypress programmed to operate a virtual button, but since there's no shortage of keypress combinations I don't understand why you don't simply use a separate keypress for each requirement. After all, in the real aircraft you would have to think about this and do it correctly, it isn't automatically going to change, is it? I use the Logitech G15 keyboard, and use the dedicated macro keys for some of my aircraft systems that aren't related to control of the aircraft. Those are mapped to my stick and throttle. I don't want the switch position to change automatically. I just would like to toggle the switch via a single key combination for all three positions. If there is a way to program a single key combination to operate a three position toggle without condition, that's fine too. I suppose I could program two key combinations, based on mouse macros, with one moving the switch down and the other, up. I've done this for a three position switch on another aircraft. I was just trying to conserve keys and keep one switch to one keypress. ...Without monitoring 0D0C (which you can do in the right-hand side of the Logging page -- offset 0D0C, type U16) there's no way of knowing what the aircraft uses. Thanks for that. I'll keep that tool in mind for the future. Oh, did I publish my birthday someplace? Thank you. Yes, I am 65 today. But I'm not counting any more! :lol: No, not really. I read a post dated sometime in July where you mentioned your 65th was "next month". I think it was the same one where you mentioned that you had been programming since 1963. That I happened to mention it on the right day was just Kismet. I think I'll go buy a lotto ticket. Thanks again for the help Pete. I appreciate your patience as I am really trying to learn. Best Regards, Jeff
Pete Dowson Posted August 27, 2008 Report Posted August 27, 2008 I read this in the Advanced users guide. Perhaps I misunderstood. "ADDING OFFSET CONDITIONS As well as all the above (and below, for Keys) any or all entries in all Buttons and Keys sections of FSUIPC.INI can each contain a single condition based on the value of bits, bytes, words or double words in the FSUIPC IPC interface. Ah, yes! Mea culpe! I was thinking of the button conditions or "compund button" actions. Sorry. I clean forgot about that offset testing facility. Now that I think about it though, It makes sense that the specific condition, in this case on the ground and/or flaps extended, would need for you to program a specific offset for it. Am I understanding that right? No, there are offsets for flaps position and on ground indications. Really, to use these things, you need to Offsets list, which is supplied only as part of the FSUIPC SDK (on the Schiratti Dowson page). Flaps are at Word offset 0BE0, with zero for flaps up and other values for different flap positions. The "on ground" indicator is the Word at offset 0366, non-zero when on ground, zero when airborne. If you want help in editing the keypress entries in FSUIPC INI, let me know exactly what you want done. Regards Pete
Avi8orJH Posted August 28, 2008 Author Report Posted August 28, 2008 That's a very gracious offer Pete, thank you. I have attached the FSUIPC.log (zipped). From monitoring IPC:0D0C(U16), I see that off= 0x40, pulse=0xC8, and steady=0x1C8 I've also included the Dakota manual for reference. Page 5-4 has a picture of the switch panel as well as a description of the Pulse light system. I do have the SDK and the offsets list. It's like learning a third language though, and is taking some time to comprehend given my lack of programming experience. I suggested that perhaps a new offset would need to be created because, as the Advanced user manual states, each entry can contain a single condition. Using 0BE0,>0 and 0366,>0 would be two conditions. I was looking at an either/or scenario with neither being dependent on the other; e.g. if I am on the ground, I would toggle between the off and steady state. Likewise on approach when I extend the flaps. Once airborne and cleaned up, I would toggle the switch to either off or pulse as conditions warrant. This would require 0366,0 right? I don't expect any switch state change to occur until I toggle the switch with the keypress. In other words, I don't want the system to change automatically from steady to pulse when my wheels leave the ground. They should remain steady until I toggle the switch. The same applies to the extension of flaps. The lights should remain off or on pulse until I activate the switch. This switch will be mapped to Shift-T. As I mentioned earlier, if this should prove too problematic, I would certainly be content if I could use a single key combination to toggle through the three positions of the switch without condition. I hope this all makes sense. I spent most of the day at our Democratic National Convention here in Denver and I've been awake for a bit better than 30 hours now. I may be getting a bit loopy. At least I can say that for four days of my life, I lived in the safest, most secure city on the planet :lol: . I recognize that this is alot of trouble to go to for one switch on one aircraft but, it's the only switch on this plane which requires my use of the mouse. If it is possible to do as I suggest, it would be my one perfect aircraft. I apologize for my verbosity but, I wanted to be as clear as possible. Brevity was never my strong suit. :oops: :) Once again, thank you. Best Regards, Jeff FSUIPC.1.zip DreamFleet Dakota Orientation Manual.zip
Pete Dowson Posted August 28, 2008 Report Posted August 28, 2008 From monitoring IPC:0D0C(U16), I see that off= 0x40, pulse=0xC8, and steady=0x1C8 And what about when it is off? That's important to know too as all those bits are totally unrelated to any strobes in FS. 0x0C8 means wing, recognition and taxi lights are on, all others off. 0x1C8 merely adds the Logo light. The FS strobe light switch is bit 4 (0x010), which isn't being touched!! Seems that your aircraft does not use FS strobes at all, but steals the Logo light for steadying one of the others it is also 'stealing' (but we don't know which one from the above). Weird. I've also included the Dakota manual for reference.Page 5-4 has a picture of the switch panel as well as a description of the Pulse light system. Sorry, I don't really want to go into any of that (and the ZIpped "manual" is in fact only a Zipped Link of some kind, which I'm certainly not following!) I only offered to advise you on how to edit the parameters in the INI. ;-) I suggested that perhaps a new offset would need to be created because, as the Advanced user manual states, each entry can contain a single condition. Using 0BE0,>0 and 0366,>0 would be two conditions. Oh, I thought it was an either/or. It could get mightily more complicated to do combinations. It can't really be done with a user offset with Keys. You'd have to make the Key toggle a virtual button (see offset 3340) and program the button instead. Is the keypress acting like a toggle switch? i.e. can the "press" and "release" be programmed separately for "on" and "off" states? Or is is a real keypress and release like a normal keyboard? It makes a lot of difference. You might want to wait until I've finished adding the Lua programming interpreter to FSUIPC. Are you using FSX or FS9? The FSX version of Lua programming facilities will be reading in a couple of weeks or so, I hope. FS9 much later if at all. See http://www.lua.org I don't expect any switch state change to occur until I toggle the switch with the keypress. In other words, I don't want the system to change automatically from steady to pulse when my wheels leave the ground. They should remain steady until I toggle the switch. Things never happen on their own no matter how you program them. The instigation of anything happening is a change of button or key state, nothing else. I would certainly be content if I could use a single key combination to toggle through the three positions of the switch without condition. Why not do that then -- if you know the changes in the 0D0C offset you can program the key to change 0d0C based on the appropriate 0D0C bits! I could tell you the actual sequence, the paramters to use, if I know what 0D0C looked like with the strobes off. Regards Pete
Avi8orJH Posted August 29, 2008 Author Report Posted August 29, 2008 And what about when it is off? That's important to know too as all those bits are totally unrelated to any strobes in FS. 0x0C8 means wing, recognition and taxi lights are on, all others off. 0x1C8 merely adds the Logo light. The FS strobe light switch is bit 4 (0x010), which isn't being touched!!Seems that your aircraft does not use FS strobes at all, but steals the Logo light for steadying one of the others it is also 'stealing' (but we don't know which one from the above). Weird. This is not a strobe light, as I mentioned before in this thread. This is from the AC manual: "10. Pulse Lights Switch: The Dakota is equipped with Precise Flight Pulse Lights ® in the wingtips. The Pulse position is used only in the air for collision avoidance, and the steady position may be used on the ground to supplement the landing light." This is modeling a real world AC light system. It is essentially a taxi light system. The strobes, bit 4, are a different switch. I think your questions have pointed me in the right direction though. It apperars that this is simply toggling all three simultaneously. Toggling between off and the steady position, the Taxi lights, wing lights , and logo lights are all toggled: 1254078 System time = 17:07:31, FS2004 time = 13:47:45 (17:47Z) 1266594 *** EVENT: Cntrl= 66240 (0x000102c0), Param= 1 (0x00000001) TOGGLE_TAXI_LIGHTS 1266594 *** EVENT: Cntrl= 66378 (0x0001034a), Param= 1 (0x00000001) TOGGLE_WING_LIGHTS From Off to steady 1266594 *** EVENT: Cntrl= 66376 (0x00010348), Param= 1 (0x00000001) TOGGLE_LOGO_LIGHTS 1426406 *** EVENT: Cntrl= 66240 (0x000102c0), Param= 0 (0x00000000) TOGGLE_TAXI_LIGHTS 1426406 *** EVENT: Cntrl= 66376 (0x00010348), Param= 0 (0x00000000) TOGGLE_LOGO_LIGHTS From Steady to Off 1426406 *** EVENT: Cntrl= 66378 (0x0001034a), Param= 0 (0x00000000) TOGGLE_WING_LIGHTS The Off position returns 0D0C (U16)=0x40 The Steady position returns 0D0C (U16)=0x1C8 Now, moving from off to Pulse is where it gets weird. What's hapening is that the system uses a combination of the wing lights (bit 7) and the logo lights (bit_8). 1728922 *** EVENT: Cntrl= 66240 (0x000102c0), Param= 1 (0x00000001) TOGGLE_TAXI_LIGHTS 1728922 *** EVENT: Cntrl= 66376 (0x00010348), Param= 1 (0x00000001) TOGGLE_LOGO_LIGHTS 1730109 *** EVENT: Cntrl= 66378 (0x0001034a), Param= 0 (0x00000000) TOGGLE_WING_LIGHTS 1730109 *** EVENT: Cntrl= 66376 (0x00010348), Param= 1 (0x00000001) TOGGLE_LOGO_LIGHTS 1731125 *** EVENT: Cntrl= 66378 (0x0001034a), Param= 1 (0x00000001) TOGGLE_WING_LIGHTS From Off to Pulse 1731125 *** EVENT: Cntrl= 66376 (0x00010348), Param= 0 (0x00000000) TOGGLE_LOGO_LIGHTS 1732125 *** EVENT: Cntrl= 66378 (0x0001034a), Param= 0 (0x00000000) TOGGLE_WING_LIGHTS 1732125 *** EVENT: Cntrl= 66376 (0x00010348), Param= 1 (0x00000001) TOGGLE_LOGO_LIGHTS 1733125 *** EVENT: Cntrl= 66378 (0x0001034a), Param= 1 (0x00000001) TOGGLE_WING_LIGHTS 1733125 *** EVENT: Cntrl= 66376 (0x00010348), Param= 0 (0x00000000) TOGGLE_LOGO_LIGHTS and the 0D0C cycles between 0D0C (U16)=0x148 and 0D0C (U16)=0xC8 It also continues to generate event codes as long as the switch is in this position so, my hypothesis is that the Pulse lights are programed to automatically switch between the wing lights and the logo lights. It seems the pulsing effect is accomplished by programing one wing with the logo light and the other wing with the wing light, and then alternately turning them on and off at the same time. My conclusion is that it is not possible to do what I envisioned. I may have a workaround so I'll try that next. Sorry, I don't really want to go into any of that (and the ZIpped "manual" is in fact only a Zipped Link of some kind, which I'm certainly not following!)I only offered to advise you on how to edit the parameters in the INI. My turn for Mea Culpe. I inadvertantly zipped the shortcut as opposed to the actual file. Sorry. I wouldn't open a link that looked like it was pointing to something in my system either. :) I never expected that you would do it for me. I included (tried to) the manual only for your reference. You asked that I be exact in my desires and I wanted to include all the info I had. Why not do that then -- if you know the changes in the 0D0C offset you can program the key to change 0d0C based on the appropriate 0D0C bits! I could tell you the actual sequence, the paramters to use, if I know what 0D0C looked like with the strobes off. The way this switch appears to be programmed, I would say that even this is not possible. Would you agree with that assesment? I appreciate all your help Pete. I have learned a great deal in the last couple of days. Particularly about the inner workings of FSUIPC. Best Regards, Jeff
Pete Dowson Posted August 29, 2008 Report Posted August 29, 2008 The Off position returns 0D0C (U16)=0x40 The Steady position returns 0D0C (U16)=0x1C8 Okay, so that change is by "Offset Word Togglebits" with a parameter of x0188. and the 0D0C cycles between 0D0C (U16)=0x148 and 0D0C (U16)=0xC8It also continues to generate event codes as long as the switch is in this position so, my hypothesis is that the Pulse lights are programed to automatically switch between the wing lights and the logo lights. It seems the pulsing effect is accomplished by programing one wing with the logo light and the other wing with the wing light, and then alternately turning them on and off at the same time. Ah, not something we can do just by fiddling with bits once -- unless setting it to x0148 or x00C8 "triggers" the panel code to start the sequence? I assume this is programmed in the Gauge based on the switch position. So you probably need to operate the switches. Does the mouse macro facility operate on that at all? My conclusion is that it is not possible to do what I envisioned. Well, at least not in the way you thought.you have to get the add-on panel code to do the work. The way this switch appears to be programmed, I would say that even this is not possible. Would you agree with that assesment? Yes, assuming that you cannot operate the cockpit switch to make it happen. If you did need to actually do that bit flipping continuously yourself, you could actually do that with a new programming interface I'm adding at present -- a LUA interpreter, in fact. But at present I'm only doing it for FSX, i.e. in FSUIPC4. I may add it to FSUIPC3 later depending on the response I get. Regards Pete
Avi8orJH Posted August 29, 2008 Author Report Posted August 29, 2008 Okay, so that change is by "Offset Word Togglebits" with a parameter of x0188. Ah, the light finally dawns on my marble head. Honest to God Pete, that one sentence affected a paradigm shift in my understanding of how all of this is working. :D I hadn't realized that you could change the conditions of the offset by toggling the bits on the fly. I thought that once a bit was set, that was the end of it. Well, that confirms that I am not programming literate. Actually, it's rather embarassing. :oops: I'm not even sure that I'm communicating my understanding effectively. As I tell my kids, you'll know you've reached the limit of your knowledge not when you don't know the answer, but when you can't even figure out the question. Time for me to hit the books again. Ah, not something we can do just by fiddling with bits once -- unless setting it to x0148 or x00C8 "triggers" the panel code to start the sequence? I assume this is programmed in the Gauge based on the switch position. So you probably need to operate the switches. Does the mouse macro facility operate on that at all? Yes it does. My workaround involves just that. By creating one macro that moves the switch down and another that moves the switch up, I can go back and forth as necessary. The only downside is it requires the use of two key combinations instead of one. It's a compromise I can live with though. I think it may be the "taxi light" that actually triggers the code. Reason being is that the Taxi lights are toggled to on as the first event when the switch is moved from off to pulse, but are never toggled off during the sequence of events. It's also interesting that while the taxi lights are clearly being used, the normal taxi light command does not operate the switch in any way. Yes, assuming that you cannot operate the cockpit switch to make it happen. If you did need to actually do that bit flipping continuously yourself, you could actually do that with a new programming interface I'm adding at present -- a LUA interpreter, in fact. But at present I'm only doing it for FSX, i.e. in FSUIPC4. I may add it to FSUIPC3 later depending on the response I get.] Well, my response is that I would love to see it for v3.xx. That said, I certainly don't live in a vacuum, and I understand that the focus needs to be on the most recent version. If the two platforms were similar I suppose it would be easy. For one man to try to keep up with two vastly different platforms at the same time seems an awful lot of work when active development for one of them is slowing down. The thought of another new version of FS in a year or so, likely with zero backwards compatibility, must keep you up nights. I guess you're hoping that simconnect takes the reins for once and all in FSXI. At any rate, I consider my issues resolved. I thank you one last time for all your help and patience. You're a class act! Cheers, Jeff
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