Jump to content
The simFlight Network Forums

P-38L

Members
  • Posts

    24
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Colombia

P-38L's Achievements

Apprentice

Apprentice (3/14)

  • Dedicated Rare
  • Collaborator Rare
  • First Post Rare
  • Conversation Starter Rare
  • Week One Done

Recent Badges

0

Reputation

  1. Dear Mr. John I finally understood how it should be done. I didn't know about assigning one variable to 0x2750 and the next to 0x2758; I thought I could use normal consecutive numbers. Now knowing that I have finally this: 90=L:var_cabinPressureDifferential=0x2750 91=L:var_cabinPressurizationAltitude=0x2758 92=L:var_cabinClimbRate=0x2760 and then from there, I took them to SIOC at Opencockpits for the analog instruments and they are working perfectly. I really appreciate your great help and patience. Alejandro
  2. If you list the lvars (Add-ons -> WASM -> List Lvars) do you see the lvars with the correct values? Yes sir. The same value as shown in the instrument. And I put it in two memory addresses like this: 92=CABIN_PRESS_ALT=0x2748 93=var_cabinPressurizationAltitude=0x2749 Row 93 contains the original airplane variable. Row 92 contains my own variable, which I wrote like this: ipc.execCalcCode("1 if{ (L:var_cabinPressurizationAltitude, FT) 1 * 0 < if{ 0 100 360 / * } els{ (L:var_cabinPressurizationAltitude, FT) 1 * 45000 > if{ 360 100 360 / * } els{ (L:var_cabinPressurizationAltitude, FT) 1 * 0 - 45000 0 - / 360 0 - * 0 + 100 360 / * } } } 10 * (>L:CABIN_PRESS_ALT)") In both examples the reading of the variable value does not match at all: Here is the copy of the .ini and .log files: FSUIPC7.log FSUIPC7.ini
  3. Dear Mr. Dowson I tried with the examples you kindly gave me, but I still don't get the number that the simulator shows me. I even tried using SB, UB, SW, UW, SD, UD and F and none of those options give me the answer, it even gives me random numbers including negative numbers that "jump" from positive to negative quickly. After many attempts I came up with this idea: ipc.execCalcCode("(L:var_cabinPressureDifferential, PSI) 100 * (>L:CABIN_PRESS_DIFF)") and then I got the exact number; So far so good, 1 out of 2. But I haven't had any luck with the variable: ipc.execCalcCode("(L:var_cabinPressurizationAltitude) (>L:CABIN_PRESS_ALT)") I've even written it like this without getting any positive result: ipc.execCalcCode("(L:var_cabinPressurizationAltitude, FT) (>L:CABIN_PRESS_ALT)") I don't know if I should use a multiplier or divisor like I did with the "var_cabinPressureDifferential" variable, but I've used all my math resources without any optimal answer. It always jumps like crazy from negative to positive for no apparent reason. Alejandro
  4. Hello I am using the KingAir analog from BlackSquare. I am trying to assign the value of two L type variables to a specific address or another variable. . It can be noted that both values coincide with what the instrument needles indicate. I then wrote the following codes: local circuitConnection = ipc.readLvar("L:var_cabinPressurizationAltitude") local valueToWrite = circuitConnection ipc.writeUB(0x274A, valueToWrite) local circuitConnection = ipc.readLvar("L:var_cabinPressureDifferential") local valueToWrite = circuitConnection ipc.writeUB(0x2749, valueToWrite) But the values read from these addresses are very different. I have also tried it this way: ipc.execCalcCode("(L:CABIN_PRESS_DIFF)") ipc.execCalcCode("(L:CABIN_PRESS_ALT)") ipc.reloadWASM(); ipc.execCalcCode("(L:var_cabinPressureDifferential, Number) (>L:CABIN_PRESS_DIFF)") ipc.execCalcCode("(L:var_cabinPressurizationAltitude, Number) (>L:CABIN_PRESS_ALT)") Considering that I have assigned an address to these variables within the FSUIPC7.ini [LvarOffsets] 91=CABIN_PRESS_DIFF=UB2747 92=CABIN_PRESS_ALT=UB2748 And the result has been equally wrong. If you could please give me some idea of how to get the indicated value to be the one I need to read and write to an address or another variable. Thank you very much. Alejandro Gómez.
  5. Hello Mr. Dowson. With your wonderful explanation, I was able to improve my programming code. I have made great progress, and so far I have managed to control a large percentage of the cockpit elements. Thank you very much for your valuable help. Alejandro
  6. Excellent explanation. I finally got it done thanks to your kind help. I will have to use some variables with the method I showed you and I am already using others with myOffsets. Example: ipc.execCalcCode("(A:PROP RPM:1, rpm) 1370 < (>L:L_PROP_PITCH)") ipc.writeUB(0x66C0, ipc.readLvar("L:L_PROP_PITCH")) In this case, I need the value to be given only when the number in variable A is less than 1370, otherwise it will always be a zero. I don't know if this can be done in the myOffsets.txt file as well. In the following example the variable depends on two variables A and L to deliver the value. In all these cases it is working fine. Also, I don't know if this method can be implemented in the myOffsets.txt file. ipc.execCalcCode("20 13 (>A:BUS LOOKUP INDEX,number) (A:CIRCUIT CONNECTION ON:20, number) ! (>L:CBL_BAT_RELAY)") ipc.writeUB(0x66C2, ipc.readLvar("L:CBL_BAT_RELAY"))
  7. Hello I am programming the reading and assignment of variables, so far everything has been fine. I am using the following line of code and it works perfectly since I can assign the value of variable A to variable L. ipc.execCalcCode("(A:CIRCUIT ON:89, Bool) (>L:WING_DEICE)") ipc.writeUB(0x66C8, ipc.readLvar("L:WING_DEICE")) I am doing this so that I can get the values of the KingAir Analogic in MFS2020 indicator lights. My question is this: the LED turns on when the switch is activated or when the light test button is pressed using the mouse only. But in the latter case, the LED does not turn on, it only turns on when I use the switch. What I am looking for is for it to turn on when the switch is used or when the light test button is pressed. Something like the following, but that doesn't work for me. Only the LED lights up when I use the Light Test, but not when I use the switch. ipc.execCalcCode("(A:CIRCUIT ON:89, Bool) or (L:var_GlareshieldAnnunciatorTest, Number) (>L:WING_DEICE)") ipc.writeUB(0x66C8, ipc.readLvar("L:WING_DEICE")) I've tried OR and AND but I can't get it to work. Any help would be greatly appreciated.
  8. Hello Mr. Dowson I finally did it... in a different way, but I managed to do it. I'm going to share with you the method I did. I used MobiFlight and assigned an action to an axis of my joystick (Saitek X52 Pro) that is always generating "electronic noise", in this case it is the Axis Slider 1 and I wrote the following code: 20 13 (>A:BUS LOOKUP INDEX,number) (A:CIRCUIT CONNECTION ON:137, Bool) 100 * - (>L:CIRCUIT_CONNECTION_ON_37) I am using (A:CIRCUIT CONNECTION ON:137) instead of 37, because the command line indicates this number. If I move the Relay with the mouse, the value automatically changes from 20 to -80, even if I do it with the button assignment on the joystick it also makes this change. So far so good... but unfortunately I don't know how to make MobiFlight always "watch" the value of a variable without having to assign it to any button or axis. Luckily, the Axis Slider 1 has a damaged potentiometer and generates that "electronic noise"; so, in this way, it is always "reading" and "writing" the values. I am very grateful for your valuable help, your dedication and time, and for your admirable patience. PD: If you know the trick I need in MobiFlight, I would really appreciate it. Regards Alejandro Gómez
  9. A little progress. I wrote the following line of code based on what you shared with me. Due to the Relay's behavior, the values are 20 and -80 according to the table. And the value that it gives me at address 66C0 is indeed the number 20, but even if the Relay is pushed or pulled, the value will always be 20. Even if the Relay is Pulled and I restart the FSUIPC7, the value will always be 20. It does not show me the -80 If I write the following in the myOffests.txt file, the value will always be 0, that's why I had to remove this line of code.
  10. Inside the FSUIPC7.ini program I have written: And in the same folder of the FSUIPC7 I have a file "Ejecutar.lua" But the value written in 66C0 doesn't change at all. I don't know if I'm misinterpreting the variables. To make sure it was working, I did a test with an L type variable, and in this case, it does work. Here the value written to 66C0 is always "looking" at the value of the variable. Honestly, I don't know what to do.
  11. Thank you for your kind reply. The process you indicate I have written in LUA and it actually works, but the variable (>L:My_Relay_Result) only shows its value when I execute the joystick action assigned to that LUA command. For example, if the Relay "jumps" automatically for some reason due to a failure in the plane, the variable (>L:My_Relay_Result) does not show any change in value unless I press the Joystick button assigned to the joystick, and this is when the value is updated. Is there any way for the variable to show its value automatically when it senses a change in the plane, without me having to press any button for its value to change?
  12. Dear Mr. Dowson, I am very grateful to you for taking the time to help me with this task. I will continue to investigate and do trial-and-error tests. If I manage to figure it out, I will share it. Thank you very much.
  13. Thank you for your kind reply. My bad, I thought the variable was only (A:CIRCUIT CONNECTION ON:37), but looking closely I found that the variable has a very different presentation. Using the mouse when the Relay is pushed, these are the values it presents: And when the Relay is pulled, these are the values: I don't know how to change the values indicated here using LUA programming. I've been experimenting with other variables and they work fine. For example, using the programming you kindly shared with me, I was able to see the behavior of assigning new variables. In my FSUIPC7.ini file I have the following written: And without any problems I was able to read values that I myself wrote from the LUA programming. My experiment worked thanks to your help. My big problem is that I don't know how to solve the problem of the variable that appears as I indicated in the first two images. I appreciate your valuable help.
  14. Hello I am programming in LUA and I want to read or write the value of the variable (A:CIRCUIT CONNECTION ON:37) which belong to the analog KingAir. Inside the directory F:\SteamLibrary\Community\fsuipc-lvar-module I only have the "modules" directory and three files namely: FSUIPC_WASM.ini layout.json manifest.json In the LUA programming it tells me that I cannot read variables of type "A". What should I do or what am I missing to be able to achieve this? To find out if the LUA program I'm writing is working, I wrote the following line: ipc.keypressplus(76) which uses the letter "L" to turn the lights on or off. This works fine from my joystick Here is my code: local circuitState = ipc.readAvar("A:CIRCUIT CONNECTION ON:37", "Bool") ipc.display("Circuit Breaker 37: " .. circuitState) local state = ipc.readLvar("L:Circuit37", 1) if state == 0 then ipc.writeLvar("L:Circuit37", 1) else ipc.writeLvar("L:Circuit37", 0) end But it doesn't work Any help will be greatly appreciated.
  15. Dear Mr. Dowson. I am very grateful for your magnificent help. Thanks to your advice I was able to achieve it. I am going to perfect the method of using LVARS through MobiFlight.
×
×
  • 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.