Add feature to Create custom Dataref or Command from AM/AP

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: russ, Ralph

Post Reply
Message
Author
SimPassion
Posts: 5346
Joined: Thu Jul 27, 2017 12:22 am

Add feature to Create custom Dataref or Command from AM/AP

#1 Post by SimPassion »

It would be a great feature to be able to create a new custom dataref or command (x-plane) from within the logic.lua, as the x-plane SDK allow this to be performed, so we no more need to rely on external plugin like FlyWithLua or XLua ...

User avatar
nnyerges
Posts: 87
Joined: Sat Jun 18, 2022 6:28 pm

Re: Add feature to Create custom Dataref or Command from AM/AP

#2 Post by nnyerges »

Interesting. Why this topic never has been answered or at least addressed?
Chief Technology Officer (CTO) at 360ATC Aviation Training Center
Electronic Engineer. Control & Software Specialist

User avatar
Ralph
Posts: 7930
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Add feature to Create custom Dataref or Command from AM/AP

#3 Post by Ralph »

What would you do with those datarefs?

SimPassion
Posts: 5346
Joined: Thu Jul 27, 2017 12:22 am

Re: Add feature to Create custom Dataref or Command from AM/AP

#4 Post by SimPassion »

Ralph wrote: Sat Aug 26, 2023 6:39 pm What would you do with those datarefs?
As mentioned, to use them (not already existing and for custom needs), without creating FlyWithLua or XLua script for this requirement, as sometime we want to simplify the process without requiring to use multiple solutions at once. I would expect Air manager solution would be sufficient and this is how I see it

User avatar
Ralph
Posts: 7930
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Add feature to Create custom Dataref or Command from AM/AP

#5 Post by Ralph »

But still, why do you need this dataref?

SimPassion
Posts: 5346
Joined: Thu Jul 27, 2017 12:22 am

Re: Add feature to Create custom Dataref or Command from AM/AP

#6 Post by SimPassion »

There's many circumstances where devs have to create custom datarefs and commands which doesn't exists, to be able to trigger actions which fulfill their needs and expectation

In the past I have created an XLua script for the Z_2D_XP EFB Panel, for simmers needs who want to show/hide the AM EFB instrument remotely and independently from what we see in the sim

Using this XLua part :

Code: Select all

-- Dedicated LUA script to handle Air Manager EFB hide/show independently to the one which is shown in the sim
-- enjxp_SimPassion		10.19.2019	Initial release

Z2DXP_efbshow = create_dataref("Z2DXP/EFB/ext2dxpefb/show_z2dxp_efb", "number")

Z2DXP_efbshow = 1

function z2dxp_efb_show_CMDhandler(phase, duration)

	if phase == 0 then 
		if Z2DXP_efbshow == 1 then
			Z2DXP_efbshow = 0
		else
			Z2DXP_efbshow = 1
		end
	elseif phase == 2 then
	end	

end

Z2DXPCMD_z2dxp_efb_show = create_command("Z2DXP/EFB/toggle_switch/show_z2dxp_efb", "Toggle Z2DXP EFB Tablet Visibility", z2dxp_efb_show_CMDhandler)
and the related panel logic.lua using "instrument_get" feature

Code: Select all

local z2dxpefb_id = instrument_get("cc8ae7fa-eaf1-4228-88c6-05f22630939c")
function compute_efb_show(tablet_state) -- HIDE/UNHIDE Z2DXP EFB Tablet
    if tablet_state == 0 then
        visible(z2dxpefb_id,false)
    else
        visible(z2dxpefb_id,true)
    end
end

xpl_dataref_subscribe("Z2DXP/EFB/ext2dxpefb/show_z2dxp_efb","INT", compute_efb_show)
compute_efb_show(1)
I have other needs which made me come to this though I don't have it in mind at the moment, as switching between multiple tasks and already made the request months ago, however I will add them when I will re come on it

Anyway, you get the abstract with this sample and an idea of the expectation to not force simmers to add additional scripts and plugins in the sim folders structure ... 😎
Again Air Manager would be sufficient ... shouldn't it ??? 🤔
 

Post Reply