RNP scripts working in version 4.1
RNP scripts working in version 4.1
Hi all
I´ve just read the irst time, 4.2 comes with a fs2020_rpn(rpn_script) command?
https://siminnovations.com/forums/viewt ... 102#p52102
Hey, why nobody told me here when I asked for help regarding the MD-80? I know, the old MD-80 is not attracting interest
https://siminnovations.com/forums/viewtopic.php?t=6807
Anyway, meanwhile I found out by many hours of "try and error" (at least the MD-80 RPNs) implementing them in 4.1 if someone is interested.
Attached a two way and three way switch:
Callbacks by LVARs, the command lines need two commands at once in a specific order. You´ll find out comparing them with the Hubhob published ones, or reading the specific .xml file (MSFS\Community\lsh-maddogx-aircraft\SimObjects\Airplanes\MaddogX\model).
Regards,
Herbert
Two way (also pushbutton commands):
function autot_click(position)
if position == 0 then
switch_set_position(autot_switch, 1)
fs2020_variable_write("L:fgcp_event", "number", 536870931)
fs2020_variable_write("L:fgcp_event", "number", 8211)
elseif position == 1 then
switch_set_position(autot_switch, 0)
fs2020_variable_write("L:fgcp_event", "number", 536870931)
fs2020_variable_write("L:fgcp_event", "number", 8211)
end
end
Three way:
ffunction landing_cb(position, direction)
if direction == -1 then
fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
fs2020_variable_write("L:ext_lights_event", "number", 536870912)
elseif direction == 1 then
fs2020_variable_write("L:ext_lights_event", "number", 536870912)
fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
end
end
Dials working same:
function baro_dial_it(direction)
if direction == 1 then
fs2020_variable_write("L:CM1_efisctrl_event", "number", 8192)
fs2020_variable_write("L:CM1_efisctrl_event", "number", 16384)
elseif direction == -1 then
fs2020_variable_write("L:CM1_efisctrl_event", "number", 16384)
fs2020_variable_write("L:CM1_efisctrl_event", "number", 8192)
end
end
I´ve just read the irst time, 4.2 comes with a fs2020_rpn(rpn_script) command?
https://siminnovations.com/forums/viewt ... 102#p52102
Hey, why nobody told me here when I asked for help regarding the MD-80? I know, the old MD-80 is not attracting interest
https://siminnovations.com/forums/viewtopic.php?t=6807
Anyway, meanwhile I found out by many hours of "try and error" (at least the MD-80 RPNs) implementing them in 4.1 if someone is interested.
Attached a two way and three way switch:
Callbacks by LVARs, the command lines need two commands at once in a specific order. You´ll find out comparing them with the Hubhob published ones, or reading the specific .xml file (MSFS\Community\lsh-maddogx-aircraft\SimObjects\Airplanes\MaddogX\model).
Regards,
Herbert
Two way (also pushbutton commands):
function autot_click(position)
if position == 0 then
switch_set_position(autot_switch, 1)
fs2020_variable_write("L:fgcp_event", "number", 536870931)
fs2020_variable_write("L:fgcp_event", "number", 8211)
elseif position == 1 then
switch_set_position(autot_switch, 0)
fs2020_variable_write("L:fgcp_event", "number", 536870931)
fs2020_variable_write("L:fgcp_event", "number", 8211)
end
end
Three way:
ffunction landing_cb(position, direction)
if direction == -1 then
fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
fs2020_variable_write("L:ext_lights_event", "number", 536870912)
elseif direction == 1 then
fs2020_variable_write("L:ext_lights_event", "number", 536870912)
fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
end
end
Dials working same:
function baro_dial_it(direction)
if direction == 1 then
fs2020_variable_write("L:CM1_efisctrl_event", "number", 8192)
fs2020_variable_write("L:CM1_efisctrl_event", "number", 16384)
elseif direction == -1 then
fs2020_variable_write("L:CM1_efisctrl_event", "number", 16384)
fs2020_variable_write("L:CM1_efisctrl_event", "number", 8192)
end
end
Herbert Puukka
MSFS - CRJ, X-Plane - Citation X, Air Manager, FSHud, Navigraph
MSFS - CRJ, X-Plane - Citation X, Air Manager, FSHud, Navigraph
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: RNP scripts working in version 4.1
Hi @Puukka it's you who alert me on the upcoming RPN for MSFS area, I guess I miss the other post reporting this and also not read new addition in the wiki for a while
There's sometime some who are ahead in following changes and you were at least two simmers including you ...
I will have a look into your instruments, the MD8n are just aircrafts I've not already taken time to appropriate the avionics yet, though I really like the cockpit with its specific layout
There's sometime some who are ahead in following changes and you were at least two simmers including you ...
I will have a look into your instruments, the MD8n are just aircrafts I've not already taken time to appropriate the avionics yet, though I really like the cockpit with its specific layout
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: RNP scripts working in version 4.1
Didn't realize it was of a payware addon, sorry : https://secure.simmarket.com/leonardo-s ... 546).phtml
So I will just try to add the X-Plane compatibility if I'm able
So I will just try to add the X-Plane compatibility if I'm able
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: RNP scripts working in version 4.1
Hi Herbert, I've just added x-plane handling in your Autopilot Switch
Feel free to do what you want with this addition
As the FS2020 and X-Plane statements are performing the same action in both ways, then the two function may as well be simplified as below. I've also used SI snippet to get the position reversed ("fif" statement)
Feel free to do what you want with this addition
As the FS2020 and X-Plane statements are performing the same action in both ways, then the two function may as well be simplified as below. I've also used SI snippet to get the position reversed ("fif" statement)
Code: Select all
--[[
MD-80 Autopilot Switch
Author Herbert Puukka
1.0.1 enjxp_SimPassion 01/27/2023 Add X-Plane handling and shortening in function
1.0.0 Herbert Puukka 01/27/2023 Initial Release
--]]
img_add_fullscreen("background.png")
function autot_click(position)
pos = fif(position == 1,0,1)
switch_set_position(autot_switch, pos)
fs2020_variable_write("L:fgcp_event", "number", 536870931)
fs2020_variable_write("L:fgcp_event", "number", 8211)
xpl_command("laminar/md82cmd/autopilot/autothrottle_switch")
end
autot_switch = switch_add("sw_big_dwn.png", "sw_big_up.png", 18, 47, 45, 115, autot_click)
--536870912 19 + (>L:fgcp_event, number)
--8192 19 + (>L:fgcp_event, number)
function ss_at(at_on)
switch_set_position(autot_switch, at_on)
end
fs2020_variable_subscribe("L:fgcp_autopilot_switch1", "Int", ss_at)
xpl_dataref_subscribe("laminar/md82/autopilot/autothrottle_switch","FLOAT",ss_at)
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: RNP scripts working in version 4.1
Here's for the landing lights, where I've also added the side handling for X-Plane (Left or Right), let me know which are the values to write in MSFS for Right side and I will add and rework the first function a bit and accordingly, with simplification for the two sims.
Code: Select all
--[[
MD-80 Landing Switches Left or Right based on user property
Author Herbert Puukka
1.0.1 enjxp_SimPassion 01/27/2023 Add X-Plane handling and shortening in function
Add two sides handling for X-Plane
1.0.0 Herbert Puukka 01/27/2023 Initial Release
--]]
up_side_str = user_prop_add_enum("LDG LIGHT side","Left,Right","Left", "You can choose one of these choices")
side_str = user_prop_get(up_side_str)
side_num = fif(side_str == "Left",2,3)
img_add_fullscreen("background.png")
--landing light
function landing_cb(position, direction)
if direction == -1 then
fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
fs2020_variable_write("L:ext_lights_event", "number", 536870912)
elseif direction == 1 then
fs2020_variable_write("L:ext_lights_event", "number", 536870912)
fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
end
if side_num == 2 then
if direction == -1 then
xpl_command("laminar/md82cmd/switches/landing_lights_switch_L_dwn")
elseif direction == 1 then
xpl_command("laminar/md82cmd/switches/landing_lights_switch_L_up")
end
else
if direction == -1 then
xpl_command("laminar/md82cmd/switches/landing_lights_switch_R_dwn")
elseif direction == 1 then
xpl_command("laminar/md82cmd/switches/landing_lights_switch_R_up")
end
end
end
landing_id = switch_add("sw_big_dwn.png", "sw_big_middle.png","sw_big_up.png", 18, 47, 45, 115, landing_cb)
function set_ldg(sw_pos)
if sw_pos == 2 then
sw_pos = 0
elseif sw_pos == 1 then
sw_pos = 1
elseif sw_pos == 0 then
sw_pos = 2
end
switch_set_position(landing_id, sw_pos)
end
fs2020_variable_subscribe("L:CM1_winglightl_switch1", "Number", set_ldg)
function xpl_set_ldg(sw_pos)
pos = sw_pos[side_num] + 1
set_ldg(pos)
end
xpl_dataref_subscribe("sim/cockpit2/switches/landing_lights_switch","FLOAT[16]",xpl_set_ldg)
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: RNP scripts working in version 4.1
Here's for taxi lights, notice you have to update the values for it to work for MSFS :
Here's some inputs on MSFS side :
Code: Select all
--[[
MD-80 Taxi Lights
Author Herbert Puukka
1.0.1 enjxp_SimPassion 01/27/2023 Add X-Plane handling and shortening in function
1.0.0 Herbert Puukka 01/27/2023 Initial Release
--]]
img_add_fullscreen("background.png")
--landing light
function taxi_cb(position, direction)
if direction == -1 then
-- fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
-- fs2020_variable_write("L:ext_lights_event", "number", 536870912)
xpl_command("laminar/md82cmd/switches/landing_lights_switch_nose_dwn")
elseif direction == 1 then
-- fs2020_variable_write("L:ext_lights_event", "number", 536870912)
-- fs2020_variable_write("L:ext_lights_event", "number", 2147483648)
xpl_command("laminar/md82cmd/switches/landing_lights_switch_nose_up")
end
end
taxi_id = switch_add("sw_big_dwn.png", "sw_big_middle.png","sw_big_up.png", 18, 47, 45, 115, taxi_cb)
function set_taxi(sw_pos)
if sw_pos == 2 then
sw_pos = 0
elseif sw_pos == 1 then
sw_pos = 1
elseif sw_pos == 0 then
sw_pos = 2
end
switch_set_position(taxi_id, sw_pos)
end
-- fs2020_variable_subscribe("L:CM1_winglightl_switch1", "Number", set_taxi)
xpl_dataref_subscribe("sim/cockpit2/switches/taxi_light_on","INT",set_taxi)
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: RNP scripts working in version 4.1
Just a quick POC on annunciators displays with 14 segment LEDs
Last edited by SimPassion on Sat Jan 28, 2023 3:49 am, edited 2 times in total.
Re: RNP scripts working in version 4.1
@SimPassion Merci beaucoup Gilles, great, thanks a lot for your help!
I will consider the X-Plane 12 default version, or maybe the Rotate version, when it´s been updated for X-Plane 12 too, X-Plane coding is so much easier using the Dataref tool.
Kind regards from Austria,
Herbert
I will consider the X-Plane 12 default version, or maybe the Rotate version, when it´s been updated for X-Plane 12 too, X-Plane coding is so much easier using the Dataref tool.
Kind regards from Austria,
Herbert
Herbert Puukka
MSFS - CRJ, X-Plane - Citation X, Air Manager, FSHud, Navigraph
MSFS - CRJ, X-Plane - Citation X, Air Manager, FSHud, Navigraph
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: RNP scripts working in version 4.1
You're welcome Herbert, I've started from your great idea and now discovering the MD-82 in XP12, though far less advanced than the Leonardo, as there's still many not working switches and dials in this default addon. One very good point is the graphics part is very high-level on visual, apart the cabin which is missing additional rework and enhancement. Otherwise cockpit and external PBR are amazing.Puukka wrote: ↑Sat Jan 28, 2023 6:50 am @SimPassion Merci beaucoup Gilles, great, thanks a lot for your help!
I will consider the X-Plane 12 default version, or maybe the Rotate version, when it´s been updated for X-Plane 12 too, X-Plane coding is so much easier using the Dataref tool.
Kind regards from Austria,
Herbert
Just a few more step forward on my side, I guess I will at least design this one and you will have only to add the MSFS handling on your side.
I've added the A/T, landing and taxi light switch together with the ANNUN TEST LTS switch in the upper left corner.
Just to mention this layout is only a POC and absolutely not the final design to be published.
With avionics power ON :
Viel Spaß beim Fliegen mit dem Madog Herbert @Puukka !!!