October 12, 201114 yr F1HDG = ipc.writeLvar("ApHdgKnob", F1HDG) Hi Günter, I wonder about this row.In Pete's FSUIPC Lua Library.pdf I read:ipc.writeLvar(“name”, n)[Not WideClient]This writes to the FS local panel variable called "name". These are L: <name> values. You can provide the L: part explicitly or leave it out.If the variable is not currently available, nothing happens.So I don't understand the "F1HDG="-Part in this row of your script. With kind regardsRoland PohlVice chairman FSC e.V.
October 12, 201114 yr Author Hi Roland, I also wondered this as I have not seen it referenced like this anywhere else by anyone else... unless it's a way of making the "new" value the "current" value by writing it out with the increased value at the same time.... Does that makes sense? Either way, it seems to work quite nicely. Kind regards, James Gillies
October 12, 201114 yr No, guys this is an error: must be just ipc.writeLvar("ApHdgKnob", F1HDG) sorry -----James, about the loop.Yes you are right we need to reset the loop.This is a bit of a homework for you, I thoughtthat was what I meant in a thread above You have to program a counter for these kind of switches like "read knob state add +1 to the knob state write knob state if knob state is 100 then begin from zero" You can always have a look into the NGX script or the JS41 as Artem has created there if ... then loop in the most efficient way. And don't be too concerned about the values of the knob. it doesn't matter if its 5, 10, 15 or 4, 9, 14It is simply the position of the 3D model of the knob so, a loop should look likefunction F1Must_HDG_inc () F1HDG = ipc.readLvar("ApHdgKnob") F1HDG = F1HDG + 5 if F1HDG >= 100 then F1HDG = 0 end ipc.writeLvar("ApHdgKnob", F1HDG) ipc.control(65879) ipc.control(65823, 4) -- knob sound ipc.control(65823, 0) -- knob soundend And a fast dial function simply is the same but increasing speed with F1HDG = F1HDG + 15 or whatever value you think make sense ... ----disclaimer: the code is writen out of my mind and is not tested. Hope it works ...But I think you'll see the principle behind ... Guenter Steiner -------------------------------------------------------------------------------------- Betatester for: A2A, LORBY, FSR-Pillow Tester --------------------------------------------------------------------------------------
October 12, 201114 yr Author Hi Günter, So I've just figured out how to type a u with an umlaut on my keyboard without a numeric keypad (laptop) ! OK - I understand how to create the loops now, thank you... so I will do some experimenting and will let you know how it goes. When I have something I think will work properly perhaps you could test it for me to confirm that it works the way you would envisage? I do have a quick thought about the quick dial though - in this case the actual value is control by the FSX Control - which itself doesn't have a number associated with it, it's either "Inc" or "Dec"... so we can't just "increase" the *number* as it were... In this scenario do we just say "OK, you can't do fast dial" or do we simply add more FSX Controls to the same function to simulate asking for a faster dial? Or do we just try it and see what works? Sorry for all the questions, as you can see I am trying to nail the ground rules to stop me guessing too much and going down too many rabbit holes! I'll let you know how I get on. Kind regards, James Gillies
October 13, 201114 yr Author Hi Günter, So I've got a nice HDG knob turning backwards and forwards slow and fast (I figured out some logic) - all very good! I've also got the Knob in the VC turning correctly too, so I'm happy with that... however: I've now been looking at how to get the HDG display to match the current value that is shown in FSX for the Heading Bug. I am nearly there in that I can get a value to show using: DspHDG - but as that function only lets me set an integer I cannot get it to "read" the current value. I tried looking at: DspHDGs and I did manage to get it to read in the LVar for the HDG knob - which was kind of cool but obviously not what I was looking to do! So after playing around for a couple of hours I need to stop here and come back to it. What's confused me is that I was sure that the NGX 737 module woud let me do this.... I've tried using some of that modules code for another 45 minutes but no joy so far. It's quite late now so I am goign to stop and will look at this again tomorrow. Cheers James
October 13, 201114 yr Ji James, yes, I forgot about the quick dialing, that we need to repeat the FSX control a few times then, of course!Glad you solved it! Great!(how to achieve a repeat doesn't matter; you can make something with a counter or simply copy the control a few times) Especially for the HDG, it does already match with the MCP as the Mustang uses obvisiously default offsets for that.Just the ALT is not working. DspHDG is only a function to send something to the MCP Combo Display.If you want an oversight of the display functions, please have a look at the end of the FAQ which I have currently updated.(it is for LINDA 1.1, but all functions for MCP1 should work also with 1.03) If you want play around with the Display a bit, just insert in a function. DspShow("test", " ok ") the other sections (SPD, HDG, ALT) do just work with integers. Guenter Steiner -------------------------------------------------------------------------------------- Betatester for: A2A, LORBY, FSR-Pillow Tester --------------------------------------------------------------------------------------
October 13, 201114 yr Author Hi Günter, So I've played with this for another hour today and I think the simplest thing might be for my LINDA module to be able to get the same feedback from the Lua plugin as when the native buttion is pressed in the VC. For example, I can mimick the HDG Knob quite well, both from an LVars perspective and an FSX Control perspective. What I cannot seem to do is to keep the MCP Combo HDG display in sync with the setting shown in the VC. However, the MCP Combo is definitley being "fed" this information from the Lua plugin (whatever that is?) because if you press the HDG Knob in the VC you immediatley get the correct value displayed on the MCP Combo. So really all I need to get my function to do is to not only send the command that the native add-on is doing (in this case HEADING_BUG_INC / 65789 - 0) but also retrieve the current value from the Lua plugin to confirm that they are aligned/synced. Because at the moment although it works it is very easy for the MCP Combo HDG display to "go ahead" of the real value in the VC, which is quite confusing - so I need to build in a function that "watches" this value. I did have a play with the DspShow and DspHDG and DspHDGs functions - I think there is a limitation in not being able to provide a string in Mode 1 for DspHDGs, it might have helped in this situation. As I start to understand more I suspect that it might have been easier if Flight1 had provided dedicated LVars for the SPD, HDG and ALT displays? (A bit like the 737NGX?) I hope this makes sense, I feel another lesson coming on! Thanks very much. Kind regards, James Gillies
October 13, 201114 yr Author Hi Günter, Another thought. Where you say "Especially for the HDG, it does already match with the MCP as the Mustang uses obvisiously default offsets for that. Just the ALT is not working." In my version of LINDA there is no Default FSX library entry for "HDG Show" I've got: Lib: Default FSX -> Rotaries Functions -> HDG PlusLib: Default FSX -> Rotaries Functions -> HDG PlusfastLib: Default FSX -> Rotaries Functions -> HDG MinusLib: Default FSX -> Rotaries Functions -> HDG Minusfast But no: Lib: Default FSX -> Rotaries Functions -> HDG ShoworLib: Default FSX -> Rotaries Functions -> ALT Show However I do have: Lib: Default FSX -> Rotaries Functions -> CRS ShowLib: Default FSX -> Rotaries Functions -> SPD ShowLib: Default FSX -> Rotaries Functions -> VVS Show Does this makes any difference? At present my module has "SPD show" assigned, would that need to point at my function? (I think I may have just answered my own question here) Kind regards, James Gillies
October 13, 201114 yr I just checked it and I have also now HDG or ALT show.Don't ask me why, I have to ask Artem about.But doesn't matter if its working... Here on my side the HDG rotary is 100% synchronised between VC and MCP Combo... Does it work with default FSx planes for you?Then it should work with the Mustang, too DspSPDs(str), DspHDGs(str), DspALTs(str) , DspVVSs(str) is MCP2 only!!!As I can remember, you have a MCP Combo 1 ?!? I'm not quite sure if I understood all your questions so far ...Beleive me, we have no possibility to make Altitude synchronised between MCP and VC displays.HDG should work... So, any further engagement for this is obsolete... If I haven't answered something, please ask again! Guenter Steiner -------------------------------------------------------------------------------------- Betatester for: A2A, LORBY, FSR-Pillow Tester --------------------------------------------------------------------------------------
October 13, 201114 yr Author Hi Günter, Thanks for confirming this, I will have a closer look at my Module to see how to achieve this - exciting stuff! I believe in the rule of life that "if you don't ask you don't get" - so I've asked Jim Rhoads at Flight1 if he'd consider dusting down the code for the Mustang to give us a couple of extra LVars so that we can read in the various values - just like PMDG did for the 737NGX - I found it in the module last night and thought "Eureka!" There's a good chance that Jim will say "No chance" but I thought "Why not ask him?" DspSPDs(str), DspHDGs(str), DspALTs(str) , DspVVSs(str) is MCP2 only!!!As I can remember, you have a MCP Combo 1 ?!? - Yes this is true, I have a Combo 1. You are being very patient with all my questions, I realise that some of them will be pointless based on my lack of knowledge but I am prepared to put in the work to understand this more. Should I be looking at the offcial Lua programming guides or will that be a bit out of my range for the moment? Cheers Günter. James
October 13, 201114 yr You are being very patient with all my questions, many thanks!As I started with this useless, crazy stuff I was very happy that there where a few guys around and helped me also.And I see that you are not just guy which comes in and ask "how do I this or that" or "make this for me", but you try really to learn.That should be fully supported - more LUA freaks, more LINDA modules, less work for me Should I be looking at the offcial Lua programming guides or will that be a bit out of my range for the moment? I don't know if its even necessary. When I compare it to my "learning curve" it was more like looking at scripts from others or google a bit if there is a specific problem.What you should maybe do is look about "if ... then ... elseif","while ...do"and some stuff of this basic things. to be honest I'm not a big programer nor I'm very intelligent or creative at this stuff.So things I've learned once I use over and over not thinking about to make it easier or better.Artem is then the guy for knife-sharp efficient programming Guenter Steiner -------------------------------------------------------------------------------------- Betatester for: A2A, LORBY, FSR-Pillow Tester --------------------------------------------------------------------------------------
October 13, 201114 yr Author Cool, I will do. When it comes to making things better and more efficient I am a complete pain in the @rse - I'll always be thinking about ways to improve something - I can't help myself. So I'll do my homework on this for sure to get an initial understanding of how this stuff works and then start to get more advanced, A quick question on the HDG display if I may: When you say that your HDG display is synced using the FSX default I take it you mean the "SPD Show" setting against "Display" on the HDG Knob in LINDA? (I believe this is the setting used by the Default FSX Module) If so, when you say it's synced to the VC do you mean that it's synced to the HDG you are tracking or the Heading bug? I have been trying to read the value from the Heading Bug and have that show on my Combo...... Cheers James
October 14, 201114 yr Author Hi Günter, First things first - I have a fully synced HDG knob and it works lovely! (I took a copy of the Default FSX Library and am using it in my own module as a test for the moment.) I have been doing some more research today but this time with FSX Offsets and how they work, it's a different kettle of fish again! I found some Lua code written by a guy called Word Not Allowed, who was using Lua scripts leading up to the development of LINDA by Artem and yourself. Having looked at some of his examples I have been able to make some interesting progress with the ALT display..... it looks like the Mustang is using almost all default FSX Controls and quite a lot of FSX Offsets - so I have been playing with some functions like this: function setAPALT () -- (offset, value) --buffer = ipc.readUD(0x07D4)/65536*3.28/100 -- Not sure what this is buffer = ipc.readUD(0x3324)/65536 -- Not sure what this is com.write(dev, string.format("ALT%03d", math.ceil(buffer)),8 )end So I had a test function that was something like this: -- ALT Knob Inc Slow function F1Must_ALT_inc_slow () F1ALT = ipc.readLvar("ApAltSelKnob") F1ALT = F1ALT + 5 if F1ALT >= 100 then F1ALT = 0 end F1ALT = ipc.writeLvar("ApAltSelKnob", F1ALT) ipc.macro("FLIGHT1MUSTANG: Alt+100") buffer = ipc.readUD(0x07D)/65536*3.28/100 --buffer = ipc.readUD(0x07D0)/65536*3.28/100 com.write(dev, string.format("ALT%03d", math.ceil(buffer)),8 ) end What this would basically do is update the ALT dispay according to what the FSX Offset is telling it.. So for the actual change to the ALT number I am using an FSUIPC Mouse Macro (for now!) set to the small 100 feet increment for this function. I reckon instead of using an FSUIPC Mouse Macro I'll eventully be able to figure out how to send an ipc.control command that uses a parameter but that number is based on a "for if" statement itself. Here's what I got from Pete Dowsons FSX Offsets Manual: 07D0 4 Autopilot altitude lock07D4 4 Autopilot altitude value, as metres*655363324 4 This is the altimeter reading in feet (or metres, if the user is running with the preference for altitudes in metres), as a 32-bit signed integer. Please check offset 0C18 to determine when metres are used (0C18 contains ‗2‘). The same value can be calculated from the actual altitude and the difference between the QNH and the altimeter ―Kollsman‖pressure setting, but this value ensures agreement. So I am not sure which offset I should be using or even if it's one of these three - it also takes a little bit of time to see how you need to convert the number eg. /65536 or *3.28/100 etc etc - So you need to experiment I think until you see a value that either "makes sense" or matches what you are seeing in the VC. So far I am not sure what I am seeing, nor do I know how to program a function for the displays that just loops over and over - although I think I saw some clues in the 737NGX module that might help! I am convinced that this is progress of sorts, and thought I should bounce it off you in case you had any ideas on this front? Cheers James
October 14, 201114 yr James, I let you fiddle a bit at your own with this offsets, its a good learning for you ^_^07D4 is the right one to read out AP altimeter value. But it doesn't help for the Mustang as this addon uses for its ALT values in the PFD some diffrent secret values.But maybe you'll ind them by chance ... The stuff with com.write isn't needed as LINDA has this already implemented! function test ()DspALT(500)end will send a value to the Combo display!Behind the scene com.write is working so you'll make yourself a lot of useless work and will fight against LINDA eventually ^_^LINDA will win... What we need is a value from the Mustang which shows us the ALT value of the PFD!I haven't found it so far.To send this value to the Combo is easy... Have you got my PM??? Guenter Steiner -------------------------------------------------------------------------------------- Betatester for: A2A, LORBY, FSR-Pillow Tester --------------------------------------------------------------------------------------
October 14, 201114 yr Author HI Günter, Thanks for the information on this, I will bear it in mind when I look closer at the Offsets. I understand what you're saying about the com.write so I won't focus on that too much! I didn't see your PM until just now, thanks a lot, I will let you know how that goes with my testing. So I have a lot to learn and many things I am trying to look at at the same time! Like Yoda said: "No, no! There is no why... Nothing more will I teach you today. Clear your mind of questions..... hmmmm.... good... yes." I must go and train some more. Cheers! James
Create an account or sign in to comment