Changing script based on aircraft

Documentation. First post is always kind of manual page, being continuously updated by author. Following posts are discussion about the topic.
Post Reply
bj1981uk
Posts: 2
Joined: 26 Dec 2022, 01:47

Changing script based on aircraft

Post by bj1981uk » 26 Dec 2022, 02:53

Hi all,
Sorry if this has been answered already but I am woundering if it is possible it have the plane being used in x-plane to either load a script or define what commands are sent. i have spent a few hours searching the forum and the closest i have found links to a file on github but when i click it i get a 404 error. The post states
You can have lua callback procedure trigerred by xpl variable change. If you hook it to plane tail number it's called when the plane is loaded.
See the lua script that I use for xplane - https://github.com/me2d13/luamacros/blo ... rc/lmc.lua
The callback is function setPlane(name) and it's registered by:
lmc_on_xpl_var_change('sim/aircraft/view/acf_tailnum', setPlane, 5000)
I think this is what I am looking for but am not sure or how it is implimented as the link is broken.

Many thanks

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Changing script based on aircraft

Post by admin » 27 Dec 2022, 08:29

The link is https://github.com/me2d13/luamacros/blo ... c.lua#L241
And as yu can see in the script, when tail number changes I call different init functions to define macros
Petr Medek
LUAmacros author

bj1981uk
Posts: 2
Joined: 26 Dec 2022, 01:47

Re: Changing script based on aircraft

Post by bj1981uk » 09 Jan 2023, 17:55

Thank you for the reply, I have just got to understand it now. My main experiance is 'press this key do that action' :D but am trying to learn :shock:

Post Reply