Jump to content
The simFlight Network Forums

Gypsy Baron

Members
  • Posts

    278
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by Gypsy Baron

  1. The '2nd quadrant' you connected via the connector on the yoke does not show up as a seperate controller

    but instead is 'part of' the Yoke.

     

    So, controller "2" above will include not only thr yoke axiz and buttons but also the newly connected quadrant

    axis and buttons.

     

    If you go to the FSUIPC4 Sitches and Buttons tab (or whatever it is labeled) and press a button on the

    newly connected quadrant you should see the number assigned to that button. If you assign a function

    to it it will show up in your INI file with the device #2 followed by the button number.

     

    I have letters assigned yo my Saitex Pro yoke and two throttle quads.

    "A" is the 'stand alone' USB connected quadrant and "D" is the Yoke and quadrant connected to it.

     

    My assignments shoq these numbers:

     

    Controller D - 14,15,16,17,18,19 for the 6 double throw momentaty switches  on the yoke-connected quad.

     

    Examples:

    2=PD,14,C66535,0 ;//TOGGLE MASTER IGNITION

    3=PD,15,C66023,0 ;//MAGS OFF

     

    Controller A - 0,1,2,3,4,5 for the 6 double throw momentaty switches  on the USB-connected quad.

     

    Examples:

    8=PA,0,C66129,0 ;//MAGNETO 2 INC

    9=PA,1,C66128,0 ;//MAGNETO 3 DEC

     

    Paul

  2. What/how are you opening the Lua Display window?

     

    I use the ipc.display function all the time to show me various items during flight. In doing so

    I use the form:

     

      ipc.display("Rud Pos = "..Rud_Trim, 1)

     

    This displays the current value of the rudder trim in one of my aircraft. The final parameter "1" indicates

    that the window will display for only 1 second.

     

    In some cases where I am displaying mutiple lines of data I leave the window open longer, 2 3 or 5 seconds.

    The window then closes.

     

    Another useful statement is:

     

      ipc.setdisplay(770, 50, 500, 100)  // X,Y, x, y    - Position X,Y and size x,y

     

    This dictates the screen position and size of the Lua Display window.

     

    As to forcing a close of the window, I THINK if you invoke another ipc.display command such

    as I showed above, it would force a closure of the current window. So displaying some 'dummy'

    parameter for 1 second should close the currnt window and display then 'dummy' parameter foor

    1 second and then close.

     

      Paul

  3. What C172 are you  flying? If it is the A2A C172, the walkaround feature uses CamaraDefinitions

    to implement that feature. There would probably be a conflict there with you assignments.

     

    If not the A2A C172 then I don't know what could be causing the issue.

     

    Paul

     

    EDIT: Looking at your INI file it appears you are using the default FSX C172 so ignore the

    above information.

  4. Just a note here. The Pro Flight Yoke also has a throttle quadrant attached and will be seen as device 3 with its

    6 switches (plus the axis detent switches). It is plugged into the Yoke with a proprietary plug.

     

    You do have 2 quadrants, do you not?

     

    The second throttle quadrant will also have 6 switches plus the detents and be seen as device 4. It is plugged into

    a USB port.

     

    I have these devices and have never had an issue with programming the axis or switches via FSUIPC4.

  5. To add to Pete's answer, if the 'view' is defined in a CameraDefinition.xxx entry in the aircraft.cfg file you

    can use the HotKeySelect.n approach by adding the statements

    "HotKeySelect.n" to the CameraDefinition.xxx section. "n" is the number of a View Select in the

    list of "View camera n (select)" in the FSX Controls list. Views 5 through 9 are available for assignment. A couple of the

    others are preassigned.

     

    Then you assign the button/switch/keystroke you wish to use to the appropriate "View camera n (select)" entry.

     

    I do this for VC views in all my aircraft, assigning 4 views to the #2 hat switch on my X-45 stick. Usually I set

    the left switch to F9 (VC, left seat), the right to a camera set for the right seat and the forward and back switches

    to 2 other views I want to access at a flick of my thumb.

     

    Here are the CameraDefinition.xxx entries for my A2A B-17G, followed by the FSX Control assignments images:

    Hope this helps.

    //----------------------------------------
    [CameraDefinition.001]
    Title = "Right Seat"
    Guid = {8ff6c134-098d-409f-baec-caba3f683f98}
    Origin = Virtual Cockpit
    MomentumEffect = YES
    SnapPbhAdjust = Swivel
    SnapPbhReturn = False
    PanPbhAdjust = Swivel
    PanPbhReturn = False
    Track = None
    ShowAxis = YES
    AllowZoom = TRUE
    InitialZoom = 0.7
    SmoothZoomTime = 2.0
    ZoomPanScalar = 1.0
    ShowWeather = Yes
    XyzAdjust = TRUE
    ShowLensFlare=FALSE
    Category = Cockpit
    PitchPanRate=100
    HeadingPanRate=100
    InitialXyz=0.8533983, 0.0, 0.0
    InitialPbh=0, 0, 0
    HotKeySelect=5
    
    [CameraDefinition.002]
    Title = "Center Panel"
    Guid = {195EAB58-9E4A-2E2A-A34C-A8D9D948F078}
    Origin = Virtual Cockpit
    MomentumEffect = YES
    SnapPbhAdjust = Swivel
    SnapPbhReturn = False
    PanPbhAdjust = Swivel
    PanPbhReturn = False
    Track = None
    ShowAxis = YES
    AllowZoom = TRUE
    InitialZoom = 0.7
    SmoothZoomTime = 2.0
    ZoomPanScalar = 1.0
    ShowWeather = Yes
    XyzAdjust = TRUE
    ShowLensFlare=FALSE
    Category = Cockpit
    PitchPanRate=100
    HeadingPanRate=100
    InitialXyz=0.4, 0.0, 0.0
    InitialPbh=5, 0, 0
    HotKeySelect=7
    
    [CameraDefinition.003]
    Title = "Engine Controls"
    Guid = {195EAB58-9E4A-3E2A-A34C-A8D9D948F078}
    Origin = Virtual Cockpit
    MomentumEffect = YES
    SnapPbhAdjust = Swivel
    SnapPbhReturn = False
    PanPbhAdjust = Swivel
    PanPbhReturn = False
    Track = None
    ShowAxis = FALSE
    AllowZoom = TRUE
    InitialZoom = 0.7
    SmoothZoomTime = 2.0
    ZoomPanScalar = 1.0
    ShowWeather = Yes
    XyzAdjust = TRUE
    ShowLensFlare=FALSE
    Category = Cockpit
    PitchPanRate=100
    HeadingPanRate=100
    InitialXyz=0.4, 0, 0
    InitialPbh=50, 0, 0
    HotKeySelect=6
    
    

    HotKey_Assigns.jpg

     

    Paul

  6. My INI file is thousands of lines long so I chose to let FSUIPC4 do the reassignments, plus I am a poor typist and prone to typos so unless everything is copy and paste I avoid manual entry when an automatic option is available :) Good to know that info in any case.

     

    As long as all your aircraft assignments have the letters instead of the numbers you are good to go.

     

    Paul

  7. Did you do the change by adding the line in the INI file:

    [JoyNames]
    AutoAssignLetters=Yes

     

    If so, FSUIPC4 will change the numeral assignments to letters the next time you fly the aircraft.

     

    It has been a long time since I changed mine and do not recall if all assignments were changed by flying just one time or if I had to fly each aircraft to get the assignments for that aircraft-specific section to change. I suspect the former.

     

    After the change you will see the same section sections, both letters and numbers, as you show above but only the letters will be used and substitutted for existing assignments.

     

    I do see, looking back at your post, that you apparently did NOT set AutoAsignLetters = YES.

     

    You should do this and then check the results by looking at any control assignments you had previously made. They should now have letters instead of numbers.

     

    In my case I let FSUIPC4 make the choice of letters - A, B, C etc.  Here is my assignment list:

     

    [JoyNames]
    AutoAssignLetters=Yes

    0=Logitech Dual Action
    0.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    1=Saitek X45
    1.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    4=CH PRO PEDALS USB
    4.GUID={E0590200-6113-11E4-8001-444553540000}

    A=Saitek Pro Flight Throttle Quadrant
    A.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    B=CH PRO PEDALS USB
    B.GUID={E0590200-6113-11E4-8001-444553540000}
    C=Saitek X45
    C.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    D=Saitek Pro Flight Yoke
    D.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    E=Logitech Dual Action
    E.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}

     

    And here is a portion of one of my many control assignment sections that refer to controllers D and E

     

    202=PE,0,C66701,1
    203=PD,11,C1084,0
    204=UD,11,CL36:R,0
    205=RE,3,C65879,0
    206=RE,1,C65880,0
    207=PD,12,C1114,0
    208=PE,2,CM22:35,1
    209=PE,9,CL32:R,0
    210=PE,5,CL32:R,0
    211=PE,32,CL36:R,0
    212=UE,32,CL32:R,0
    213=PE,8,C1084,0
    214=CR(-C,6)C,0,C65588,0 ;//Brakes
    215=CP(+C,6)C,0,C65752,0 ;// PARKING BRAKE
    216=PE,38,CM22:71,5 ;//Gamepad button 38 cycles the Auso Transmitter Select switch 6
    217=PE,34,C1005,3842 ;//Gamepad switch 34 toggles the Transmitter Select between Com1
    218=CP(F+15,2)E,34,CM22:72,2 ;// the use of the unused Joy 15, Button 2 flag
    219=CP(F-15,2)E,34,CM22:72,3
    220=PE,4,CL43:R,0
    221=UE,8,CL43:R,0

     

    After you verify that the substitutions have been made, you can then revert the AutoAssign statement back to NO.

    The way you have made the assignments MAY have made all the substitutions. You just need to examine your control assignment statements in the body of your INI file.

     

    Paul

  8. Lacking detent switches/buttons on your throttles, you can implement the launch of the Lua scripts using the

    FSUIPC4 Axis Assignment Tab and then use the feature on the right side of that screen to 'send button controls'.

     

    You would define a 'range' near the beginning of the throttle travel for a short distance and when that range is 'entered going down'

    you would specify the Lua script to enter reverse thrust.

     

    You would also define a  2nd 'range' covering the same area but for this range you would specify the Exit Recerse Thrust Script to be executed when that range is 'entered going up'.

     

    This method would create a 'virtual detent'  that would function just like a switch or button.

     

    For the Lua scripts, they are just placed in the FSX 'Modules' folder. They can be copied and pasted into text files and then

    saved with the .lua extension. When FSUIPC4 loads, it sees these Lua scripts and makes them available for assignment

    in the buttons & switches menu and the Axis assignment menu.

     

    Although this may sound complicated, it is quite simple.

     

       Paul

  9. The A2A B377 has some very specific requirements for getting into and out of the reverse thrust regime.

     

    For illustration, from the keyboard one must enter 'F1" to set idle thrust. The a series of "F2"keypresses

    will move the throttles into the reverse range. (Approx. 14 key presses or continuously hold F2 until full revers)

     

    To exit reverse thrust one must apply a series of "F3" key presses until the throttles move up and out of the

    reverse range. At that time normal throttle operation can be resumed.

     

    I created 2 small Lua scripts to automate these function on my Saitek dual throttle quads. When I pull the throttles back

    into the DETENT position, the first script executes the "F1" followed by 14 "F2"s.

     

    To exit, I simply move my throttle out of the DETENT and in doing so the 2nd script execures, sending 15 "F3" key strokes.

     

    I use just one of the throttle detent switches to execute the 1st script when the switch is activated and the 2nd script is executed

    when the switch is deactivated.

     

    Here are the 2 scripts:

     

    B377_REV.lua

    i = 0
       ipc.keypress(112)
       ipc.sleep(250)
    while i < 14 do
       ipc.keypress(113)
        ipc.keypress(113)
    	ipc.keypress(113)
       ipc.sleep(50)
       i = i + 1
    end
    

    and B377_XIT_REV.lua

    i = 0
    while i < 15 do
       ipc.keypress(114)
          ipc.sleep(50)
    	ipc.keypress(114)
       ipc.sleep(50)
       i = i + 1
    end
    

    I hope this helps.

     

     Paul

  10. Hello Paul,

     

    Here is the Lua script I use for displaying my control mappings for the A2A Piper Cherokee 180.

     

    When offset 0x66C0 changes (the 'mode' number for the conditional statements) it calls (executes)

    the function to display the current mode data in a Lua Display window whose position and size are

    set by "ipc.setdisplay( )" line.

     

    The function then displays the lines that match the current mode number (values in 0x66C0)

    
    function DispP180(offs, val)
    
    -- Adjust the Control Set to a 1 to 8 range. val is 0 to 7 in 0x66C0
    
      conset=val+1
    
    -- Define the positon and size of the Lua Display on the screen
    
      ipc.setdisplay(870, 550, 500, 100)
    
      if val == 0 then
    
       ipc.display("MAG LEFT _ MAG RIGHT _ FUEL PUMP _ BATTERY     _ AVIONICS ON\nMAGS OFF _ MAGS BOTH _ STARTER  _ PRIMER      _ AVIONICS OFF\nControl Set = "..conset, 10)
    
      end
    
      if val == 1 then
    
       ipc.display("BEACON _ LAND LIGHTS  _ TAXI LT _ NAV/INS LT _ STROBE\nPITOT    _ FUEL CUTOFF   _ FUEL L  _ FUEL R        _ SPARE\nControl Set = "..conset, 10)
    
      end
    
      if val == 2 then
    
       ipc.display("AP CHART _ RED LT    _ DOME LT _  HEAT    _ VENT\nANR75     _ RADIO LT _ HPHONES _  DEFROST _ VENTS\nControl Set = "..conset, 10)
    
      end
    
      if val == 3 then
    
       ipc.display("NAV1 SWAP _ COM1 SWAP  _ COM/NAV1 PWR _ ADF PWR _ DME POWER\nNAV2 SWAP _ COM2 SWAP  _ COM/NAV2 PWR _ GPS PWR _ DME MODE\nControl Set = "..conset, 10)
    
      end
    
      if val == 4 then
    
       ipc.display("AP ON     _ AP ALT _ HDG DEC _ HDG INC  _ ALT UP\nAP MODE _ SPARE  _ TURN LT  _ TURN RT  _ ALT DN\nControl Set = "..conset, 10)
    
      end
    
      if val == 5 then
    
       ipc.display("OBI 1 INC _ OBI 2 INC  _ ADF CARD INC _ NAV/GPS _ APPR\nOBI 1 DEC _ OBI 2 DEC _ ADF CARD DEC _ HDG      _ REV\nControl Set = "..conset, 10)
    
      end
    
      if val == 6 then
    
       ipc.display("NAV1 SPKR _ NAV2 SPKR _ DME SPKR _ MKR AUDIO _ NAV1 IDENT\nNAV1 HDPH _ NAV2 HDPH _ DME HDPH _ ADF AUDIO  _ NAV IDENT\nControl Set = "..conset, 10)
    
      end
    
      if val == 7 then
    
       ipc.display("MKR LAMP TEST    _ TEL SPKR _ COM1 SPKR _ COM2 SPKR _ XPDR MODE\nMKR SENSITIVITY _ TEL HDPH _ COM1 HDPH _ COM2 HDPH  _ XPDR IDENT\nControl Set = "..conset, 10)
    
      end
    
    end
    
    
    event.offset(0x66C0,"UB","DispP180")
    

    This script handles 8 'modes'. For any more or less, simply follow the method above.

     

    Note that I use 2 lines to display my 10 switch mappings on my Saitek Dual Throttle quads. Switches 11 & 12

    are my 'mode increment and decrement' switches. So, I have 5 switches in the upper row and 5 below them,

    thus I format the display readout to show the 5 top and 5 bottom mappings.

     

    Note that the character pair \n  causes a new line to be started. I insert the necessary number of spaces

    to align the upper and lower display fields to get a display like this below:

     

    MAG LEFT  _ MAG RIGHT  _ FUEL PUMP _ BATTERY     _ AVIONICS ON
    MAGS OFF _ MAGS BOTH _ STARTER     _ PRIMER       _ AVIONICS OFF
    Control Set = 1

     

    I assume you alreadt have the code in your INI file to increment/decrement the 0x66C0 value but I will show

    it here where I use switch 4 & 5 on my "A" controller (one of my Saitek Throttle Quads) to do the mode switching.

     

    200=PA,4,Cx510066C0,x00070001 ;//CONTROL SET INC Max = 7 Step = 1
    201=PA,5,Cx610066C0,x00070001 ;//CONTROL SET DEC Max = 7 Step = 1

     

    The last part of each 'ipc.display' statement   \nControl Set = "..conset, 10) displays the current  mode number (conset)

    in the range 1 to 8 while the actual input value is 0 to 7.  Note the new line \n then the text Control Set = and

    a single quote " which closes out the literal text display which began at the first single quote after  ipc.display(

     

    The two periods before conset are required to have the value of conset displayed. The 10 after the comma

    defines the time for the text lines to be displayed, in seconds.

     

    Note that the event.offset statement must be located AFTER the function that it calls. In the above case there

    is only one but I usually have several functions defined for a given aircraft to display data as events occur

    or things like rudder trim are adjusted. Here is an example:

      function Disp_Rud_Trim(control,Dummy)
    
       if Rud_Trim_last == nil then Rud_Trim_last = 0 end
    
        RTrim_in = ipc.readSW(0x0C04)
    
        Rud_Trim = (round(RTrim_in/163.83))/10
    
    -- Only display the trim value if it is different from the last one by 0.05
    -- to prevent displaying values caused by 'jitter' or noise. Increase the
    -- test value from 0.05 as necessary if you have a very noisy rotary!
    
    	 if (Rud_Trim > (Rud_Trim_last + 0.05)) or (Rud_Trim < (Rud_Trim_last - 0.05)) then
    
           ipc.display("Rud Trim = "..Rud_Trim, 1)
    
    	 end
    
    	Rud_Trim_last = Rud_Trim
    
      end
    
    -- rounds the integer
      function round(num)
    	num = tonumber(num)
    	if num == nil then return 0 end
        if num >= 0 then return math.floor(num+.5)
        else return math.ceil(num-.5) end
      end
      
    event.offset(0x0C04,"SW","Disp_Rud_Trim")
    

    Note that lines which start with --  are interpreted as comments.. I believe that they can also occur at the end of

    a line as well but I tend to put my comments on separate lines for ease in reading the code.

     

    So, if I included that Rudder Trim function in the same script as the Control Set display the two event statements would

    be located below all of the function code. An example from my script showing the triggers for several functions:

    event.offset(0x66C0,"UB","DispP180")

    event.control(65607,"Disp_El_Trim")

    event.control(65615,"Disp_El_Trim")

    event.offset(0x0C04,"SW","Disp_Rud_Trim")

    event.offset(0x66D0,"SW","Mixture_Lever")

     

    The two elevator trim events are for sensing the trim UP and trim DOWN events which I have mapped to switches

    whereas the rudder trim event is driven by an axis (a rotary) and the mixture by a lever which is sent to the

    user defined offset 0x66D0.

     

    The above examples and info should give you some more insight in to using more of the power of FSUIPC4

    programming and the Lua scripts.

     

    Let me know if you have any questions or problems implementing  the above functions.

     

    Glad to be able to help!

     

    BTW, I see you are in Galway. My ex-wife lives in that area:

    Tinageeragh
    Kilnadeema
    Loughrea, Co. Galway

     

     Paul

  11. If you use the FSUIPC4.ini entry below for the 'Letters' option there is no danger of the ID's changing. That is

    the purpose of this option. Instead of the numbers, which are supplied to FSUIPC4 by Windows, FSUIPC4 will

    use letters linked by the controller GUID, which will not change.

     

    [JoyNames]
    AutoAssignLetters=Yes

     

     Paul

  12. RA,2 = when Controller "A" button 2 is held, the following command/control is executed continuosly.

     

    K50,11 = the code for the KeyStroke combination  Shift+Control+2  (Page 20 and 21 of the Advanced Users PDF)

     

    So:

    3=RA,2,K50,11 ----> Send the keystrokes Shift+Control+2 continuosly as long as Button 2 of the Saitek Yoke is pressed.

     

    You really need to become intimately familiar with the contents of the "FSUIPC4 for Advanced Users.pdf" in your FSX\Modules\Documents folder. Even as an 'experienced user' I find the need to refer to that document often, along with the other documents included with the FSUIPC4 installation.

     

    It is good that you chose to use the "AutoAssignLetters=Yes" function as this will prevent issues from occuring if Windows decides to re-number controllers for whatever reason. The Saitek Yoke will ALWAYS be Controller "A" and the Saitek Rudder Pedals will ALWAYS be Controller "B".

     

    You might also want to consider using the "Profiles" option for the particular baircraft you are setting up the controls for, or use the "Aircraft Specific" checkbox in the FSUIPC4 menus particularly if you will be setting up controls for many different aircraft types.

     

     Paul

  13. I have my FSUIPC4 set to use letters for joystick assignments instead of the default numbers,

    so in the above examples the second letter of the 2-letter code is the Joy# or JoyName as a letter.

    This prevents problems should Windows re-assign a different number to a Joystick or controller.

     

    This statement in the FSUIPC4.ini file forces the use of Letters instead of Numbers.

    [JoyNames]
    AutoAssignLetters=Yes

     

    The first letter of the pair:

     

    'P' is 'pulse when pressed, a single execution of the following command'

    'R' is repeat while held'

    'U' is 'pulse when released, the command is executed when the button is released'

     

    'PD,14,' - execute the command when Button 14 of Joystick 'D' is pressed.

    'UA,3,' - execute the command when Button 3 of Joystick 'A' is released.

     

    The 'conditional' part of the above statements such as 'B66C0=0' indicates that the command

    is executed ONLY when the value in offset 0x66C0' is 0.

    The conditional code of 'B66C0=2' indicates that the command is only executed if the value in

    offset 0x66C0 is 2.

     

    I use the 'user-defined' offsets of 0x66C0 to 0x66FF for various purposed. In the cases above,

    0x66C0 acts as my 'MODE' switch.

     

    161=PA,4,Cx510066C0,x00080001 ;//INCREMENT 0X66C0 VALUE BY 1, MAX 8 THEN 0, CYLCLIC
    162=PA,5,Cx610066C0,x00080001 ;//DECREMENT 0X66C0 VALUE BY 1, MIN 0 THEN 8, CYLCLIC

     

    The 1st line above is 'unconditional' in that whenever Button 4 of Joystick A is pressed, the value

    in offset 0x66C0 is incremented by 1, changing to the next 'MODE'  (The Cx510066C0,x00080001 part)

     

    This is analogous to using the 3-position mode switch on the Saitek gear, but this method allows for

    more 'MODES' that one could ever need/use. Up to 256 possible 'modes' in this case as 0x66C0 is

    an unsigned byte (8 bits).

     

    The 2nd line decrements the current mode by 1. The coding used here allows for 9 modes as the

    CYCLIC feature counts up to 8 from 0, then rolls over to 0, or counts down from 8 to 0 and

    rolls over to 8.

     

     

    The P/D/U codes are explained on Page 19 of the "FSUIPC4 for Advanced Users.pdf".

    Page 25 begins the discussion on using offsets in conditional statements.

     

    This is the document you should be studying when it comes to setting up custom controls and

    just plain understanding the operations that are possible with FSUIPC4.

     

    Paul

    • Upvote 1
  14. I believe that 

    event.offset(0x04FE,"SW","seatbelt")

    should be

    event.offset(0x04FE,"UW","seatbelt")

     

    On the bit, byte, etc front.

    A byte is 8 bits  made up of 1's and 0's such as '10101010'

    A WORD is 2 bytes or 16 bits

    A DWORD or Double Word is 2 words or 32 bits

    A SIGNED word has the sign in bit 15, the 'left most bit'  (bits are numbered 0 to 15 in a word, right to left) thus the

    range of values represented is -32768  (1000 0000 0000 0000) to +32767 (0111 1111 1111 1111)

     

    If you are running Win7, open the calculator and under the 'View' tab select 'Programmer' to easily convert

    from decimal to hex, octal or binary.

     

    Also note that your statement above, if (ipc.readSW ("04FE") == 128) and (landing == 0) then   

    will not evaluate properly. Also, you should be using 'ipc.readUW' as 04FE is an UNSIGNED WORD.

     

    When you read the value in 04FE, you need to isolate bit 7, the seatbelt bit, and then test its state.

    Doing a logical AND operation with the contents of 04FE and 128 (80 hex) will give you only bit 7 having the posibility of being "1", or

    the value or that AND operation being 128. Perhaps something like the  lines below:

     

    seatbeltflag=0
    function seatbelt(offset,value)
    seatbelt=ipc.readSW("04FE")  --you have read the word containing the seatbelt bit into a variable here
    landing=ipc.readUW("0366")

     

    SeatBeltBit = logic.And(seatbelt, 128)    -- 'Logical And' the variable with decimal 128, which should return a "128" or "0"

    if (SeatBeltBit == 128) and (landing == 0) then

     

    It may be possible to rewrite those last two lines as:

     

    if (logic.And(seatbelt, 128) == 128) and (landing == 0) then

     

    I've never had need to use the bitwise and logical operators Lua functions (logicAnd(x,y) etc)

    so I'm just using my best guess here :)

     

    Have a look at the "Logic Library", page 11 of the Lua Library PDF in the FSUIPC4 Documents folder.

     

       Paul

  15. Japp, I downloaded the Lua package and installed that. It includes the editor it seems.

     

    This is a separate download completely independant of FSUIPC4.

     

    http://www.lua.org/download.html

     

    I simply downloaded the Lua package, did the install and that was it. When I right-click on a lua script

    the pop-up menu lists among other things "Edit script..."

     

    That is the editor that I use. It will also check syntax and pick up some errors.

     

    As for the seatbelt indication, have you tried this offset:

     

    341C  1  No smoking alert switch (1 = on, 0= off
    341D  1  Seat belts alert switch (1 = on, 0 = off)

     

    I notice that you use the form  ipc.readxx("number")

    I assume that "number" is the offset, however I always use the form

    ipc.readxx(0xoffset),  no quotes but the offset preceded by 0x indicating a hex value.

    Apparently the form you use in acceptable as some of the script works, it is just that

    I have never seen the statements written that way.

     

       Paul

  16. Does the switch respond and annimate to the parameters of 0 and 1?

     

    When debugging issues like this I assign a button/switch temporarily to the L:Var in question (You may need to create

    an MCRO file with an entry to define the L:Var and use SET as the function) The L:Var should then be present

    in the FSX Commands list of the Buttons & Switches menu.

     

    I simply set/change the parameter via the menu then 'Reload all..' and press the assigned switch or burron and observe

    the results. Although 3 position switches with a center 'off' are most frequently coded to us 1, 0, -1 parameters this may

    be an oddball. Try 0, 1 and 2 to see if that works.

     

    Anyhow, unless there is some other dependancy in the code for that switch position to function, using the

    above method to try different parameters should give you some insight into the issue.

     

     Paul

  17. First, what is FSUIPC4.9X? The settings for FSX FSUIPC4 are in the file FSUIPC4.ini.

     

    I suspect that the numbers assigned to your controllers, as reported by windows, has changed.

     

    The only way to avoid this issue is to use the setting:
    [JoyNames]
    AutoAssignLetters=Yes

     

    With that set to 'Yes' FSUIPC4 will assign letters to each of the controllers, linked by the GUID which

    does not change even if Windows assigns new numbers. Unfortunately the default entry is 'No'.

     

    The only way to recover your previous settings is to do some editing of the FSUIPC4.ini file.

     

    I did this some time ago when I moved over to a new system. I THINK I can recall the process.

     

    First, make a BACKUP copy of your 'new' FSUIPC4.ini and your old previous ini file.

    Copy & Paste this section to a text file in Notepad as a 'working copy'.

     

    Do the same for the old ini [JoyNames] section. paste it to the same text file

    that you created for the nex list. This way you can easily see both and make the necessary edits,

    that copy and paste the changed 'new' version back into the ini file.

     

    Then, in the current FSUIPC4. ini file set the [JoyNames] entry to  AutoAssignLetters=Yes

     

    Run FSX then exit. FSUIPC4 should have assigned letters to each controller and you will have a new

    JoyNames entry that would look something like this, using mine as an example:
     

    [JoyNames]
    AutoAssignLetters=Yes
    
    0=Logitech Dual Action
    0.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    1=Saitek X45
    1.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    2=Saitek Pro Flight Yoke
    2.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    3=Saitek Pro Flight Throttle Quadrant
    3.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    4=CH PRO PEDALS USB
    4.GUID={E0590200-6113-11E4-8001-444553540000}
    
    A=Logitech Dual Action
    A.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    B=Saitek X45
    B.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    C=Saitek Pro Flight Yoke
    C.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    D=Saitek Pro Flight Throttle Quadrant
    D.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    E=CH PRO PEDALS USB
    E.GUID={E0590200-6113-11E4-8001-444553540000}
    
    

    Also, look at the various buttons and axis entries in the newly created version

    of the FSUIPC4.ini file. They SHOULD have letters in place of the JoyNumber

    entries in each statement. All Joy# 0 entries will/should hane a letter now instaed

    of a number. We need to now equate THAT letter to the OLD Joy# 0. Then do

    the same for all the rest.

     

    Now, since the new JoyNumber 0 is probably assigned letter A as in my example above

    we must change the JoyNames letter assignment section so that letter A is equated to the OLD

    JoyNumber 0, and Letter B to the old JoyNumber and so forth.

     

    Exam the [JoyNames] sections in the old ini file vs. the new copy.

    New ini section copy
    
    [JoyNames]
    AutoAssignLetters=No
    
    0=Logitech Dual Action
    0.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    1=Saitek X45
    1.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    2=Saitek Pro Flight Yoke
    2.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    3=Saitek Pro Flight Throttle Quadrant
    3.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    4=CH PRO PEDALS USB
    4.GUID={E0590200-6113-11E4-8001-444553540000}
    
    Lets assume the OLD ini file looked like this:
    
    [JoyNames]
    AutoAssignLetters=No
    0=Saitek Pro Flight Throttle Quadrant
    0.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    1=CH PRO PEDALS USB
    1.GUID={E0590200-6113-11E4-8001-444553540000}
    2=Saitek X45
    2.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    3=Saitek Pro Flight Yoke
    3.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    4=Logitech Dual Action
    4.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    
    

    Note the different number assignments.

     

    What you must do is edit the OLD section with the old number assignments by

    changing the number to a letter like this:

     

    If the old JoyNumber 0 is now JoyNumber 3 and the letter assigned is D,

    then we must make the new JoyNumber 3 entry equate to the letter assigned

    to the NEW Joynumber 0, letter A.

    A=Saitek Pro Flight Throttle Quadrant
    A.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    B=CH PRO PEDALS USB
    B.GUID={E0590200-6113-11E4-8001-444553540000}
    C=Saitek X45
    C.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    D=Saitek Pro Flight Yoke
    D.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    E=Logitech Dual Action
    E.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    

    Then copy and paste the EDITED OLD entries, that now have letters,

    REPLACING the section in the NEW FSUIPC4.ini file. It should then look like

    this:

    
    [JoyNames]
    AutoAssignLetters=Yes
    
    0=Logitech Dual Action
    0.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    1=Saitek X45
    1.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    2=Saitek Pro Flight Yoke
    2.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    3=Saitek Pro Flight Throttle Quadrant
    3.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    4=CH PRO PEDALS USB
    4.GUID={E0590200-6113-11E4-8001-444553540000}
    
    A=Logitech Dual Action
    A.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}  //Old Joy# 4
    B=Saitek X45
    B.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}  //Old Joy# 2
    C=Saitek Pro Flight Yoke
    C.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}  //Old Joy# 3
    D=Saitek Pro Flight Throttle Quadrant
    D.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}  //Old Joy# 0
    E=CH PRO PEDALS USB
    E.GUID={E0590200-6113-11E4-8001-444553540000}  //Old Joy# 1
    
    Re-assigned the letter section based on the OLD names and GUIDs
    such that the NEW Joy#0 which was Letter A is now Letter E and
    so on. replace the letter assignment section with the new edited one
    as in this example.
    
    A=Saitek Pro Flight Throttle Quadrant
    A.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}  //Old Joy# 0
    B=CH PRO PEDALS USB
    B.GUID={E0590200-6113-11E4-8001-444553540000}  //Old Joy# 1
    C=Saitek X45
    C.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}  //Old Joy# 2
    D=Saitek Pro Flight Yoke
    D.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}  //Old Joy# 3
    E=Logitech Dual Action
    E.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}  //Old Joy# 4
    

    . Load FSX and hopefully FSUIPC4 will change the numbers to the new letters in all your axis and button assignments.

     

    This is not for the faint of heart!  :)

     

      Paul

  18. Jaap, At first glance it appears that something is amiss near the end of the first function. You will notice that the color of the statements

    change in that area and from then on all text is green.

     

    In my lua plugins in edit mode, comments are green and offsets and parameters are green. The rest of the text in the

    statements is black, or in the case of "qoute enclosed text", red.

     

    Although, when I copy and paste your script and open it in edit mode on my system, the colors of

    the variious elements appear to be correct. I'll have to scan the scropt in more detail to see if I can

    spot any errors but it is late here on the US west coast so I won't be able to do anything tonight.

     

     Paul

     

    EDIT: Just did a quick scan and the only thing I see that MIGHT be an issue is where there

             are division operations such as:  3.28084 /256

     

              In all my scripts there are no spaces between the numerator, the / and the denominator.

              It just may be that the Lua parser/engine or whatever may have changed from an earlier

              version in FSUIPC4 and that the space is now causing trouble.

     

              I ran the debugger here on my system and it didn't toss out any errors so I'm at a loss

              for recommendations.

     

              Also, you say that if you start the script manually that it does run "for awhile". That would tend

             to say that the script itself may be fine but some external influence is causing the issues. Maybe

              a lack of resources after a period of time.

  19. "CL19, CL20, etc. Is that the code for the lua file(s)?:

     

    Yes. The number is assigned by FSUIPC4 when it reads the Lua files in initially or when it sees a new one.

     

    Does the list of Lua files in the INI file compare exactly to your previous file....#19 is <some lua file name>, #20 is <another file name>?

     

    If you did not have the INI file setting set to:

     

    [JoyNames]
    AutoAssignLetters=Yes

     

    but instead have "AutoAssignLetters=No" then it is quite possible that Windows assigned NEW JoyNumbers

    when it scanned your controllers and FSUIPC4 still has the 'old' JoyNumbers and buttons.

     

    Similar issues can occur if you unplug a controller then reinstall it later, perhaps after adding another controller.

    If you have the AutoAssignLetters=Yes, then FSUIPC4 convers all Joy#'s to letters associated with the GUID of

    ]the controllers. These do not change  The first time you run FSUIPC4 after setting "Yes" all Joy#'s in each INI file line

    will be converted to a letter that it assigned to each controller.

     

    If this is what is causing your issues you MAY be able to save the day IF you still have a copy of your 'old' INI file

    that shows the Number assigned to each controller and the GUID.

     

    You would then go into the new INI after letters have been assigned and change the letter assignments to match

    the old numbers GUIDs.

     

    Here is what my letter vs number vs GUID list looks like.

    [JoyNames]
    AutoAssignLetters=Yes
    
    0=Logitech Dual Action
    0.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    1=Saitek X45
    1.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    2=Saitek Pro Flight Yoke
    2.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    3=Saitek Pro Flight Throttle Quadrant
    3.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    4=CH PRO PEDALS USB
    4.GUID={E0590200-6113-11E4-8001-444553540000}
    
    
    A=Saitek Pro Flight Throttle Quadrant
    A.GUID={6B5A2B40-5A5C-11E4-8005-444553540000}
    B=CH PRO PEDALS USB
    B.GUID={E0590200-6113-11E4-8001-444553540000}
    C=Saitek X45
    C.GUID={6B5A2B40-5A5C-11E4-8003-444553540000}
    D=Saitek Pro Flight Yoke
    D.GUID={6B5A2B40-5A5C-11E4-8004-444553540000}
    E=Logitech Dual Action
    E.GUID={6B5A2B40-5A5C-11E4-8002-444553540000}
    

    As for Lua files, here is what my list looks like:

     

    !2=//----------------- LUA FILE LIST ----------------

    [LuaFiles]
    1=B377_exit_revers
    2=B377_reverse
    3=display vals
    4=liar
    5=freeze
    6=init pos
    7=ipcDebug
    8=landing
    9=record to csv
    10=log lvars
    11=RUN_VBS
    12=Payload737
    13=MasterClient
    14=SlaveServer
    15=testclnt
    16=testsrvr
    17=DispB17CS
    18=A2A_B377_icflap
    19=DispP47CS
    20=gfdDisplay
    21=DispP40
    22=B17G_Turbo
    23=Flak_Wind
    24=DispSPIT
    25=B17G_Gear
    26=DispP51CS
    27=DispF4U
    28=DispC47CS
    29=DispP51ASCS
    30=DispP40_test
    31=DispP51CIV
    32=Calc_Track
    33=DispB25J
    34=DispLanc
    35=DispC172
    36=DispP180
    37=DispB29CS
    38=DispC182
    39=DispP51H
    40=Gear_Switch
    41=B17_Mechanic
    42=pucker
    43=DispPA24
    44=DispB24


    Hope this helps you track down your issues.

     

     Paul

  20. Adding to the above posters suggestion, I often use the lua display function to give me feedback when I am changing various functions with either a button assignment or axis. The display can be triggered by the change in value of an FSX offset, a user-defined offset, or any of the other 'on event' operations.

     

    Here is an example of a lua routine that displays the current value of rudder trim:

      function Disp_Rud_Trim(control,Dummy)
    
    	RTrim_in = ipc.readSW(0x0C04)
    
        Rud_Trim = (round(RTrim_in/163.83))/10
    
        ipc.display("Rud Trim = "..Rud_Trim, 1)
    
      end
      
    -- rounds the integer
      function round(num)
    	num = tonumber(num)
    	if num == nil then return 0 end
        if num >= 0 then return math.floor(num+.5)
        else return math.ceil(num-.5) end
      end
      
    event.offset(0x0C04,"SW","Disp_Rud_Trim")
    

    In this case, the event that triggers the display is a change in the value at offset 0x0C04. You could also have an L:Var cause the triggering of the display. The duration of the display is user-defined. In the above case, 1 second.

     

    Here is an example using an L:Var. In this case I am controling the A2A C182 panel light and also displaying the setting as it changes

    
      function Panel_Light(control, Knob_in)
    
      if Knob_Out_Last == nil then Knob_Out_Last = 0 end
    
      Knob_Out = (round((Knob_in + 16383)/1024))
    
        if Knob_Out < 0 then Knob_Out = 0 end
    
      ipc.writeLvar("L:PanelLightKnob", Knob_Out)
    
        if Knob_Out > Knob_Out_Last + 0.5 or Knob_Out < Knob_Out_Last - 0.5 then
    
        ipc.display("Panel Light = "..Knob_Out, 1) end
    
      Knob_Out_Last = Knob_Out
    
      end
    
    -- rounds the integer
      function round(num)
    	num = tonumber(num)
    	if num == nil then return 0 end
        if num >= 0 then return math.floor(num+.5)
        else return math.ceil(num-.5) end
      end
      
    -- Here the desired panel light setting is written to user-defined offset 0x66D2
    -- When that value changes this event statement triggers the code above.
    -- The value is in the range of +\- 65535, a signed word from an axis, and
    -- scaled above for output to the L:Variable and also displayed for 1 second.
    
    event.offset(0x66D2,"SW","Panel_Light")
    
    
    

    All of these options are detailed in the FSUIPC4 for Advanced Users.pdf

     

       Paul

  21. Just FYI,

     

    I assign buttons and switches all the time to L:Variables via the 'normal' FSUIPC4 procedure.

     

    All one needs to do is create a MCRO file that declares the L:vars and the type of action desired and

    place that file 'some_name.MCRO' into the Modules folder.

     

    FSUIPC4 than reads that file and adds those L:Vars to the list of assignable controls/commands.

     

    I only use Lua scripts when I need to scale a variable or do some other action that  isn't feasible using the

    normal assignment  process.

     

       Paul

×
×
  • 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.