Jump to content
The simFlight Network Forums

macro nil value


Recommended Posts

Hello,

I use FS-X and FSUIPC 4.60a (registrated). I try use a lua programm to set the flap possition. OK I know I should be doing this with conditionals in fsuipc ini but haven't gotten around to look at that yet. So for now I still try it with lua.

the error I get in the lua log is :

********* LUA: "flaps" Log [from FSUIPC version 4.60a] *********

184206 System time = 13/09/2010 12:56:45, Simulator time = 14:13:00 (12:13Z)

184206 LUA: beginning "E:\fsx\Modules\flaps.lua"

194331 *** LUA Error: E:\fsx\Modules\flaps.lua:12: attempt to call field 'marco' (a nil value)

194331 LUA: ended "E:\fsx\Modules\flaps.lua"

194331 System time = 13/09/2010 12:56:55, Simulator time = 14:13:10 (12:13Z)

********* LUA execution terminated: Log Closed *********

attempt to call field 'marco' (a nil value) , what does this mean ? am I passing a nil value ? or is something going wron when the macro is executed ?

The marco that I am calling exists and is being executed once before this error msg appeares.

script is :

flaps = 0;
while(1) do
	if ipc.testbutton(1, 9) and flaps == 0 then
		dis = "flaps +1"
		ipc.display(dis)
		ipc.macro("Aaamad: flaps-plus")
		flaps = 1
	end
	if ipc.testbutton(1, 12)  and flaps == 1 then
		dis = "flaps +2"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-plus")
		flaps = 2
	end
	if ipc.testbutton(1, 10) and flaps == 2 then
		dis = "flaps +3"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-plus")
		flaps = 3
	end
	if ipc.testbutton(1, 11) and flaps == 3 then
		dis = "flaps +4"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-plus")
		flaps = 4
	end
	if ipc.testbutton(1, 11) and ipc.testbutton(1,8) and flaps == 4 then
		dis = "flaps +5"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-plus")
		flaps = 5
	end
	-- minus
	if not ipc.testbutton(1, 9) and flaps == 1 then
		dis = "flaps -1"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-minus")
		flaps = 0
	end
	if not ipc.testbutton(1, 12)  and flaps == 2 then
		dis = "flaps -2"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-minus")
		flaps = 1
	end
	if not ipc.testbutton(1, 10) and flaps == 3 then 
		dis = "flaps -3"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-minus")
		flaps = 2
	end
	if not ipc.testbutton(1, 11) and flaps == 4 then
		dis = "flaps -4"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-minus")
		flaps = 3
	end
	if not ipc.testbutton(1, 11) and not ipc.testbutton(1,8) and flaps == 5 then
		dis = "flaps -5"
		ipc.display(dis)
		ipc.marco("Aaamad: flaps-minus")
		flaps = 4
	end
 ipc.sleep(10)
end

in aaamad.MCRO I have:

139=flaps-plus=RX6ee30*X81cc

140=flaps-minus=RX6ee90*X81cc

Will look at condtionals as well, but still wondering what I'm doing wrong here.

Cheers,

Gery

Link to comment
Share on other sites

I try use a lua programm to set the flap possition. OK I know I should be doing this with conditionals in fsuipc ini ...

Not sure why you'd need either just to set a flap position. It is a simple FS control.

the error I get in the lua log is :

194331 *** LUA Error: E:\fsx\Modules\flaps.lua:12: attempt to call field 'marco' (a nil value)

attempt to call field 'marco' (a nil value) , what does this mean ?

It is surely obvious? In line 12, as it says, you have tried to call a function called "marco" which is not defined - i.e. it is still "nil". (Everything in Lua is "nil" until it is defined -- it means "undefined").

The marco that I am calling exists

No. There is no function called "marco" in the ipc library. Maybe you mean "macro"?

You need to be more careful, and maybe use a magnifying glass to see such typing errors? ;-)

Pete

Link to comment
Share on other sites

:oops: thank you Pete...

The reason I need conditionals is that I use a real MD80 throttle, the flap possition electromechanics is unfortunately not straight forward.

For example flaps position 40 will be on when the flaps are fully retracted and at possition 40. So I need to make it only move when possition 28 is on as well.

Thanx again.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.