MOARdV / AvionicsSystems

MOARdV's Avionics Systems for Kerbal Space Program - a new generation of IVA enhancement.
Other
52 stars 26 forks source link

FAR Availibilty + Code issues #45

Closed DeputyLOL closed 7 years ago

DeputyLOL commented 7 years ago

Apologies if i ask silly or repetitive questions, ive just come back to this. It doesn't appear that there is a FAR version for KSP 1.2 so all the MAS code that uses it is kind of pointless. I am interested to know however, what would far.GetFlapSetting() be equal to? could we have a far.Availible() process so that we can turn off features that use FAR stuff to stop them from messing up. ALSO: https://www.dropbox.com/s/dymnc03gaulhbbl/GPWS.lua?dl=0 This code is driving me nuts. Ive been looking through it again and again, there is something wrong with it and what ever is wrong is causing MAS to freeze and the log to spam with this: [ERR 22:32:02.674] [MASFlightComputer] MASFlightComputer.FixedUpdate exception: System.ArgumentException: Unexpected variable type Unknown in mutableVariablesList at AvionicsSystems.MASFlightComputer.FixedUpdate () [0x00000] in :0

Please let me know if you find anything obviously wrong

MOARdV commented 7 years ago

It doesn't appear that there is a FAR version for KSP 1.2 so all the MAS code that uses it is kind of pointless. I am interested to know however, what would far.GetFlapSetting() be equal to? could we have a far.Availible() process so that we can turn off features that use FAR stuff to stop them from messing up.

I will add a far.Available() - I have one for MJ, I should have one for the other plugins. As for far.GetFlapSetting(), there is no equivalent in stock KSP (or are there flaps of some sort? I don't fly space planes).

One of the design goals for MAS is that it will report 0 values (or some other sensible, non-committal value) for plugins that are missing. That does mean the props that rely on the plugin will essentially do nothing, but it provides incentive for someone to install those plugins to unlock the full IVA experience. :)

This code is driving me nuts. Ive been looking through it again and again, there is something wrong with it and what ever is wrong is causing MAS to freeze and the log to spam with this:

There should be something way back in the log that provides a clue (at least, it'll be a clue for me). I am updating MAS so it will provide the variable name in that particular error. I don't know why I hadn't done so earlier (other than rushing through a bunch of code). Look for an updated dev build "soon" (next hour or so) that will call out the variable that is failing (if you're still on the September build, you'll definitely want to update, anyway, to get some of the performance fixes I've made). Also, if you can put the entire log up, I'll see if I can find what's going on, and find a way to draw attention to the point of failure (and maybe fix the point of failure).

DeputyLOL commented 7 years ago

I've narrowed down the problem to the ACGPWSTooLow() function. I think it has something to do with the first if statement but it only seems to happen when the gear isn't down.

I also noticed that my audio players don't seem to work. MODULE { name = MASComponent AUDIO_PLAYER { name = SINK RATE OLD sound = AdvancedCockpit/Shared/Sounds/GPWS/OLDGPWS/SinkRate volume = 100 trigger = LOOP variable = ACGPWSSinkRate() range = 0.5, 1.5 } }

Anything wrong with this?

DeputyLOL commented 7 years ago

LOG: https://www.dropbox.com/s/0imwbo7esikgw10/KSP.log?dl=0

MOARdV commented 7 years ago

Anything wrong with this?

Not that I see. What I do see in the log is this:

[ERR 15:40:45.397] [AvionicsSystems] INITIALIZATION ERROR: User Script Loading error

[ERR 15:40:45.399] [MASFlightComputer] MoonSharp.Interpreter.SyntaxErrorException: unexpected symbol near 'MODE'

which is not terribly helpful by itself. There is something the MoonSharp interpreter doesn't like somewhere near the word 'MODE' in the script it's launching. If I had to venture a guess, it'd be that for some reason MoonSharp is misinterpreting line 76, where you commented out the return 3, and then you have a second comment after it. It may be that it thinks the second set of -- are saying "this comment is ended, and the rest of this line is code".

I will see if there is some way to pull more info out of MoonSharp, like a line number.

DeputyLOL commented 7 years ago

I know what that was and i fixed that bit. That error came up when i commented a selection of code and the title got decommented. Thats been fixed and isnt the problem. I was commenting sections out to try and isolate the problem.

MOARdV commented 7 years ago

Is the script you sent me earlier the complete, latest version that isn't working? Or did you update it since then? I can try loading it here to see if I can get a better error report.

DeputyLOL commented 7 years ago

The only changes I've been making are commenting out sections to try and pin point the fault. I made a mistake when commenting a section out and the result was that error.

DeputyLOL commented 7 years ago

The script you have is the latest

MOARdV commented 7 years ago

The script you have is the latest

