Jump to content
The simFlight Network Forums

guenseli

Moderators
  • Posts

    464
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by guenseli

  1. Because of several questions I have decided to write a little tutorial for this people which want to assign their custom key commands via FSUIPC using LVARs or just the logging.

    In the example screenshots you see the logging and assigning of the PMDG MD11X. Of course the principle for other addons is the same.

    The hole work is just try and error!

    What you need:

    1) patience

    2) registered version of FSUIPC and the latest update

    3) Lua Plug-In documents and examples

    2 and 3 is available here at Pete's site: look at Updates and other goodies

    unpack the "Lua Plug-In documents and examples" into your X:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules Folder.

    Important is the file "log lvars.lua"

    Start FS, start a flight and load your addon you'd like to dissect

    Part 1: logging via logging window

    logging2.jpg

    Open FSUIPC menu and check "Button and Key operations" and "Events".

    Also check "Send to console window".

    There will immediately open up a new window.

    If you close FSUIPC menue now you will see (if you have two monitors :wink: ) in the logging window that several lines appear - depends on the aircraft addon; it could be that many lines appear very fast, but doesn't matter.

    Now make any action you want . You will have a response in the logging window.

    screen1g.jpg

    In the example above I have pressed the waypoints knob in the MD11.

    The reaction in the logging window was the event line which I have green highlighted.

    You can read now the controls number (66587 - you will finde these numbers in the PDF "List of FSX controls"), maybe a parameter number (71128) and the expression for the controls number: ROTOR_BRAKE

    If there will appear many logging lines very fast you can pause logging by entering FSUIPC menu.

    You can scroll the logging window to find your command.

    Now you know the command and maybe a paramter and you can use and assign it via FSUIPC menu:

    buttonwn.jpg

    Select the ROTOR_BRAKE and enter the paramter 71128

    :!: Note: there don't have to be parameter numbers, this could also be zero.

    It depends on the developer. With PMDG as example, they control the most functions via ROTOR_BRAKE, simply changing the paramters.

    As you can see in the picture, I can now press the waypoint button in the PMDG MD11 with my joystick E button 32.

    But what, if nothing happens in the logging window after you have pressed something?

    Part 2: Logging via LUA Vars

    First, assign two keys:

    log1.jpg

    log2.jpg

    Assign one key (or button if you want) to "Lua Log Lvars" (e.g. F5)

    (Thats the way you call a LUA file)

    Assign an other key to "Luakillall" to stop the LUA programm.

    Now go back to FS and press F5: a window opens in FS and like with the logging window there will show up several lines.

    (don't forget to check "LUA program logging" in FSUIPC menu)

    luadisplay.jpg

    The difference is, that you will see now LUA Variables.

    Now, same way, press some knob or switch in the addon and see what happens.

    But it will be hard to read that out of the small window, so end the LUA (press the assigned F6).

    Go to your modules folder and look for this file

    dateien.jpg

    log lavars.log

    open it with editor or wordpad and you will see endless lines of codes: the LUA Variables!

    Now, the search begins...

    But luckily the developers choose ligical names for the variables.

    e.g. L:pmdg_hide_yoke=1 means what?

    yes, rising and lowering the yoke

    You can't use this LUA variables in the same way like the above controls.

    One way is simply enter this Vars in a Macro:

    1=L:pmdg_hide_yoke=tog

    Or you make a LUA file wich means you enter this line into an empty wordpad document:

    ipc.writeLvar("L:pmdg_hide_yoke", 1)

    name this file "hide yoke.LUA"

    You can now assign a button or key to it by choosing it from FSUIPC menu under "Lua hide yoke"

    Note: this only let the yoke move down (1).

    :!: This should be just a simple example how you can use LUA.

    For effective working with it you have to read something about LUA programming, starting with it in Pete's FSUIPC forum and the several PDFs provided there.

    It depends on the developers if and how many LUA they use or what you can find in the logging window (part 1).

    It could also be that both is used, so for example in the PMDG J41 some knobs are controlled via LUA variables and the sounds for this knobs are made with ROTOR_BRAKE parameters.

    As I stated above: you need patience and a lot of trial and error :!:

    Try FSUIPC genious mouse macros before (explained in the manual)

    The method with logging and LUA is just for the case you can't get any commands out of a addon in other ways.

    And: do everything at your own risk! :wink:

    Have fun and may the force (of FSUIPC) with you!!

    Guenter

    --------------------

    Hi Pete,

    feel free to correct and complete this little tut...

    • Like 1
  2. Thanks for the fast reply!!

    And its working!

    Here's the final coding for the MD11X ND Mode cycle

    110=117,26,x510066C0,x00040001 ;ND Mode increase start
    111=B66C0=0 117,26,66587,71132 
    112=B66C0=1 117,26,66587,71133 
    113=B66C0=2 117,26,66587,71134 
    114=B66C0=3 117,26,66587,71135 
    115=B66C0=4 117,26,66587,71136 ;ND Mode increase end
    116=115,26,x610066C0,x00040001 ;ND Mode decrease start
    117=B66C0=0 115,26,66587,71132 
    118=B66C0=1 115,26,66587,71133 
    119=B66C0=2 115,26,66587,71134 
    120=B66C0=3 115,26,66587,71135 
    121=B66C0=4 115,26,66587,71136 ;ND Mode decrease end

    117,26 is Ctrl+Tab+F6. I assume that's what you programmed the device to send?

    Yes, you're right.

    I also use the MCP Combo and as stated in the other threads here it is just able to send keystrokes via a keymanager.

    Joybuttons would be much better but what should we do...

    The Combo is a very good hardware if you consider the price and what you get.

    Of course GoFlight and all the high priced modules are better and far more realistic in design, but the MCP Combo works very well if you know how to tweak with FSUIPC ;-)

    Thank you very much Pete and thank you for your outstanding fast service again!!!

    p.s. I haven't forgot the "database", if you remember.

    In the next weeks I consider how to make it in the best way: maybe I will write PDFs for each aircraft where the codes and some explanings will be written down.

    Or I will make ZIPs with the MACRO and LUA Files... I will think about it

    But anyway it would be important to collect the hole codings together that not any user must start from beginning...

  3. Many thanks!

    I'm a big step closer....

    Just one problem left:

    I need the code for keystrokes not for buttons (unfortunately the MCP Combo couldn't give out joybuttons, just keystrokes)

    heres my code (just for increment):

    110=117,26,Cx510066C0,x00040001

    111=B66C0=0 117,26,C66587,71132

    112=B66C0=1 117,26,C66587,71133

    113=B66C0=2 117,26,C66587,71134

    114=B66C0=3 117,26,C66587,71135

    115=B66C0=4 117,26,C66587,71136

    I have tested it with buttons, adding a "P" and the button number and it was working very well.

    But my "simple" transforming for keystrokes isn't working.

    There must be obvisiously an error in my code...?

    Secod question.

    Is it right, that for decrement that code have to change to

    Cx610066C0,x00040001 ?

    thank you very much!

  4. Hello Pete,

    you know already about my programming (and logical) knowledge :oops:

    I'm searching now for an code to assign a rotary knob.

    As many (all?) airliners the PMDG MD11 has also some functions to show datas on the ND: MAP, PLAN, VOR, APPR, TCAS

    I have now the VRInsight Combo with a rotary switch which I'd like to assign to all this functions (if possible)

    The rotary knob does nothing more than give out a signal if you turn right and a signal if you turn left.

    The MD11 ND mode functions are all commanded via the ROTOR_BRAKE parameter, e.g. MAP mode is ipc.control(66587, 71132), APPR is ipc.control(66587, 71135) and so on.

    Could you please help me how I could make a kind of counter which switches through the ipc.control parameter up when rotating the knob to the right and down when rotating to the left?

    Any kind of similar counters I have programmed till now have had some kind of value which I was able to read out (ipc.readLvar) and then I counted up from this variables... but with this I have no clue.

    The problem is that I can of course always start a counter up from 1, but that means whenever the rotary knob will be used, the ND modes begins from start.

    E.g. if you are currently in VOR and want to the next APPR, then the counter begins from 1 and you go from MAP, PLAN, VOR to APPR...

    Do you think there is a solution?

    Thank you very much,

    Guenter

  5. These are with separate little Lua programs, one for each function?

    Not one for each function. I have separated the part which is working (all the normal switches)

    And then I have the three party for the Sperry AP in one LUA.

    I have disabled now this LUA.

    If so, I think you need to do it the other way I suggested: accumulating changes and sending them to the L:var in measured doses, limiting it to a speed it can cope with. It does really sound like something is getting corrupted by re-entry.

    Yes, that sounds logical, but I haven't the knowledge about it.

    And as I said it isn't sooooo much important :lol:

    The LUA functions "helped" me now in may ways with many addons.

    I hope I can get a Universal Joystick Controller BU0836X the next weeks and build up a little switch panel for all the nice functions I have created ;-)

  6. No they don't work... FSX is freezing again.

    Ok, doesn't matter!

    I will throw out this codelines and everybody have to hand-dial the rotary knobs...

    btw: the same commands worl with the PMDG J41 without problems.

    So I slightly come to the conclusion that sth must be hiccup inside the Catalina codes....

    Anyway,

    thanks and a good evening!

  7. Hello Pete,

    I have now reworked my complete code with the kind of smarter coding of your example...

    Thats the difference between a good programmer and me: I don't have these ideas y myself :?

    Also I have made for the AP rotaring functions a extra LUA file so if they don't work I will delete them, forget them and command the rotary switches with the mouse again....

    BUT:

    I haven't made exzessive testing with it, but it seems that it will work now with smarter codes...

    We will see...

    Thank you very much for your effort!!!!

  8. okay, maybe we're now a little step further...

    I'm sure now that the issue is in my code or in the Aerosoft Catalina (or maybe in FSUIPC)...

    But not in the VRInsight stuff, sorry that I have thought this, Andy...

    I have some LUA codes programmed and here the FSX freezes after a while.

    Then I have restarted FSX and tried the LUA file with the standard beech baron, which ended in a freeze, too.

    Then I coded just the little single line from above to test, restated FSX and ended with a freeze, too.

    That was the point I come back to this thread yesterday...

    I now found out, that the error is somewhere "stored" and is present after starting FSX after the crash.

    That was the big mistake in my thoughts... so every restart of FSX doesn't have eliminated the issue (whatever it is)

    I have to completely log out or completely restart my PC that the issue is away.

    Then the little LUA testfile (hdg bug inc) runs without any issues, even with joybuttons or keyboard or MCP Combo.

    Yesterday I have never restarted my whole computer, because I have thought a terminated FSX is enough.

    OK, I have sent you the FSUIPC.log via mail. Hope this is ok...otherwise delete it...

    Below is the LUA code segment wich is causing the error.

    Some little explanations:

    It is for the Aerosoft Catalina which is having nearly no keycommands.

    The part below is for the special Autopilot. it is a very good replica of an old, hydraulic or pressure driven sperry AP.

    But the other side is, that the normal AP commands will not work.

    If you can find here an obvisous error in my code or some part which could cause this issue, then please correct me.

    Or you have an other idea...

    But we shouldn't waste our times too long.

    The worst case is, that the Catalinas Sperry AP couldn't be managed with keycommands, just with the mouse in the VC.

    And that isn't a great tragedy...

    thank you very much!

    guenter

    
    
    
    
    -- Sperry Pitch Inc (down)
    if ipcPARAM == 22 then
    
    
    SPVar = ipc.readLvar("L:Sperry_pitch_set")
    
    	SPVarInc = SPVar + 0.25
    
    	if SPVarInc 	ipc.writeLvar("L:Sperry_pitch_set", SPVarInc)
    
    	elseif SPVarInc == 12 then
    	end
    
    -- Sperry Pitch Dec (up)
    elseif ipcPARAM == 23 then
    
    
    SPVar = ipc.readLvar("L:Sperry_pitch_set")
    
    	SPVarDec = SPVar - 0.25
    
    	if SPVarDec > -12 then
    	ipc.writeLvar("L:Sperry_pitch_set", SPVarDec)
    
    	elseif SPVarDec == -12 then
    	end
    
    
    
    -- Sperry Gain Elevator ON/OFF (value 3.5)
    elseif ipcPARAM == 24 then
    
    GEVar = ipc.readLvar("L:Sperry_gain_elevator")
    
    	if GEVar 	ipc.writeLvar("L:Sperry_gain_elevator", 44)
    
    	elseif GEVar > 0 then
    	ipc.writeLvar("L:Sperry_gain_elevator", 0)
    
    	end
    
    
    
    -- Sperry Bank Inc (left)
    elseif ipcPARAM == 25 then
    
    SBVar = ipc.readLvar("L:Cat_Desired_Bank")
    
    	SBVarInc = SBVar + 1
    
    	if SBVarInc 	ipc.writeLvar("L:Cat_Desired_Bank", SBVarInc)
    
    	elseif SBVarInc == 26 then
    	end
    
    -- Sperry Bank Dec (right)
    elseif ipcPARAM == 26 then
    
    SBVar = ipc.readLvar("L:Cat_Desired_Bank")
    
    	SBVarDec = SBVar - 1
    
    	if SBVarDec >= -26 then
    	ipc.writeLvar("L:Cat_Desired_Bank", SBVarDec)
    
    	elseif SBVarDec == -26 then
    	end
    
    -- Sperry Gain Aileron ON/OFF (value 3.5)
    elseif ipcPARAM == 27 then
    
    GAVar = ipc.readLvar("L:Sperry_gain_aileron")
    
    	if GAVar 	ipc.writeLvar("L:Sperry_gain_aileron", 44)
    
    	elseif GAVar > 0 then
    	ipc.writeLvar("L:Sperry_gain_aileron", 0)
    
    	end
    
    
    
    
    -- Sperry HDG Inc (left)
    elseif ipcPARAM == 28 then
    
    SAVar = ipc.readLvar("L:Desired_Heading")
    
    	SAVarInc = SAVar + 2
    
    	if SAVarInc 	ipc.writeLvar("L:Desired_Heading", SAVarInc)
    
    	elseif SAVarInc >= 360 then SAVarDec = 1
    	ipc.writeLvar("L:Desired_Heading", SAVarDec)
    
    	end
    
    -- Sperry HDG Dec (right)
    elseif ipcPARAM == 29 then
    
    SAVar = ipc.readLvar("L:Desired_Heading")
    
    	SAVarDec = SAVar - 2
    
    	if SAVarDec >= 0 then
    	ipc.writeLvar("L:Desired_Heading", SAVarDec)
    
    	elseif SAVarDec 	ipc.writeLvar("L:Desired_Heading", SAVarDec)
    
    	end
    
    -- Sperry Gain Rudder ON/OFF (value 3.5)
    elseif ipcPARAM == 30 then
    
    GRVar = ipc.readLvar("L:Sperry_gain_rudder")
    
    	if GRVar 	ipc.writeLvar("L:Sperry_gain_rudder", 44)
    
    	elseif GRVar > 0 then
    	ipc.writeLvar("L:Sperry_gain_rudder", 0)
    
    	end
    
    
    
    
    
    end
    

  9. Hello Pete,

    I can reproduce the error again....

    This is the situation:

    code inside the LUA file:

    ipc.control(65879)

    (HDG Bug inc - just simple, just for testing)

    aircraft: default Beech Baron

    Joystickbutton or direct key input is working (the key is TAB+F9)

    BUT: I have the MCP Combo from VRInsight.

    There's a keymapper where you can assign keystrokes to the combo and then get this keystroke into FS.

    This is why I get the TAB+F9 keycombination. (theres no other possibility unfortunately)

    Now when I rotate with the HDG knob of the MCP Combo (which means fast repeated TAB+F9) the FSX is freezing after few seconds.

    Like the same what we had at the beginning of this thread way back.

    Hold a button pressed or holding down the keys does not produce the hangup.

    Just the rotation with the HDG knob...

    So, I know that must be fault with the Combo or the way the combo acts with keystrokes and communicates with FSUIPC or whatever...

    I just write this to inform you, and maybe you have an idea.

    I will write now into the VRInsight forum this problem, where Andydigitl could help me, hopefully.

    I will report back...

  10. Oh, Sorry... FSUIPC Version is 4.548

    The Lua file is the same file as in the initial thread It only contains

    ipc.control(65879)

    (HDG Bug inc)

    My normal file has an other code, but like I stated in the initial thread FSX also crashes with a standard plane and this simple code.

    Do you mean multiple Lua executions of the same program through repetition?

    Yes I mean that....

    It is a little bit confusing to me now...

    Right now I can't reproduce the error :roll:

    Before it was every time...

    So, don't waste your mind about that...

    I just wanted to be sure that the fix of that problem wasn't get lost with the last update.

    If I can definitely reproduce again it I will post again here.

    Strange things happen with all this machines... ;-)

  11. Hello Pete,

    I use the Autosave feature and have the settings for two saved flights.

    But in the PMDG/MD11/panelstate folder I have after two days countless (83) Autosaves from FSUIPC.

    They all named "AutoSave day date time.FLT.0.slv.rte"

    Same with the A2A Addons I think as I have several files named "AutoSave day date time.377" in the documents/Flight Simulator X Files folder.

    I can delete them every few days of course, but is there a possibility that this files could automatically get deleted with FSUIPC?

    Thanks,

    guenter

  12. Hello,

    i have a wish concerning the weather in FSC.

    The option to download the actual weather is wonderful, but I come to the idea that I'd like to see my historical Active Sky weather, too.

    As Active Sky is able to use historical weather, the actual weather in FSC does not match.

    TOPCAT is able to load its data from the ASA weather, no matter if ASA is showing historical or actual weather; its just the weather which is provided by ASA.

    This is possible, because you can choose in TOPCAT the current_wx_snapshot.txt file which contains the actual loaded ASA weather - historical or whatever.

    So, I have thought, when TOPCAT is able to that, FSC should be able to do the same :lol:

    Do you think this could be implemented?

    thanks, Günter Steiner

  13. Hello Pete,

    the first post of you is exactly what I'm fear of: that you throw me out of your forum one day :lol:

    Just kidding... hopefully not.

    I'm very happy, that you changed your mind and found a solution.

    Why I want to do this?

    Because the fascinating PMDg J41 has no well working key command solution and with FSUIPC everything is possible.

    And the LUA thing allows me to combine things, which just work with macros and things just working with LUA Vars.

    Till now everything works fine, because that where just simple buttons.

    But the heading bug is aomething you have to hold a key or button pressed.

    And thet was then the situation when FSX crashed.

    The example above with the heading bug, is just a simple example to show you that it has nothing to do with the J41 or or with my "special" codes.

    I hope, you understand me now a little bit.

    Unfortunately, when I want to download the update I get an error:

    The requested URL /beta/FSUIPC4545.zip was not found on this server.

    And please be sure, that, whatever I ask you, you never have to present me the solution as fast as possible.

    Your support is outstanding and the fastest I know.

    And I feel a little guilty to see you work in night and sundays...

    So, I hope you have a little fun with your work.

    And I have to thank you a lot!

  14. Hello,

    I found something strange...

    It happend during my J41 command assigenments.

    Now I have tested it also with a normal standard FSX plane and simple LUA commands

    if you'd like to execute a LUA file with holding the buttons or keys down, then FSX will hang and crash.

    i have a LUA test file created, just with this simple entry:

    ipc.control(65879)

    (it is heading bug increase)

    Now, if you assign this LUA file to a Joy button or a key and hold the button or key down to let the heading bug move, FSX crashes after 5 to 30 seconds...

    If you assign the normal heading_bug_increase via FSUIPC, there's everything normal as it should.

    Can you confirm this?

    Or it it as always, that something in my system is faulty or I have made something wrong? :lol:

    guenter

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.