xpnteam/xpnet

Commands and Messages

Closed this issue · 4 comments

So I have made a lot of progress but have a question on commands. I found out the hard way that commands can only be issued on the Flight Loop Hook. The problem is that the only way the flight hook is available is when you are starting a flight. I want to issue a command prior to that, on startup (when the display only shows Resume flight, new flight, load.., flight school, settings). Basically I want to load a situation without having the user intervention. BTW I am using sockets to communicate remotely with XPlane via your API. Any help on how to get access to XPlane at startup and to run a command on that thread would be helpful. Thanks in advance!

I don't know whether that's possible or not. I think that's going to be a question to take over to the "X-Plane Developers and Plugins" forum over on https://forums.x-plane.org/; it's more of a general "can this be done with the plugin API at all?" question than something specific to XPNet.

Ok thanks. I have been searching a lot and it does not seem possible. I will pose a question there. Thanks for your help.

Are you able to provide a simple example of how the Commands are implemented?

There is an example in LoggerPlugin.cs. Get a reference to a command and invoke it like so:

var cmd = m_api.Commands.GetCommand("sim/autopilot/heading_up");
cmd.InvokeOnce();