How and where is ACAltitudeTerrainFeet() defined? Your config file includes the Lua script that defines it, correct?

DeputyLOL commented 7 years ago

In FlightParameters.lua

-- Convert radio altitude from meters to feet. function ACAltitudeTerrainFeet() return fc.AltitudeBottom() * 3.28084 end

In a separate .cfg file: MAS_LUA { name = AC_SHARED_FUNCTIONS script = AdvancedCockpit/Shared/FlightParameters.lua script = AdvancedCockpit/Shared/MiscParameters.lua script = AdvancedCockpit/Shared/NavigationParameters.lua script = AdvancedCockpit/Shared/GPWS.lua }

DeputyLOL commented 7 years ago

While I'm here, I had a question about gear positions. Could we have actual gear position that we used to (seems to be broken now) have in RPM, instead of gear group state?

MOARdV commented 7 years ago

In FlightParameters.lua

Hrm. Without getting everything needed to load the IVA so I can test here, I'm running out of ideas. You do have the update I released yesterday, correct? I think that has a possibly more helpful error message in the log file when it fails to parse a script.

While I'm here, I had a question about gear positions.

Yeah. I haven't gotten to that yet. Right now, there's just the action group status. Detailed landing gear info is still in the future.

DeputyLOL commented 7 years ago

I don't think I have, but I'll down load it now. The other issue I seem to be having is although some of the functions are working and outputting the correct number. The audio player isn't responding to it.

DeputyLOL commented 7 years ago

Just tested it again log:

[ERR 01:06:48.538] [MASFlightComputer] FixedUpdate exception on variable ACGPWSTooLow()

[ERR 01:06:48.539] [MASFlightComputer] MASFlightComputer.FixedUpdate exception: System.NullReferenceException: Object reference not set to an instance of an object at AvionicsSystems.MASFlightComputer+Variable.ProcessObject (System.Object value) [0x00000] in :0 at AvionicsSystems.MASFlightComputer+Variable.Evaluate (MoonSharp.Interpreter.Script script) [0x00000] in :0 at AvionicsSystems.MASFlightComputer.FixedUpdate () [0x00000] in :0

DeputyLOL commented 7 years ago

FYI, i already had these messages before i updated.

DeputyLOL commented 7 years ago

Would you like me to send you everything you need to have the GPWS code?

MOARdV commented 7 years ago

Would you like me to send you everything you need to have the GPWS code?

Yeah, I think so. There's a piece of information that's missing, and having everything here so I can experiment with it will help me figure out how to get that information visible, so it's easier to figure out next time.

DeputyLOL commented 7 years ago

Ok heres the script with only the required... stuff. https://www.dropbox.com/s/jw73wdxrnuwgsb1/GPWS.zip?dl=0

DeputyLOL commented 7 years ago

The way i get the script to crash is by descending quickly with the gear up.

DeputyLOL commented 7 years ago

Hi, Hows MAS been coming along? Did you figure out what was wrong with meh code?

MOARdV commented 7 years ago

I've put MAS development on the back burner for a while. I was getting tired of the constant coding, and I wanted to spend some time simply playing the game (and a couple of other games). I haven't loaded your code into the game yet - I looked at it again, and I still didn't see anything on casual inspection.

DeputyLOL commented 7 years ago

oh well, thanks for looking. it seems that a few big mods have gone quite recently. might just be me.

DeputyLOL commented 7 years ago

I recently became interested in making cockpits again... but I see that some major mods are still not updated. Is MAS still on the back burner?

MOARdV commented 7 years ago

It is on the back burner. I haven't fired up KSP since just before New Year's, since I've been working on a different programming project for the time being.

DeputyLOL commented 7 years ago

ok, thanks for letting me know. Do you think you might come back to this if/when FAR gets updated?

MOARdV commented 7 years ago

My main reason for putting this on the back burner is that I'm not interested in working on the MFD code. It's a lot of work to implement the features that people are going to want, and I simply don't care that much about designing and working with glass cockpits right now, so I don't have the motivation to spend time on it.

I think most of the rest of the mod - the stuff that controls switches, gauges, buttons, and even text-mode display stuff - is in good shape, and it's probably complete enough to make a release, but I don't want to be bombarded with "When will MFDs work" requests until I'm in the mood to work on them.

TL; DR: Yeah, I'll come back to it at some point. I don't know when, and it depends on how far the other game project I'm working on goes before I set it aside.

DeputyLOL commented 7 years ago

fair enough. i have motivation issues with almost everything and i guess it has been a long time.

i didnt think that the MFDs needed that much more work anyway, aside from a few bugs that needed fixing. You could probably release this and people would be happy with them

DeputyLOL commented 7 years ago

but hey, it doesn't matter. Hope your new game interest is.... uhhh.... interesting?