SDK Question Controlling Autopilot running in script from .dll

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
670
Reaction score
89
Points
43
Location
Happy Wherever
Managed to load the script ok -
Code:
int ShuttlePB::clbkGeneric (int msgid, int prm, void *context)
{
	switch (msgid) {
	case VMSG_LUAINTERPRETER:
		lua_State *L = (lua_State*)context;
		luaL_dofile (L, "Script\\35B\\aap.lua");
			
	}
	return 0;
}
Still struggling with changing value even of what I think is a global variable (alt & altid in 35B/aap lua file which is identical to dg/aap except for control outcome).
Tried varying forms to change variables:
Code:
lua_pushnumber(L, headto);
lua_setglobal(L, "hdg");
OR
Code:
lua_getglobal(L, "aap.hdg");
lua_pushnumber(L, headto);
lua_setfield(L, -2, "hdg");
OR
l
Code:
lua_getglobal(L, "aap");
lua_pushnumber(L, 1000);
lua_setfield(L, -2, "alt");
then
Code:
return VMSG_LUAINTERPRETER;
Any further help with this would be very welcome.

My current quest however is to dis-engage all autopilots (hdg/spd/alt) running in Script, from the .dll
Is there a command that will do this that I can call from within the .dll, and if so how?
I've tried manipulating the values of the variables, I think without success -

Is there a way to check if the variables have been changed? - some sort of debug (gotta be simple for me to set up)
Or could someone "point" me in the right direction.
Obliged,
JMW
 
Back
Top