Jump to content

[1.10.1+] Contract Configurator [v1.30.5] [2020-10-05]


nightingale

Recommended Posts

nothing change. i even tried to transfer all kerbals from station to transport ship(and undocked transport ship) except 2 engineers.

then i send one on EVA - nothing changed

changed control to station - nothing changed

changed back to engineer on EVA - nothing changed

send second on EVA - nothing changed

changed control to station - nothing changed

changed back to engineer on EVA- nothing changed

entered with both to station and then again sent them EVA. - nothing changed.

When i looked on log i thought that there could be problem that contract doesn't recognize my space station as targetvessel1 anymore (maybe because of docking? space station was damaged during docking).

and that caused this exception

[EXC 22:45:19.776] NullReferenceException: Object reference not set to an instance of an object

ContractConfigurator.FacilityRequirement.RequirementMet (ContractConfigurator.ConfiguredContract contract)

ContractConfigurator.DebugWindow.CheckRequirement (ContractConfigurator.ContractRequirement requirement)

UnityEngine.Debug:LogException(Exception)

ContractConfigurator.DebugWindow:CheckRequirement(ContractRequirement)

ContractConfigurator.DebugWindow:CheckRequirements()

ContractConfigurator.DebugWindow:WindowGUI(Int32)

UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, GUISkin, Int32, Single, Single, GUIStyle)

this is old screenshot of contract view and addons list from CKAN (I've done them i've reported this issue to severedsolo). Maybe there's some conflict between mods.

http://imgur.com/a/xpmnP

When i return home i'll try to find save before transport ship launched from Kerbin and I'll track progress with screenshots. (and ksp.log)

Link to comment
Share on other sites

nothing change. i even tried to transfer all kerbals from station to transport ship(and undocked transport ship) except 2 engineers.

then i send one on EVA - nothing changed

changed control to station - nothing changed

changed back to engineer on EVA - nothing changed

send second on EVA - nothing changed

changed control to station - nothing changed

changed back to engineer on EVA- nothing changed

entered with both to station and then again sent them EVA. - nothing changed.

When i looked on log i thought that there could be problem that contract doesn't recognize my space station as targetvessel1 anymore (maybe because of docking? space station was damaged during docking).

and that caused this exception

[EXC 22:45:19.776] NullReferenceException: Object reference not set to an instance of an object

ContractConfigurator.FacilityRequirement.RequirementMet (ContractConfigurator.ConfiguredContract contract)

ContractConfigurator.DebugWindow.CheckRequirement (ContractConfigurator.ContractRequirement requirement)

UnityEngine.Debug:LogException(Exception)

ContractConfigurator.DebugWindow:CheckRequirement(ContractRequirement)

ContractConfigurator.DebugWindow:CheckRequirements()

ContractConfigurator.DebugWindow:WindowGUI(Int32)

UnityEngine.GUI:CallWindowDelegate(WindowFunction, Int32, GUISkin, Int32, Single, Single, GUIStyle)

this is old screenshot of contract view and addons list from CKAN (I've done them i've reported this issue to severedsolo). Maybe there's some conflict between mods.

http://imgur.com/a/xpmnP

When i return home i'll try to find save before transport ship launched from Kerbin and I'll track progress with screenshots. (and ksp.log)

Noticed that exception and raised an issue to have it fixed, but didn't mention it as it's just a problem with the debug window (it's not even an exception with the same contract). So shouldn't be related to your issue.

I'll also do some more playing around with this at home and see if I can reproduce it. Actually, if you can provide your save file I can just pull the contract's current state out of there - it might help me figure out why it's stuck.

Link to comment
Share on other sites

What is the difference between uniqueValue and activeUniqueValue? They seem to do the same thing?

uniqueValue: If true, this value must be unique across all contracts. If a new contract were to be offered with a duplicate value, it will not be generated.

activeUniqueValue: If true, this value must be unique across active/offered contracts. If a new contract were to be offered with a duplicate value, it will not be generated.

What other sort of contracts are there if not active and offered? Or does UniqueValue also test against completed contracts?

Link to comment
Share on other sites

What is the difference between uniqueValue and activeUniqueValue? They seem to do the same thing?

What other sort of contracts are there if not active and offered? Or does UniqueValue also test against completed contracts?

The other type are completed contracts, so yes, uniqueValue also tests against completed contracts.

Using KSS as an example, activeUniqueValue would be, "I want this contract to be able to show up multiple times, but for different stations.", whereas uniqueValue is "I want this contract to only be completeable once per station."

Another way to think of it - activeUniqueValue works like maxSimultaneous, uniqueValue works like maxCompletions.

Link to comment
Share on other sites

Question. May be a bug, may not. I'm doing a contract for the first manned orbital mission in RSS. I get the capsule up there and complete the requirements up until return home. Then after staging (get rid of small rocket booster in preparation for reentry), one of the requirements resets to incomplete, but all I see that might make it do that in the save is "disableOnStateChange". All instances of that I'm seeing for the contract in the save list it as false, so that shouldn't be it... any idea what's causing a criteria to reset on staging?

Link to comment
Share on other sites

Question. May be a bug, may not. I'm doing a contract for the first manned orbital mission in RSS. I get the capsule up there and complete the requirements up until return home. Then after staging (get rid of small rocket booster in preparation for reentry), one of the requirements resets to incomplete, but all I see that might make it do that in the save is "disableOnStateChange". All instances of that I'm seeing for the contract in the save list it as false, so that shouldn't be it... any idea what's causing a criteria to reset on staging?

Could be one of two things:

  1. It is indeed a setup issue with the disableOnStateChange. I'd have to see the contract to say more - can you give me the name of it and I'll look it up in the RP-0 repository?
  2. A bug/limitation with the vessel tracking. Right now it'll keep tracking the ship that keeps the original root part of the vessel. I've been thinking about some changes to this system for 1.8.0, but haven't really looked too closely at it yet. If you built your ship "upside-down", this could be the problem. Can you still switch to the spent booster and see if all requirements are green for that one?

Link to comment
Share on other sites

Could be one of two things:

  1. It is indeed a setup issue with the disableOnStateChange. I'd have to see the contract to say more - can you give me the name of it and I'll look it up in the RP-0 repository?
  2. A bug/limitation with the vessel tracking. Right now it'll keep tracking the ship that keeps the original root part of the vessel. I've been thinking about some changes to this system for 1.8.0, but haven't really looked too closely at it yet. If you built your ship "upside-down", this could be the problem. Can you still switch to the spent booster and see if all requirements are green for that one?

Actually, I think it might be the second thing. I didn't exactly build the ship upside down, but I did change the cargo on the rocket, and I might have forgotten to swap the root node back to the capsule. I think this because when I stage to decouple the capsule, the focus stays on the spent booster stage.

Link to comment
Share on other sites

Actually, I think it might be the second thing. I didn't exactly build the ship upside down, but I did change the cargo on the rocket, and I might have forgotten to swap the root node back to the capsule. I think this because when I stage to decouple the capsule, the focus stays on the spent booster stage.

Raised [#332] to clean up that logic a bit for the next release.

Link to comment
Share on other sites

Raised [#332] to clean up that logic a bit for the next release.

Sweet. In the mean time, knowing better how it works should let me get around the issue. Just gotta alter the root element and fly again. On the upside, more experience!

Edit: Just to confirm, I moved the root node to the capsule and it worked properly.

Edited by Ixonal
Link to comment
Share on other sites

hey there,

when reloading the database in game, i notice that it only loads 33/67 contracts successfully..is there a way to find out which ones it didn't load?

Thanks

Alt-F10 - the red contracts are the ones that didn't load.

Edited by severedsolo
Link to comment
Share on other sites

Had a popup upon loading my save (RSS-RO-RP0) I don't think it is your mods doing, but the pop-up asked I post it here, so posting it here. =)

Output Log: http://puu.sh/l5cBJ/2ab8958c25.zip

Exception occured while loading contract parameter 'ReachAlt' in contract 'SoundingRocketHigh':

System.ArgumentException: 'Earth' is not a valid CelestialBody.

at ContractConfigurator.ConfigNodeUtil.ParseCelestialBodyValue (System.String celestialName) [0x00000] in <filename unknown>:0

at ContractConfigurator.ConfigNodeUtil.ParseSingleValue[CelestialBody] (System.String key, System.String stringValue, Boolean allowExpression) [0x00000] in <filename unknown>:0

at ContractConfigurator.ConfigNodeUtil.ParseValue[CelestialBody] (.ConfigNode configNode, System.String key, Boolean allowExpression) [0x00000] in <filename unknown>:0

at ContractConfigurator.ConfigNodeUtil.ParseValue[CelestialBody] (.ConfigNode configNode, System.String key, .CelestialBody defaultValue) [0x00000] in <filename unknown>:0

at ContractConfigurator.Parameters.ReachState.OnParameterLoad (.ConfigNode node) [0x00000] in <filename unknown>:0

at ContractConfigurator.Parameters.ContractConfiguratorParameter.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0

Edit: I did just try installing RVE which uses the Scatter mod. That is the likely cause for Earth.

Edited by BevoLJ
Link to comment
Share on other sites

Disabling contracts appears to not be working through a cfg file any more.

As you can see, I have KSS, Base Construction, and Tourism Plus (plus my own cfg that disables rescue and ISRU) installed - but all the stock contracts are are still enabled. (this was on a new install of KSP, and a new save, don't know if that matters?).

THis isn't cosmetic either - I'm being offered stock tourism contracts.

I haven't tried disabling in-game yet.

Qn9465m.png

Link to comment
Share on other sites

Disabling contracts appears to not be working through a cfg file any more.

As you can see, I have KSS, Base Construction, and Tourism Plus (plus my own cfg that disables rescue and ISRU) installed - but all the stock contracts are are still enabled. (this was on a new install of KSP, and a new save, don't know if that matters?).

THis isn't cosmetic either - I'm being offered stock tourism contracts.

I haven't tried disabling in-game yet.

http://i.imgur.com/Qn9465m.png

Aaaaah, I hate that functionality with the settings window, it always seems to have something wrong with it. Okay, raising [#334]

Link to comment
Share on other sites

This may be a super daft question, but I can't figure out how I'm meant to store a list in the config file for my own parameter extension - what do lists look like in the config file?

Here's how I'm attempting to read the config file in my factory:


public override bool Load(ConfigNode node)
{
if (! base.Load(node))
return false;

if (! node.HasValue("controls"))
{
UnityEngine.Debug.Log("KOSContractPack: " + ErrorPrefix(node) + ": missing required value 'controls' from .cfg file.");
return false;
}
try
{
controls = ConfigNodeUtil.ParseValue<List<string>>(node, "controls", false);
UnityEngine.Debug.Log("eraseme: operating on controls: " + controls);
}
catch (Exception e)
{
UnityEngine.Debug.Log("KOSContractPack: " + ErrorPrefix(node) +
": error parsing controls list in .cfg file: " + e.Message + e.StackTrace );
return false;
}
return true;
}

What I can't figure out is how to store that "controls" field in the cfg file such that I can read it in with that code without it throwing an exception.

I've tried this:


controls = Throttle
controls = Pitch

and I've tried this"


controls = Throttle, Pitch

I'm not sure what the correct way is. I tried looking at the existing contracts to see, but very few of them actually use the List<string> kind of parse, and the few that do didn't seem to have any examples of config files that went with them.

Link to comment
Share on other sites

This may be a super daft question, but I can't figure out how I'm meant to store a list in the config file for my own parameter extension - what do lists look like in the config file?

Here's how I'm attempting to read the config file in my factory:


public override bool Load(ConfigNode node)
{
if (! base.Load(node))
return false;

if (! node.HasValue("controls"))
{
UnityEngine.Debug.Log("KOSContractPack: " + ErrorPrefix(node) + ": missing required value 'controls' from .cfg file.");
return false;
}
try
{
controls = ConfigNodeUtil.ParseValue<List<string>>(node, "controls", false);
UnityEngine.Debug.Log("eraseme: operating on controls: " + controls);
}
catch (Exception e)
{
UnityEngine.Debug.Log("KOSContractPack: " + ErrorPrefix(node) +
": error parsing controls list in .cfg file: " + e.Message + e.StackTrace );
return false;
}
return true;
}

What I can't figure out is how to store that "controls" field in the cfg file such that I can read it in with that code without it throwing an exception.

I've tried this:


controls = Throttle
controls = Pitch

and I've tried this"


controls = Throttle, Pitch

I'm not sure what the correct way is. I tried looking at the existing contracts to see, but very few of them actually use the List<string> kind of parse, and the few that do didn't seem to have any examples of config files that went with them.

It should be the first one:

[COLOR=#333333]     controls = Throttle
[/COLOR] controls = Pitch

Have a look at AwardExperienceFactory - that one is doing a list of strings.

Note that the interface you're using for ParseValue<> is one of the ones that doesn't execute expressions, and will throw an exception on load. Generally I use the other form for the factories, which will output the error to the logs and return whether the config was loaded successfully. So in your case it would be something like:


bool valid = true;
valid &= ConfigNodeUtil.ParseValue<List<string>>(configNode, "[COLOR=#3E3E3E][I]controls[/I][/COLOR]", x => [COLOR=#3E3E3E][I]controls [/I][/COLOR]= x, this);
return valid;

This form also allows a default value to be specified (and if no default is specified will error when a value isn't supplied by the config). Basically your entire load function is reduced to the one line above. :)

Link to comment
Share on other sites

This form also allows a default value to be specified (and if no default is specified will error when a value isn't supplied by the config). Basically your entire load function is reduced to the one line above. :)

Okay thanks. I'll give it a try when I get home in several hours.

The other problem I had with what I was doing is that when the parse failed with a nullref exception I couldn't get any info on where the complaint was coming from even though in my catch I explictily said to append e.StackTrace to the output - it still showed nothing about where the error was coming from - but I know my catch was working because it printed the rest of my message - just not the stack trace even though it explicitly appended it to the output. It was behaving as if the value of e.StackTrace was actually the empty string.

Link to comment
Share on other sites

Okay thanks. I'll give it a try when I get home in several hours.

The other problem I had with what I was doing is that when the parse failed with a nullref exception I couldn't get any info on where the complaint was coming from even though in my catch I explictily said to append e.StackTrace to the output - it still showed nothing about where the error was coming from - but I know my catch was working because it printed the rest of my message - just not the stack trace even though it explicitly appended it to the output. It was behaving as if the value of e.StackTrace was actually the empty string.

Can't say I've ever had that issue. But if you are handling and outputting exceptions, I'd recommend just using Unity's Debug.LogException call, as that will take care of outputting the stack trace (including any nested exceptions).

Link to comment
Share on other sites

It was hard to see where the actual culprit was because the reflection techniques used inside ParseValue were obfuscating the stack trace. Even when I did finally get it to print out, at several stages along the way in the stack it just said that Invoke() was being called, rather than the method that was being invoked by it.

In the end the culprit was that I was doing the wrong thing in OnParameterSave in the parameter class itself, not its factory, and this was being invoked indirectly because it always tries to save and reload a newly spawned contract as it makes it.

I was trying to do an AddNode on the list directly, thus getting this in persistent.sfs:


control = System.Collections.Generic.List`1[System.String]

instead of what ParseValue expects to see:


control = (whatever the first thing in the list is)
control = (whatever the second thing in the list is)
.. etc..

I hadn't quite caught on to the fact that the way ContractConfigurator is storing lists in a ConfigNode is not actually supported by the native ConfigNode in the stock KSP API calls, so when writing them out I have to manually set up the config node to match how ContractConfigurator is expecting Lists to be represented later when it parses them back in.

(I also hadn't realized that a new contract is immediately saved and reloaded from the confignode as soon as it's created, so I didn't even think to look there.)

Link to comment
Share on other sites

New release, bunch of little bug fixes that have piled up. Download now!

Contract Configurator 1.7.8

  • Fixed issue with timer parameter text not always updating (thanks mer & severedsolo).
  • Fixed issue with timer parameter not always starting up (thanks mer).
  • Fixed issue with contracts not being correctly disabled when requested (thanks severedsolo).
  • Fixed minTerrainAltitude and maxTerrainAltitude to check terrain altitude and not ASL (thanks space-is-hard).
  • Fixed issue with interaction between SpawnKerbal and RecoverKerbal causing exception that didn't clean up Kerbals (thanks arilm21).
  • Minor bug fixes.

Link to comment
Share on other sites

Quick question related to a contract pack I'm hoping to make: Any chance of making Vessel name searchable by expressions? I couldn't find anything in the wiki regarding this. (I really wish there was a way to search the wiki only on GitHub)

If it could support wildcards that would be even better!

Vessel Parameter Group would not help me in this situation, as there would be no previous contracts to mark it with the identifier. I want to give the player a way of marking a vessel as stranded. Then, I'll offer a contract to rescue the crew.

Basically I want something like this:


DATA
{
type = Vessel
targetVessel = AllVessels().Where(v => v.VesselName() == *Lost).Random()
}

Edited by severedsolo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...