Jump to content
The simFlight Network Forums

Recommended Posts

Posted

P3Dv5     LINDA3.2.6     FSUIPC 6.0. 11

For over a week this lua has been working just fine. It was working fine this morning. And now it's not. When trying to load I get the following error message in the LINDA2.log: 

[E] *** LUA Error: C:\Prepare3D v5 Add-ons\FSUIPC6\A2AB17_MixAdj_1.lua:7: attempt to call global 'adjust_mix_1' (a nil value)

The main script is set to autoload and run in FSUIPC6.ini. I have no idea why it ran without a hitch for days and now suddenly is faulting.

 

function MixAdj_1(offset, input)
MixAdj_1_in = ipc.readSW(0x66DB)
n = (MixAdj_1_in + 16383)/327.67
m = ipc.readLvar ("L:MixtureLock")

if m==0 then
adjust_mix_1 ()
else
end

function adjust_mix_1 ()

if (0 <= n and n <= 10) then
i = 4

elseif (10 < n and n <= 50) then
j = 3

elseif (50 < n and n <= 90) then
k = 2

elseif (90 < n and n <= 100) then
l = 1

else
end
end

if (i==4 and i ~= a) then
ipc.writeLvar("L:MixtureRatioLever1Position", 3)
a = 4
b = 0
c = 0
d = 0
j = 0
k = 0
l = 0
end


if (j==3 and j ~= b) then
ipc.writeLvar("L:MixtureRatioLever1Position", 2)
b = 3
a = 0
c = 0
d = 0
i = 0
k = 0
l = 0
end


if (k==2 and k ~= c) then
ipc.writeLvar("L:MixtureRatioLever1Position", 1)
c = 2
b = 0
d = 0
a = 0
i = 0
j = 0
l = 0
end


if (l==1 and l ~= d) then
ipc.writeLvar("L:MixtureRatioLever1Position", 0)
d = 1
c = 0
a = 0
b = 0
i = 0
j = 0
k = 0
end
end
event.offset(0x66DB,"SW","MixAdj_1")

Posted

The error is given (on line 7):

[E] *** LUA Error: C:\Prepare3D v5 Add-ons\FSUIPC6\A2AB17_MixAdj_1.lua:7: attempt to call global 'adjust_mix_1' (a nil value)

So its this call:
    adjust_mix_1 ()
This is calling a function before it is defined.
There are also other issues with that script, such as the conditional in the adjust_mix_1() function has a dangling 'else', and variables being tested without being defined or set anywhere, and other variables being set and never used.

It couldn't have ran without a hitch - the script must have changed.

3 hours ago, Masterius said:

The main script is set to autoload and run in FSUIPC6.ini

Do you mean the Linda main script or that script? Anyway, If using Linda, you should use their support forum.

And your FSUIPC is out-of-date - the latest version is 6.0.12.

Posted
10 hours ago, John Dowson said:

It couldn't have ran without a hitch - the script must have changed.

I have four identical scripts that differ only in their numeration, one each for engines 1 thru 4. All four have worked just fine this last week. All four stopped dead at the same time yesterday evening. All four have the same time stamp, dated last week. I assure you, they did run, and they haven't changed.

I'll agree that something has to have changed. 

 

10 hours ago, John Dowson said:

Do you mean the Linda main script or that script? Anyway, If using Linda, you should use their support forum.

I meant that script. It auto loads using fsuipc6.ini, and is called using FSUIPC6 axis definition offsets. LINDA has nothing to do with these scripts.

10 hours ago, John Dowson said:

And your FSUIPC is out-of-date - the latest version is 6.0.12.

I'll update that right now.

Posted (edited)

Fixed and working

>Update:

Still working, with the script variables identical as before. Only change being the repositioning of function MixAdj_1 to allow for it being defined.

Edited by Masterius
update

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.