Jump to content
The simFlight Network Forums

Jacob Wiqvist

Members
  • Posts

    22
  • Joined

  • Last visited

Posts posted by Jacob Wiqvist

  1. Could this code work?

    That it disregard a -1 value?

    Or is there any other filtering methods in lua?

     

    function HandleParkingBrake(time)

     

        ipc.log("HandleParkingBrake start:")

       

        rightRudderPedalValue = ipc.readSW(0x66F5)

        leftRudderPedalValue = ipc.readSW(0x66F6)

       

        ipc.log("rightRudderPedalValue")

        ipc.log(rightRudderPedalValue)

        ipc.log("leftRudderPedalValue")

        ipc.log(leftRudderPedalValue)

      

       if leftRudderPedalValue <> -1 then

     

       if rightRudderPedalValue > 14000 and leftRudderPedalValue > 14000 then

            ipc.log("SOLENOID 1")

            ipc.writeUB(0x66E9, 1)

       else

            ipc.log("SOLENOID 0")

            ipc.writeUB(0x66E9, 0)

       end

       

      else

          

       ipc.log("HandleParkingBrake end:")

     

    end

     

    end

     

     

    event.timer(10, "HandleParkingBrake")

  2. On 2/17/2021 at 3:05 PM, Pete Dowson said:

    As well as taking john's good advice, do make good use of the tools at your disposal so you can see what is going on. As well as using Lua tracing (which can sometimes be a bit mind-boggling as it logs every step), try using the ipc.log function to just log details of what you read and write, and also make good use of the FSUIPC monitor facilities (right-hand side of the Logging tab) where you can monitor (to the FSUIPC log) the values of up to 4 offsets of whatever type they are.

    To make things easier to see, run the Sim in Windowed mode and enable the FSUIPC console log. You will then see these logging entries in real time, on screen.

    Pete

     

    I can't get it to work?

    The values are fluctuating from the Lua script. But the input signal seems fairly stable?

     

    FSUIPC log

       118890 LUA.1: 16255
       118906 LUA.1: SOLENOID 1
       118937 LUA.1: HandleParkingBrake end:
       118969 LUA.1: HandleParkingBrake start:
       118984 LUA.1: rightRudderPedalValue
       119000 LUA.1: 32767
       119015 LUA.1: leftRudderPedalValue
       119031 LUA.1: 16255
       119047 LUA.1: SOLENOID 1
       119078 LUA.1: HandleParkingBrake end:
       119109 LUA.1: HandleParkingBrake start:
       119125 LUA.1: rightRudderPedalValue
       119140 LUA.1: 32767
       119156 LUA.1: leftRudderPedalValue
       119172 LUA.1: 16255
       119187 LUA.1: SOLENOID 1
       119219 LUA.1: HandleParkingBrake end:
       119250 LUA.1: HandleParkingBrake start:
       119265 LUA.1: rightRudderPedalValue
       119281 LUA.1: 32767
       119297 LUA.1: leftRudderPedalValue
       119312 LUA.1: 16255
       119328 LUA.1: SOLENOID 1
       119359 LUA.1: HandleParkingBrake end:
       119390 LUA.1: HandleParkingBrake start:
       119406 LUA.1: rightRudderPedalValue
       119422 LUA.1: 32767
       119437 LUA.1: leftRudderPedalValue
       119453 LUA.1: 16255
       119469 LUA.1: SOLENOID 1
       119484 LUA.1: HandleParkingBrake end:
       119515 LUA.1: HandleParkingBrake start:
       119531 LUA.1: rightRudderPedalValue
       119547 LUA.1: 32767
       119562 LUA.1: leftRudderPedalValue
       119578 LUA.1: 16255
       119594 LUA.1: SOLENOID 1
       119625 LUA.1: HandleParkingBrake end:
       119656 LUA.1: HandleParkingBrake start:
       119672 LUA.1: rightRudderPedalValue
       119687 LUA.1: 32767
       119703 LUA.1: leftRudderPedalValue
       119719 LUA.1: 16255
       119734 LUA.1: SOLENOID 1
       119765 LUA.1: HandleParkingBrake end:
       119797 LUA.1: HandleParkingBrake start:
       119812 LUA.1: rightRudderPedalValue
       119828 LUA.1: 32767
       119844 LUA.1: leftRudderPedalValue
       119859 LUA.1: 16255
       119875 LUA.1: SOLENOID 1
       119906 LUA.1: HandleParkingBrake end:
       119937 LUA.1: HandleParkingBrake start:
       119953 LUA.1: rightRudderPedalValue
       119969 LUA.1: 32767
       119984 LUA.1: leftRudderPedalValue
       120000 LUA.1: 16255
       120015 LUA.1: SOLENOID 1
       120047 LUA.1: HandleParkingBrake end:
       120078 LUA.1: HandleParkingBrake start:
       120094 LUA.1: rightRudderPedalValue
       120109 LUA.1: 32767
       120125 LUA.1: leftRudderPedalValue
       120140 LUA.1: 16255
       120156 LUA.1: SOLENOID 1
       120187 LUA.1: HandleParkingBrake end:
       120219 LUA.1: HandleParkingBrake start:
       120234 LUA.1: rightRudderPedalValue
       120250 LUA.1: 32767
       120265 LUA.1: leftRudderPedalValue
       120281 LUA.1: 16255
       120297 LUA.1: SOLENOID 1
       120328 LUA.1: HandleParkingBrake end:
       120359 LUA.1: HandleParkingBrake start:
       120375 LUA.1: rightRudderPedalValue
       120390 LUA.1: 32767
       120406 LUA.1: leftRudderPedalValue
       120422 LUA.1: 16255
       120437 LUA.1: SOLENOID 1
       120453 LUA.1: HandleParkingBrake end:
       120484 LUA.1: HandleParkingBrake start:
       120500 LUA.1: rightRudderPedalValue
       120515 LUA.1: 32767
       120531 Monitor IPC:66F6 (S16) = 15743
       120531 LUA.1: leftRudderPedalValue
       120547 Monitor IPC:66F6 (S16) = 15678
       120547 LUA.1: 16255
       120562 Monitor IPC:66F5 (S16) = 16127
       120562 LUA.1: SOLENOID 1
       120578 Monitor IPC:66F6 (S16) = 16383
       120594 Monitor IPC:66F5 (S16) = -1
       120594 LUA.1: HandleParkingBrake end:
       120609 Monitor IPC:66F6 (S16) = 14975
       120625 Monitor IPC:66F5 (S16) = 32639
       120625 LUA.1: HandleParkingBrake start:
       120640 LUA.1: rightRudderPedalValue
       120640 Monitor IPC:66F6 (S16) = 11007
       120656 Monitor IPC:66F5 (S16) = -256
       120656 LUA.1: -129
       120672 LUA.1: leftRudderPedalValue
       120687 Monitor IPC:66F6 (S16) = 5760
       120687 LUA.1: 13055
       120703 Monitor IPC:66F5 (S16) = -32640
       120703 Monitor IPC:66F6 (S16) = 1664
       120703 LUA.1: SOLENOID 0
       120719 Monitor IPC:66F5 (S16) = -32516
       120734 LUA.1: HandleParkingBrake end:
       120750 Monitor IPC:66F6 (S16) = -7672
       120765 Monitor IPC:66F5 (S16) = 2056
       120765 LUA.1: HandleParkingBrake start:
       120781 LUA.1: rightRudderPedalValue
       120781 Monitor IPC:66F6 (S16) = -15474
       120797 LUA.1: -18473
       120797 Monitor IPC:66F5 (S16) = -28993
       120812 Monitor IPC:66F6 (S16) = -16384
       120812 LUA.1: leftRudderPedalValue
       120812 Monitor IPC:66F5 (S16) = 41
       120828 LUA.1: -12873
       120844 Monitor IPC:66F6 (S16) = -16189
       120844 LUA.1: SOLENOID 0
       120859 Monitor IPC:66F5 (S16) = -15604
       120875 LUA.1: HandleParkingBrake end:
       120875 Monitor IPC:66F6 (S16) = -16192
       120890 Monitor IPC:66F5 (S16) = -16384
       120906 LUA.1: HandleParkingBrake start:
       120922 LUA.1: rightRudderPedalValue
       120937 LUA.1: -16384
       120953 LUA.1: leftRudderPedalValue
       120969 LUA.1: -16192
       120984 LUA.1: SOLENOID 0
       121015 LUA.1: HandleParkingBrake end:
       121047 LUA.1: HandleParkingBrake start:
       121062 LUA.1: rightRudderPedalValue
       121078 LUA.1: -16384
       121094 LUA.1: leftRudderPedalValue
       121109 LUA.1: -16192
       121125 LUA.1: SOLENOID 0
       121156 LUA.1: HandleParkingBrake end:
       121187 LUA.1: HandleParkingBrake start:
       121203 LUA.1: rightRudderPedalValue
       121219 LUA.1: -16384
       121234 LUA.1: leftRudderPedalValue
       121250 LUA.1: -16192
       121265 LUA.1: SOLENOID 0
       121297 LUA.1: HandleParkingBrake end:
       121328 LUA.1: HandleParkingBrake start:
       121344 LUA.1: rightRudderPedalValue
       121359 LUA.1: -16384
       121375 LUA.1: leftRudderPedalValue
       121390 LUA.1: -16192
       121406 LUA.1: SOLENOID 0
       121422 LUA.1: HandleParkingBrake end:
       121453 LUA.1: HandleParkingBrake start:
       121469 LUA.1: rightRudderPedalValue
       121484 LUA.1: -16384
       121500 LUA.1: leftRudderPedalValue
       121515 LUA.1: -16192
       121531 LUA.1: SOLENOID 0
       121562 LUA.1: HandleParkingBrake end:
       121594 LUA.1: HandleParkingBrake start:
       121609 LUA.1: rightRudderPedalValue
       121625 Monitor IPC:66F6 (S16) = -16191
       121625 LUA.1: -16384
       121640 Monitor IPC:66F5 (S16) = -16124
       121640 LUA.1: leftRudderPedalValue
       121656 Monitor IPC:66F6 (S16) = -16188
       121656 LUA.1: -16192
       121672 Monitor IPC:66F5 (S16) = -15214
       121672 LUA.1: SOLENOID 0
       121687 Monitor IPC:66F6 (S16) = -16185
       121703 LUA.1: HandleParkingBrake end:
       121703 Monitor IPC:66F5 (S16) = -14433
       121703 Monitor IPC:66F6 (S16) = -16174
       121719 Monitor IPC:66F5 (S16) = -11573
       121734 LUA.1: HandleParkingBrake start:
       121750 Monitor IPC:66F6 (S16) = -16168
       121750 LUA.1: rightRudderPedalValue
       121765 Monitor IPC:66F5 (S16) = -10012
       121765 LUA.1: -10012
       121781 Monitor IPC:66F6 (S16) = -15214
       121781 LUA.1: leftRudderPedalValue
       121797 Monitor IPC:66F5 (S16) = -28030
       121797 LUA.1: -16168
       121797 Monitor IPC:66F6 (S16) = -13523
       121812 Monitor IPC:66F5 (S16) = 11540
       121812 LUA.1: SOLENOID 0
       121828 Monitor IPC:66F6 (S16) = -12353
       121844 LUA.1: HandleParkingBrake end:
       121844 Monitor IPC:66F5 (S16) = -16473
       121875 Monitor IPC:66F6 (S16) = -10533
       121875 LUA.1: HandleParkingBrake start:
       121890 Monitor IPC:66F5 (S16) = -9411
       121890 Monitor IPC:66F6 (S16) = -10272
       121890 LUA.1: rightRudderPedalValue
       121906 Monitor IPC:66F5 (S16) = -8123
       121906 LUA.1: -8123
       121906 Monitor IPC:66F6 (S16) = -9232
       121922 Monitor IPC:66F5 (S16) = -3873
       121922 LUA.1: leftRudderPedalValue
       121937 LUA.1: -10272
       121937 Monitor IPC:66F6 (S16) = -7932
       121953 LUA.1: SOLENOID 0
       121953 Monitor IPC:66F5 (S16) = 1276
       121984 Monitor IPC:66F6 (S16) = -6372
       121984 LUA.1: HandleParkingBrake end:
       121984 Monitor IPC:66F5 (S16) = 7168
       122015 LUA.1: HandleParkingBrake start:
       122015 Monitor IPC:66F6 (S16) = -4941
       122031 Monitor IPC:66F5 (S16) = -19584
       122031 LUA.1: rightRudderPedalValue
       122047 LUA.1: -19584
       122047 Monitor IPC:66F6 (S16) = -4031
       122062 LUA.1: leftRudderPedalValue
       122062 Monitor IPC:66F5 (S16) = 16768
       122062 Monitor IPC:66F6 (S16) = -3251
       122078 LUA.1: -4941
       122078 Monitor IPC:66F5 (S16) = 19840
       122094 Monitor IPC:66F6 (S16) = -2861
       122094 LUA.1: SOLENOID 0
       122094 Monitor IPC:66F5 (S16) = -11520
       122109 Monitor IPC:66F6 (S16) = -2341
       122109 Monitor IPC:66F5 (S16) = -9344
       122125 LUA.1: HandleParkingBrake end:
       122140 Monitor IPC:66F6 (S16) = -1691
       122156 LUA.1: HandleParkingBrake start:
       122156 Monitor IPC:66F5 (S16) = 25984
       122172 LUA.1: rightRudderPedalValue
       122172 Monitor IPC:66F6 (S16) = 1152
       122187 LUA.1: 25984
       122187 Monitor IPC:66F5 (S16) = -32641
       122203 Monitor IPC:66F6 (S16) = 2048
       122203 LUA.1: leftRudderPedalValue
       122203 Monitor IPC:66F5 (S16) = 127
       122219 Monitor IPC:66F6 (S16) = 3200
       122219 LUA.1: -1691
       122219 Monitor IPC:66F5 (S16) = -32513
       122234 LUA.1: SOLENOID 0
       122250 Monitor IPC:66F6 (S16) = 6272
       122265 LUA.1: HandleParkingBrake end:
       122265 Monitor IPC:66F6 (S16) = 7168
       122281 Monitor IPC:66F5 (S16) = 255
       122297 LUA.1: HandleParkingBrake start:
       122297 Monitor IPC:66F6 (S16) = 9215
       122312 LUA.1: rightRudderPedalValue
       122312 Monitor IPC:66F5 (S16) = -1
       122328 LUA.1: -1
       122344 LUA.1: leftRudderPedalValue
       122344 Monitor IPC:66F6 (S16) = 12159
       122344 Monitor IPC:66F5 (S16) = 32767
       122359 LUA.1: 9215
       122359 LUA.1: SOLENOID 0
       122375 Monitor IPC:66F6 (S16) = 13823
       122390 Monitor IPC:66F5 (S16) = -1
       122390 Monitor IPC:66F6 (S16) = 14463
       122390 LUA.1: HandleParkingBrake end:
       122406 Monitor IPC:66F5 (S16) = 32767
       122406 Monitor IPC:66F6 (S16) = 14847
       122422 Monitor IPC:66F5 (S16) = -1
       122422 LUA.1: HandleParkingBrake start:
       122437 LUA.1: rightRudderPedalValue
       122437 Monitor IPC:66F6 (S16) = 15999
       122453 Monitor IPC:66F5 (S16) = 32767
       122453 LUA.1: -1
       122469 LUA.1: leftRudderPedalValue
       122484 Monitor IPC:66F6 (S16) = 16383
       122484 LUA.1: 15615
       122500 Monitor IPC:66F5 (S16) = -1
       122500 LUA.1: SOLENOID 0
       122531 LUA.1: HandleParkingBrake end:
       122562 LUA.1: HandleParkingBrake start:
       122578 LUA.1: rightRudderPedalValue
       122594 LUA.1: -1
       122609 LUA.1: leftRudderPedalValue
       122625 LUA.1: 16383
       122640 LUA.1: SOLENOID 0
       122672 LUA.1: HandleParkingBrake end:
       122703 LUA.1: HandleParkingBrake start:
       122719 LUA.1: rightRudderPedalValue
       122734 LUA.1: -1
       122750 LUA.1: leftRudderPedalValue
       122765 LUA.1: 16383
       122781 LUA.1: SOLENOID 0
       122812 LUA.1: HandleParkingBrake end:
       122844 LUA.1: HandleParkingBrake start:
       122859 LUA.1: rightRudderPedalValue
       122875 LUA.1: -1
       122890 LUA.1: leftRudderPedalValue
       122906 LUA.1: 16383
       122922 LUA.1: SOLENOID 0
       122953 LUA.1: HandleParkingBrake end:
       122984 LUA.1: HandleParkingBrake start:
       123000 LUA.1: rightRudderPedalValue
       123015 LUA.1: -1
       123031 LUA.1: leftRudderPedalValue
       123047 LUA.1: 16383
       123062 LUA.1: SOLENOID 0
       123094 LUA.1: HandleParkingBrake end:
       123125 LUA.1: HandleParkingBrake start:
       123140 LUA.1: rightRudderPedalValue
       123156 LUA.1: -1
       123172 LUA.1: leftRudderPedalValue
       123187 LUA.1: 16383
       123203 LUA.1: SOLENOID 0
       123234 LUA.1: HandleParkingBrake end:
       123265 LUA.1: HandleParkingBrake start:
       123265 Monitor IPC:66F6 (S16) = 16190
       123281 LUA.1: rightRudderPedalValue
       123281 Monitor IPC:66F5 (S16) = 15999
       123297 LUA.1: 15999
       123297 Monitor IPC:66F6 (S16) = 16175
       123312 LUA.1: leftRudderPedalValue
       123312 Monitor IPC:66F5 (S16) = 12287
       123328 LUA.1: 16190
       123328 Monitor IPC:66F6 (S16) = 16161
       123328 LUA.1: SOLENOID 1
       123359 Monitor IPC:66F5 (S16) = 8703
       123359 LUA.1: HandleParkingBrake end:
       123375 Monitor IPC:66F6 (S16) = 15743
       123390 Monitor IPC:66F5 (S16) = 32569
       123390 Monitor IPC:66F6 (S16) = 15103
       123390 LUA.1: HandleParkingBrake start:
       123406 Monitor IPC:66F5 (S16) = -244
       123406 LUA.1: rightRudderPedalValue
       123422 Monitor IPC:66F6 (S16) = 13951
       123422 Monitor IPC:66F5 (S16) = 32585
       123422 LUA.1: -9492
       123437 LUA.1: leftRudderPedalValue
       123453 Monitor IPC:66F6 (S16) = 12415
       123453 LUA.1: 15066
       123469 Monitor IPC:66F5 (S16) = 32671
       123469 LUA.1: SOLENOID 0
       123484 Monitor IPC:66F6 (S16) = 6656
       123500 Monitor IPC:66F5 (S16) = 151
       123500 Monitor IPC:66F6 (S16) = 2304
       123500 LUA.1: HandleParkingBrake end:
       123515 Monitor IPC:66F5 (S16) = 12
       123531 LUA.1: HandleParkingBrake start:
       123547 Monitor IPC:66F6 (S16) = -9492
       123547 LUA.1: rightRudderPedalValue
       123562 Monitor IPC:66F5 (S16) = -5120
       123562 LUA.1: -5120
       123578 Monitor IPC:66F6 (S16) = -16384
       123578 LUA.1: leftRudderPedalValue
       123594 Monitor IPC:66F5 (S16) = 0
       123594 LUA.1: -9492
       123609 LUA.1: SOLENOID 0
       123640 LUA.1: HandleParkingBrake end:
       123672 LUA.1: HandleParkingBrake start:
       123687 LUA.1: rightRudderPedalValue
       123703 LUA.1: 0
       123719 LUA.1: leftRudderPedalValue
       123734 LUA.1: -16384
       123750 LUA.1: SOLENOID 0
       123781 LUA.1: HandleParkingBrake end:
       123812 LUA.1: HandleParkingBrake start:
       123828 LUA.1: rightRudderPedalValue
       123844 LUA.1: 0
       123859 LUA.1: leftRudderPedalValue
       123875 LUA.1: -16384
       123890 LUA.1: SOLENOID 0
       123922 LUA.1: HandleParkingBrake end:
       123953 LUA.1: HandleParkingBrake start:
       123969 LUA.1: rightRudderPedalValue
       123984 LUA.1: 0
       124000 LUA.1: leftRudderPedalValue
       124015 LUA.1: -16384
       124031 LUA.1: SOLENOID 0
       124062 LUA.1: HandleParkingBrake end:
       124094 LUA.1: HandleParkingBrake start:
       124109 LUA.1: rightRudderPedalValue
       124125 LUA.1: 0
       124140 LUA.1: leftRudderPedalValue
       124156 LUA.1: -16384
       124172 LUA.1: SOLENOID 0
       124203 LUA.1: HandleParkingBrake end:
       124234 LUA.1: HandleParkingBrake start:
       124250 LUA.1: rightRudderPedalValue
       124265 LUA.1: 0
       124281 LUA.1: leftRudderPedalValue
       124297 LUA.1: -16384
       124297 LUA.1: SOLENOID 0
       124328 LUA.1: HandleParkingBrake end:
       124359 LUA.1: HandleParkingBrake start:
       124375 LUA.1: rightRudderPedalValue
       124390 LUA.1: 0
       124406 LUA.1: leftRudderPedalValue
       124422 LUA.1: -16384
       124437 LUA.1: SOLENOID 0
       124469 LUA.1: HandleParkingBrake end:
       124500 LUA.1: HandleParkingBrake start:
       124515 LUA.1: rightRudderPedalValue
       124531 LUA.1: 0
       124547 LUA.1: leftRudderPedalValue
       124562 LUA.1: -16384
       124578 LUA.1: SOLENOID 0
       124609 LUA.1: HandleParkingBrake end:
       124640 LUA.1: HandleParkingBrake start:
       124656 LUA.1: rightRudderPedalValue
       124672 LUA.1: 0
       124687 LUA.1: leftRudderPedalValue
       124703 LUA.1: -16384
       124719 LUA.1: SOLENOID 0
       124750 LUA.1: HandleParkingBrake end:
       124781 LUA.1: HandleParkingBrake start:
       124797 LUA.1: rightRudderPedalValue
       124812 LUA.1: 0
       124828 LUA.1: leftRudderPedalValue
       124844 LUA.1: -16384
       124859 LUA.1: SOLENOID 0
       124890 LUA.1: HandleParkingBrake end:
       124922 LUA.1: HandleParkingBrake start:
       124937 LUA.1: rightRudderPedalValue
       124953 LUA.1: 0
       124969 LUA.1: leftRudderPedalValue
       124984 LUA.1: -16384
       125000 LUA.1: SOLENOID 0
       125031 LUA.1: HandleParkingBrake end:
       125062 LUA.1: HandleParkingBrake start:
       125078 LUA.1: rightRudderPedalValue
       125094 LUA.1: 0
       125109 LUA.1: leftRudderPedalValue
       125125 LUA.1: -16384
       125140 LUA.1: SOLENOID 0
       125172 LUA.1: HandleParkingBrake end:
       125203 LUA.1: HandleParkingBrake start:
       125219 LUA.1: rightRudderPedalValue
       125234 LUA.1: 0
       125250 LUA.1: leftRudderPedalValue
       125265 LUA.1: -16384
       125265 LUA.1: SOLENOID 0
       125297 LUA.1: HandleParkingBrake end:
       125328 LUA.1: HandleParkingBrake start:
       125344 LUA.1: rightRudderPedalValue
       125359 LUA.1: 0
       125375 LUA.1: leftRudderPedalValue
       125390 LUA.1: -16384
       125406 LUA.1: SOLENOID 0
       125437 LUA.1: HandleParkingBrake end:
       125469 LUA.1: HandleParkingBrake start:
       125484 LUA.1: rightRudderPedalValue
       125500 LUA.1: 0
       125515 LUA.1: leftRudderPedalValue
       125531 LUA.1: -16384
       125547 LUA.1: SOLENOID 0
       125578 LUA.1: HandleParkingBrake end:
       125609 LUA.1: HandleParkingBrake start:
       125625 LUA.1: rightRudderPedalValue
       125640 LUA.1: 0
       125656 LUA.1: leftRudderPedalValue
       125672 LUA.1: -16384
       125687 LUA.1: SOLENOID 0
       125719 LUA.1: HandleParkingBrake end:
       125750 LUA.1: HandleParkingBrake start:
       125765 LUA.1: rightRudderPedalValue
       125781 LUA.1: 0
       125797 LUA.1: leftRudderPedalValue
       125812 LUA.1: -16384
       125828 LUA.1: SOLENOID 0
       125859 LUA.1: HandleParkingBrake end:
       125890 LUA.1: HandleParkingBrake start:
       125906 LUA.1: rightRudderPedalValue
       125922 LUA.1: 0
       125937 LUA.1: leftRudderPedalValue
       125953 LUA.1: -16384
       125969 LUA.1: SOLENOID 0
       126000 LUA.1: HandleParkingBrake end:
       126031 LUA.1: HandleParkingBrake start:
       126047 LUA.1: rightRudderPedalValue
       126062 LUA.1: 0
       126078 LUA.1: leftRudderPedalValue
       126094 LUA.1: -16384
       126109 LUA.1: SOLENOID 0
       126140 LUA.1: HandleParkingBrake end:
       126172 LUA.1: HandleParkingBrake start:
       126187 LUA.1: rightRudderPedalValue
       126203 LUA.1: 0
       126219 LUA.1: leftRudderPedalValue
       126219 LUA.1: -16384
       126234 LUA.1: SOLENOID 0
       126265 LUA.1: HandleParkingBrake end:
       126297 LUA.1: HandleParkingBrake start:
       126312 LUA.1: rightRudderPedalValue
       126328 LUA.1: 0
       126344 LUA.1: leftRudderPedalValue
       126359 LUA.1: -16384
       126375 LUA.1: SOLENOID 0
       126406 LUA.1: HandleParkingBrake end:
       126437 LUA.1: HandleParkingBrake start:
       126453 LUA.1: rightRudderPedalValue
       126469 LUA.1: 0
       126484 LUA.1: leftRudderPedalValue
       126500 LUA.1: -16384
       126515 LUA.1: SOLENOID 0
       126547 LUA.1: HandleParkingBrake end:
       126578 LUA.1: HandleParkingBrake start:
       126594 LUA.1: rightRudderPedalValue
       126609 LUA.1: 0
       126625 LUA.1: leftRudderPedalValue
       126640 LUA.1: -16384
       126656 LUA.1: SOLENOID 0
       126687 LUA.1: HandleParkingBrake end:
       126719 LUA.1: HandleParkingBrake start:
       126734 LUA.1: rightRudderPedalValue
       126750 LUA.1: 0
       126765 LUA.1: leftRudderPedalValue
       126781 LUA.1: -16384
       126797 LUA.1: SOLENOID 0
       126828 LUA.1: HandleParkingBrake end:
       126859 LUA.1: HandleParkingBrake start:
       126875 LUA.1: rightRudderPedalValue
       126890 LUA.1: 0
       126906 LUA.1: leftRudderPedalValue
       126922 LUA.1: -16384
       126937 LUA.1: SOLENOID 0
       126969 LUA.1: HandleParkingBrake end:
       127000 LUA.1: HandleParkingBrake start:
       127015 LUA.1: rightRudderPedalValue
       127031 LUA.1: 0
       127047 LUA.1: leftRudderPedalValue
       127062 LUA.1: -16384
       127078 LUA.1: SOLENOID 0
       127109 LUA.1: HandleParkingBrake end:
       127140 LUA.1: HandleParkingBrake start:
       127156 LUA.1: rightRudderPedalValue
       127172 LUA.1: 0
       127187 LUA.1: leftRudderPedalValue
       127187 LUA.1: -16384
       127203 LUA.1: SOLENOID 0
       127234 LUA.1: HandleParkingBrake end:
       127265 LUA.1: HandleParkingBrake start:
       127281 LUA.1: rightRudderPedalValue
       127297 LUA.1: 0
       127312 LUA.1: leftRudderPedalValue
       127328 LUA.1: -16384
       127344 LUA.1: SOLENOID 0
       127375 LUA.1: HandleParkingBrake end:
       127406 LUA.1: HandleParkingBrake start:
       127422 LUA.1: rightRudderPedalValue
       127437 LUA.1: 0
       127453 LUA.1: leftRudderPedalValue
       127469 LUA.1: -16384
       127484 LUA.1: SOLENOID 0
       127515 LUA.1: HandleParkingBrake end:
       127547 LUA.1: HandleParkingBrake start:
       127562 LUA.1: rightRudderPedalValue
       127578 LUA.1: 0
       127594 LUA.1: leftRudderPedalValue
       127609 LUA.1: -16384
       127625 LUA.1: SOLENOID 0
       127656 LUA.1: HandleParkingBrake end:
       127687 LUA.1: HandleParkingBrake start:
       127703 LUA.1: rightRudderPedalValue
       127719 LUA.1: 0
       127734 LUA.1: leftRudderPedalValue
       127750 LUA.1: -16384
       127765 LUA.1: SOLENOID 0
       127797 LUA.1: HandleParkingBrake end:
       127828 LUA.1: HandleParkingBrake start:
       127844 LUA.1: rightRudderPedalValue
       127859 LUA.1: 0
       127875 LUA.1: leftRudderPedalValue
       127890 LUA.1: -16384
       127906 LUA.1: SOLENOID 0
       127937 LUA.1: HandleParkingBrake end:
       127969 LUA.1: HandleParkingBrake start:
       127984 LUA.1: rightRudderPedalValue
       128000 LUA.1: 0
       128015 LUA.1: leftRudderPedalValue
       128031 LUA.1: -16384
       128047 LUA.1: SOLENOID 0
       128078 LUA.1: HandleParkingBrake end:
       128109 LUA.1: HandleParkingBrake start:
       128125 LUA.1: rightRudderPedalValue
       128140 LUA.1: 0
       128156 LUA.1: leftRudderPedalValue
       128156 LUA.1: -16384
       128172 LUA.1: SOLENOID 0
       128203 LUA.1: HandleParkingBrake end:
       128234 LUA.1: HandleParkingBrake start:
       128250 LUA.1: rightRudderPedalValue
       128265 LUA.1: 0
       128281 LUA.1: leftRudderPedalValue
       128297 LUA.1: -16384
       128312 LUA.1: SOLENOID 0
       128344 LUA.1: HandleParkingBrake end:
       128375 LUA.1: HandleParkingBrake start:
       128390 LUA.1: rightRudderPedalValue
       128406 LUA.1: 0
       128422 LUA.1: leftRudderPedalValue
       128437 LUA.1: -16384
       128453 LUA.1: SOLENOID 0
       128484 LUA.1: HandleParkingBrake end:
       128515 LUA.1: HandleParkingBrake start:
       128531 LUA.1: rightRudderPedalValue
       128547 LUA.1: 0
       128562 LUA.1: leftRudderPedalValue
       128578 LUA.1: -16384
       128594 LUA.1: SOLENOID 0
       128625 LUA.1: HandleParkingBrake end:
       128656 LUA.1: HandleParkingBrake start:
       128672 LUA.1: rightRudderPedalValue
       128687 LUA.1: 0
       128703 LUA.1: leftRudderPedalValue
       128719 LUA.1: -16384
       128734 LUA.1: SOLENOID 0
       128765 LUA.1: HandleParkingBrake end:
       128797 LUA.1: HandleParkingBrake start:
       128812 LUA.1: rightRudderPedalValue
       128828 LUA.1: 0
       128844 LUA.1: leftRudderPedalValue
       128859 LUA.1: -16384
       128875 LUA.1: SOLENOID 0
       128906 LUA.1: HandleParkingBrake end:
       128937 LUA.1: HandleParkingBrake start:
       128953 LUA.1: rightRudderPedalValue
       128969 LUA.1: 0
       128984 LUA.1: leftRudderPedalValue
       129000 LUA.1: -16384
       129015 LUA.1: SOLENOID 0
       129047 LUA.1: HandleParkingBrake end:
       129078 LUA.1: HandleParkingBrake start:
       129094 LUA.1: rightRudderPedalValue
       129109 LUA.1: 0
       129125 LUA.1: leftRudderPedalValue
       129125 LUA.1: -16384
       129140 LUA.1: SOLENOID 0
       129172 LUA.1: HandleParkingBrake end:
       129203 LUA.1: HandleParkingBrake start:
       129219 LUA.1: rightRudderPedalValue
       129234 LUA.1: 0
       129250 LUA.1: leftRudderPedalValue
       129265 LUA.1: -16384
       129281 LUA.1: SOLENOID 0
       129312 LUA.1: HandleParkingBrake end:
       129344 LUA.1: HandleParkingBrake start:
       129359 LUA.1: rightRudderPedalValue
       129375 LUA.1: 0
       129390 LUA.1: leftRudderPedalValue
       129406 LUA.1: -16384
       129422 LUA.1: SOLENOID 0
       129453 LUA.1: HandleParkingBrake end:
       129484 LUA.1: HandleParkingBrake start:
       129500 LUA.1: rightRudderPedalValue
       129515 LUA.1: 0
       129531 LUA.1: leftRudderPedalValue
       129547 LUA.1: -16384
       129562 LUA.1: SOLENOID 0
       129594 LUA.1: HandleParkingBrake end:
       129625 LUA.1: HandleParkingBrake start:
       129640 LUA.1: rightRudderPedalValue
       129656 LUA.1: 0
       129672 LUA.1: leftRudderPedalValue
       129687 LUA.1: -16384
       129703 LUA.1: SOLENOID 0
       129734 LUA.1: HandleParkingBrake end:
       129765 LUA.1: HandleParkingBrake start:
       129781 LUA.1: rightRudderPedalValue
       129797 LUA.1: 0
       129812 LUA.1: leftRudderPedalValue
       129828 LUA.1: -16384
       129844 LUA.1: SOLENOID 0
       129875 LUA.1: HandleParkingBrake end:
       129906 LUA.1: HandleParkingBrake start:
       129922 LUA.1: rightRudderPedalValue
       129937 LUA.1: 0
       129953 LUA.1: leftRudderPedalValue
       129969 LUA.1: -16384
       129984 LUA.1: SOLENOID 0
       130015 LUA.1: HandleParkingBrake end:
       130047 LUA.1: HandleParkingBrake start:
       130062 LUA.1: rightRudderPedalValue
       130078 LUA.1: 0
       130078 LUA.1: leftRudderPedalValue
       130094 LUA.1: -16384
       130109 LUA.1: SOLENOID 0
       130140 LUA.1: HandleParkingBrake end:
       130172 LUA.1: HandleParkingBrake start:
       130187 LUA.1: rightRudderPedalValue
       130203 LUA.1: 0
       130219 LUA.1: leftRudderPedalValue
       130234 LUA.1: -16384
       130250 LUA.1: SOLENOID 0
       130281 LUA.1: HandleParkingBrake end:
       130312 LUA.1: HandleParkingBrake start:
       130328 LUA.1: rightRudderPedalValue
       130344 LUA.1: 0
       130359 LUA.1: leftRudderPedalValue
       130375 LUA.1: -16384
       130390 LUA.1: SOLENOID 0
       130422 LUA.1: HandleParkingBrake end:
       130453 LUA.1: HandleParkingBrake start:
       130469 LUA.1: rightRudderPedalValue
       130484 LUA.1: 0
       130500 LUA.1: leftRudderPedalValue
       130515 LUA.1: -16384
       130531 LUA.1: SOLENOID 0
       130562 LUA.1: HandleParkingBrake end:
       130594 LUA.1: HandleParkingBrake start:
       130609 LUA.1: rightRudderPedalValue
       130625 LUA.1: 0
       130640 LUA.1: leftRudderPedalValue
       130656 LUA.1: -16384
       130672 LUA.1: SOLENOID 0
       130703 LUA.1: HandleParkingBrake end:
       130734 LUA.1: HandleParkingBrake start:
       130750 LUA.1: rightRudderPedalValue
       130765 LUA.1: 0
       130781 LUA.1: leftRudderPedalValue
       130797 LUA.1: -16384
       130812 LUA.1: SOLENOID 0
       130844 LUA.1: HandleParkingBrake end:
       130844 === Hot key unregistered
       130844 === Stop called ...
       130859 === Closing external processes we started ...
       130875 LUA.1: HandleParkingBrake start:
       130890 LUA.1: rightRudderPedalValue
       130906 LUA.1: 0
       130922 LUA.1: leftRudderPedalValue
       130937 LUA.1: -16384
       130953 LUA.1: SOLENOID 0
       131875 === About to kill any Lua plug-ins still running ...
       132015 Lua threads being terminated:
       132015       1 = "E:\FSUIPC7\test.lua"
       132594 LUA: "E:\FSUIPC7\test.lua": killed
       132594 === Closing global Lua thread
       133625 === About to kill my timers ...
       133844 === Restoring window procs ...
       133844 === Unloading libraries ...
       133844 === stopping other threads ...
       133844 === ... Button scanning ...
       133937 === ... Axis scanning ...
       134047 === Releasing joystick devices ...
       134047 === Freeing macro memory
       134047 === Removing any offset overrides
       134047 === Clearing any displays left
       134062 === Calling SimConnect_Close ...
       134265 === SimConnect_Close done!
       134265 === AI slots deleted!
       134265 === Freeing button memory ...
       134265 === Closing my Windows ...
       134265 === Freeing FS libraries ...
       135281 === Closing devices ...
       135281 === Closing the Log ... Bye Bye! ...
       135281 System time = 18/02/2021 22:12:09
       135281 *** FSUIPC log file being closed
    Minimum frame rate was 45.3 fps, Maximum was 60.1 fps
    Average frame rate for running time of 123 secs = 56.3 fps
    Maximum AI traffic for session was 1 aircraft
    Traffic deletions 0 aircraft
    Memory managed: 4 Allocs, 3 Freed
    ********* FSUIPC Log file closed ***********

     

    The code I have used. The lua script seem to send some strange values, could it be bad pedals? Is it in som way possible to filter in the lua script?

    function HandleParkingBrake(time)
    
        ipc.log("HandleParkingBrake start:")
       
        rightRudderPedalValue = ipc.readSW(0x66F5)
        leftRudderPedalValue = ipc.readSW(0x66F6)
       
        ipc.log("rightRudderPedalValue")
        ipc.log(rightRudderPedalValue)
        ipc.log("leftRudderPedalValue")
        ipc.log(leftRudderPedalValue)
      
    
       if rightRudderPedalValue > 14000 and leftRudderPedalValue > 14000 then
            ipc.log("SOLENOID 1")
            ipc.writeUB(0x66E9, 1)
       else
            ipc.log("SOLENOID 0")
            ipc.writeUB(0x66E9, 0)
       end
       
       ipc.log("HandleParkingBrake end:")
    
    end
    
    
    event.timer(10, "HandleParkingBrake")

     

     

     

     

     

  3. 11 minutes ago, John Dowson said:

    Also check that you are calling event.offset for those two offsets.

    How do I do that in a correct way?

    Is this the correct way? :

    event.offset(0x66E1, "SD", "myFunction")

    event.offset(0x66F5, "SD", "myFunction")

     

    Is Ther any spacing I should be aware of, or careful with?

  4. 32 minutes ago, John Dowson said:

    But thats just the function I gave you. I have still no idea what you are talking about. What do you mean by 'the "And" between 66E1 and 66F5 don't work'? What does 'don't work' actually mean? what is 'between'? What 'And'? You aren't making any sense to me.

    When I press the brake pedal that sends data to offset 66F5 the Offset 66E9 change, from 0 to 1 witch is partly correct.

    But when I push the brake pedal that sends data to 66E1 nothing happens.

     

    What I want to happen is that I have to push bothe pedals to set 1 on 66E9.

     

    And it should not matter if I  start pushing the left pedal that sends data to 66E1 or 66F5. The condition should be that bothe pedals should be pushed, and speed less then 20 knots.

     

    When I  sad "and" between 66E1 and 66F5, don't work. I meant that the condition "and" dose not seem to do anything?

    This line of code:

    if val1 > 14000 and val2 > 14000 and groundSpeed < 20 then

     

    It say if val1 and val2?

     

    In my understanding the code should tak in to account both val1 and val2?

     

  5. 20 minutes ago, John Dowson said:

    What does this mean? What is an 'And function'?

    If a lua script doesn't work, activate logging for lua plugins and try and determine what the problem is from the log output.

     

    function myFunction(offset, value)

     

        -- read 1st axis offset

         val1 = ipc.readSD(0x66F5)

        -- read 2nd axis offset

         val2 = ipc.readSD(0x66E1)

        -- read Ground Speed offset

         groundSpeed = ipc.readSD(0x02B4)

         -- convert groundSpeed to Knots

         groundSpeed = (groundSpeed / 65536) * 1.94384

     

       if val1 > 14000 and val2 > 14000 and groundSpeed < 20 then

            ipc.writeUB(0x66E9, 1)

       else

            ipc.writeUB(0x66E9, 0)

       end

     

    end

     

    (Unable to send code on my phone)

     

    Also tested this: 

    https://share.icloud.com/photos/0OkaoN7e_W6v96khJMdZD0cTg

     

  6. 5 minutes ago, John Dowson said:

    What does this mean? What is an 'And function'?

    If a lua script doesn't work, activate logging for lua plugins and try and determine what the problem is from the log output.

     

    God tip I will do that.

     

    Maybe it is not called function.

     

    But the "And" between 66E1 and 66F5 don't work?

  7. 50 minutes ago, John Dowson said:

    And why change from 0x66E5 to 0x66F5? Ots a good idea to group the user offsets you use consecutively, but  its not a functional issue.

    Something ells is writing to 0x66E5, but I have no Ide what. It may be something inside ProSim, have to check. But that offset did not work.

    I will test the latest script you sent. Much easier for me to understand. Thank you.

    I would also like to get into the script that GS must be below 20 knots to be able to activate 0x66E9 to 1, how can I do that?

    I read this:

    02B4    4    GS: Ground Speed, as 65536*metres/sec. Not updated in Slew mode!

    https://forum.simflight.com/topic/5924-fsuipc-need-help-with-ground-speed-offset-02b4/

    65536*10,29 =674365,44 about= 674365

    or should I devide it?

     

    can I write like this:

    function myFunction(offset, value)
    
        -- read 1st offset
         val1 = ipc.readSD(0x66F5)
        -- read 2nd offset
         val2 = ipc.readSD(0x66E1)
        -- read 3ed offset
         val3 = ipc.readSD(0x02B4)
    
       if val1 > 14000 and val2 > 14000 and val3 < 674365 then
            ipc.writeUB(0x66E9, 1)
      else
            ipc.writeUB(0x66E9, 0)
      end
    
    end

     

    Best regards!

     

     

     

  8. 11 hours ago, John Dowson said:

    If you are writing a double word (4 bytes) to 0x66E1. then that value is held in 4 bytes from that offset, so in 0x66E1-0x66E4 inclusive.
    However, you are overwriting that value here: ipc.writeUB (0x66E2, 1).
    Try using 0x66E5 instead.

    Also, is the value signed or unsigned? This is important when reading. I assume signed below - change to unsigned if needed.

    Using event.timer was also just an example to get you going. Its probably more efficient to use event.offset, and you can use the same handling function for multiple offsets.

    But that is one offset. What is the second offset you are using? And always specify the size of the value you are writing to that offset. If you are writing an axis value of as a dword, then it will take 4 bytes. If thats one axis, then you can write the second axis starting at 0x66E5.

    Which offset? If you want them consecutive, the next 'free\ one is 0x66E9, so why not use that?

    So, assuming your two axis values are written to 0x66E1 and and 0x66E5, and the flag we are using is in 0x66E9, try

     

    Later...I see Pete also responded at the same time!

    I changed a few things an now it works fairly good.

    function myFunction(offset, val2)

        -- read 1st offset
      if offset == 0x66E1 then
         val1 = ipc.readSD(0x66F5)
       elseif offset == 0x66F5 then
         val2 = ipc.readSD(0x66E1)
      end

       if val1 > 14000 and val2 > 14000 then
            ipc.writeUB(0x66E9, 1)
      else
            ipc.writeUB(0x66E9, 0)
      end

    end

    event.offset(0x66E1, "SD", "myFunction")

    event.offset(0x66F5, "SD", "myFunction")

  9. 2 hours ago, John Dowson said:

    But that is one offset. What is the second offset you are using? And always specify the size of the value you are writing to that offset. If you are writing an axis value of as a dword, then it will take 4 bytes. If thats one axis, then you can write the second axis starting at 0x66E5.

    I only tested with one offset and one pedal to see if I could get that working.

     

    What in the code is specifying the size of the value? UB, SW and so on?

     

    Any way so the code you sent will send a 0 or 1 to 0x66E9 depending on if 0x66E1 and 0x66E5 is above or below 15000 on the input axis.

    So -16383 to 14999 on the input axis will give 0 on 0x66E9.

    And 15000 to 16383 will give 1 on the 0x66E9 Offset?

    And it will do this in real time?

    I mean that it will continue to be 1 or 0 as long as the value is over 15000?

    Regards Jacob!

     

     

  10. Maybe this is more clear:

    What I want is:

    1: 2 axis prograned to two FSUIPC offsets. Let's say 0x66E1 

     

    2: I want the Lua script to read the two offsets, continuously several times a second.

     

    3: When bothe of the offsets read a value over 15000 I want another offset to change from 0 to 1.

     

    4: When bothe or any of the offsets go below 15000 I want the offset that changed from 0 to 1, to go to 0.

     

    5: I want this to happen in real time.

     

    I have tried to make a script but it doesn't work and it write a value of -64 to + 64 to the offset 0x66E2, instead of 0 or 1.

  11. I think I use the wrong offset typ/format in the script, berceuse Offset 0x66E2 is relesed when 

    0x66E1 go to 0 not over 10000 or 15000 like I want.

    FSUIPC AXIS write to x66E1, Offset Dword Set

    ProSim brake axis read 0x66E6 (FSUIPC 16 Bit S) 

    I want the script to read 66E1 (The brake axis)

    And if the value goes over 15000 send and keep the Offset 0x66E2 to 1 and if the brake axis go under say 15000 I want the value to go to 0.

     

    This dose not seem to work?

     

    function myFunction(time)

        -- read 1st offset
       val1 = readUD (0x66E1)
       val2 = readUD (0x66E1)

       if val1 > 15000 and val2 > 15000 then
            ipc.writeUB (0x66E2, 1)
      else
            ipc.writeUB (0x66E2, 0)
      end

    end

     

    event.timer(200, "myFunction")

     

    Regards Jacob
     

  12. 2 minutes ago, John Dowson said:

    Why? As I said, just don't touch that section. It is managed by FSUIPC - leave it alone!

    Why did you change it? What are you trying to read? You use the read function corresponding to the data type of the data held in the offset you want to read.

    Please see the lua documentation for event.offset, in the Lua Library document. Also, take a look at the example lua files provided - there should be a zip file containing examples in your FSUIPC documents folder.

    I thought you ment that:

    [LuaFiles]
    1=test

    Needed too be removed.

    I added those lines my self. bothe [Auto] and [LuaFiles]

    I tried to read page 29 of 40: 

    event.offset(offset, "type", "function-name") event.offset(offset, "STR", length, "function-name") Your processing function: function-name(offset, value)

    Executes the named function (named as a string, “...”), which must be defined before this line, when the specified FSUIPC offset changes The function is also executed initially, when the plugin is first run, in order to initialise things. This saves using an explicit call to do the same. The offset can be specified in Lua format hexadecimal, e.g. 0x0AEC, or in decimal, or as a string e.g. “0AEC”. The type is one of these:

    UB unsigned 8-bit byte

    UW unsigned 16-bit word

    UD unsigned 32-bit dword

    SB signed 8-bit byte

    SW signed 16-bit word

    SD signed 32-bit dword

    DD signed 64-bit value

    DBL 64-bit double floating point

    FLT 32-bit single floating point

    STR string of ASCII characters

    The length parameter is omitted (or ignored) except for the “STR” type, where it can optionally define the string length (max 256). If the length is omitted for the STR type then the string will be zero terminated and will have a maximum length of 255 not including the final zero. The function is called with the offset, so that the same function can, if desired, be used for more than one such event, and also the current (new) value in that offset. This will be a Lua number for all types except STR where it will be a string

     

    I read this thread: https://www.flightsimsweden.se/knowledge-base/lua/


    Maybe it is better I explain what I want to do.

    I want to read 2 offsets and when they bothe are more then 10000 in value, I want another offset to change from 0 to 1. 

    The 2 offset should be betwen -16383 to + 16383

    If bothe are under 10000 an offset change to 0 and if bothe are over 10000 an offset change to 1.

     

    I just wanted with this first test to se If I could get one offset to change another offsets value with a lua script.

     

    Regards.

  13. 9 minutes ago, John Dowson said:

    Whats the issue? The log shows your lua is running ok.
    However, you are reading from 0x67E7, which is in a reserved area. Are you sure thats correct?

    Other than that, your lua is running ok - it will just run and exit.
    If you want to keep it running, and update an offset when another offset changes, you probably want to ne using the event.offset function. Then the lua thread will keep running, waiting for that offset to change, and then calling the event function, in which you can write to your other offset.

    If thats not what you need, then maybe activate the lua on a button or key press rather than have it auto-started.

    Don't write the [LuaFiles] section. This is constructed automatically from the lua files (old/removed and new) and shouldn't be manually changed. Just add your luas to the [Auto] section when you want them auto-started.

    John

     

    I also removed the: 

     

    [LuaFiles]
    1=test

     

  14. 1 minute ago, John Dowson said:

    Whats the issue? The log shows your lua is running ok.
    However, you are reading from 0x67E7, which is in a reserved area. Are you sure thats correct?

    Other than that, your lua is running ok - it will just run and exit.
    If you want to keep it running, and update an offset when another offset changes, you probably want to ne using the event.offset function. Then the lua thread will keep running, waiting for that offset to change, and then calling the event function, in which you can write to your other offset.

    If thats not what you need, then maybe activate the lua on a button or key press rather than have it auto-started.

    Don't write the [LuaFiles] section. This is constructed automatically from the lua files (old/removed and new) and shouldn't be manually changed. Just add your luas to the [Auto] section when you want them auto-started.

    John

     

    Ofcourse I want to use free ofssets. 

     

    Can you change the code with a free offest and event.offset function on the correct place.

     

    I changed, to this:

    if (ipc.readUB(0x67E7) == 1) then

       ipc.writeUB (0x66E2, 1)

    end

     

    I changed offset and WB to UB, I hope that is correct?

     

     

  15. This is what FSUIPC log say:

     

          234 -------------------------------------------------------------------
          266 LogOptions=00000000 00000001
         3156 Simulator detected
         8187 SimConnect_Open succeeded
         8187 Running in "KittyHawk", Version: 11.0.282174.999 (SimConnect: 11.0.62651.3)
         8187 MSFS version = 11.0.282174.999
         8187 Initialising SimConnect data requests now
         8203 C:\Users\jacob\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\MISSIONS\Custom\CustomFlight\CustomFlight.FLT
         8203 SimObjects\Airplanes\prosim_b738\aircraft.CFG
         8203 User Aircraft ID 1 supplied, now being used
         8281 Aircraft loaded: running normally now ...
         8953 Aircraft="Prosim_B738 2021a KLM"
         8953 System time = 14/02/2021 14:07:51, Simulator time = 13:18:48 (12:18Z)
        16016 -------------------- Starting everything now ----------------------
        16094 LUA.1: beginning "E:\FSUIPC7\test.lua"
        16094 LUA.1: E:\FSUIPC7\test.lua:1
        16109 LUA.1: Global: ipcPARAM = 0
        16125 LUA.1: E:\FSUIPC7\test.lua:5
     

  16. Hi all!

     

    This is my first attempt with lua, or any code for that matter.

     

    I know nothing about programing so pleas bare with me.

     

    My first attempt is to get one FSUIPC Offset to change another offset from 0 to 1. But this dose not seem to work.

     

    I use MSFS2020 and are using FSUIPC7

    I have pot the "test.lua" text file in the root of FSUIPC folder.

     

    This is the code I am trying.

    If (ipc.readUW(0x67E7) == 1) then

    ipc.writeUB (0x66E2, 1)

    end

     

     

     

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