Page 1 of 1

Changing script based on aircraft

Posted: 26 Dec 2022, 02:53
by bj1981uk
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

Re: Changing script based on aircraft

Posted: 27 Dec 2022, 08:29
by admin
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

Re: Changing script based on aircraft

Posted: 09 Jan 2023, 17:55
by bj1981uk
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: