Hi guys, i have a question about Startup conditions,please help me

Announcements, questions
Post Reply
philomena
Posts: 1
Joined: 08 Jun 2018, 08:41

Hi guys, i have a question about Startup conditions,please help me

Post by philomena » 08 Jun 2018, 09:54

Hello, I want implement code that reads states of switches in my cockpit (xplane) and writes datrefs acoordingly so when loading a plane there are no diferences in the state of the plane switches and my real switches. Of course this only at macro startup or when loading a new plane. i presume what i want to do is not posible as macros are event driven but i ask just in case.

thanks in advance

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

Re: Hi guys, i have a question about Startup conditions,please help me

Post by admin » 11 Jun 2018, 08:40

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)
Petr Medek
LUAmacros author

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest