Jump to content

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


nightingale

Recommended Posts

Good job on the module manager support! I love the fact that you can insert parameters/requirements ad-hoc depending on what mods are installed.

Pie in the sky wish - don't suppose there is any way of getting a requirement to only fire if a vessel in orbit has below x resource?

Should be relatively easy if you're okay with handling it via expressions. Raised [#171] to track (you want this for 0.7.5, I assume?).

Taking a wild guess at what your required use case is (refuelling the station?), you could do something like this:

DATA
{
type = Vessel
targetVessel = [ LKOStation ].Where(v => v.ResourceQuantity(Karbonite) <= 100).First()
}

What that would do is if LKOStation has less than 100 Karbonite (or whatever you choose), it'll be the targetVessel, otherwise targetVessel will be null. Since the default is to disallow contracts when any DATA element is null, the effect is the contract only gets offered when in the low Karbonite situation. That work for you?

- - - Updated - - -

Actually, it was a pretty quick change, so I just went ahead and threw it in. Let me know if it doesn't work as advertised.

Link to comment
Share on other sites

I think i figured out using the DATA node expression to check for a ship in orbit. For the most part, it works, but after the vessel is destroyed, it takes declining the remaining related available missions a couple of times before they stop appearing. Here is how i got it working:

DATA

{

type = Vessel

requiredValue = true

targetVessel = targetVessel = Vessel().LKOStation().where(v => v.IsOrbiting()).Kerbin()

}

}

REQUIREMENT

{

name = vesselcheck

type = Expression

expression = targetVessel == true

}

What do you think?

Link to comment
Share on other sites

I think i figured out using the DATA node expression to check for a ship in orbit. For the most part, it works, but after the vessel is destroyed, it takes declining the remaining related available missions a couple of times before they stop appearing. Here is how i got it working:

DATA

{

type = Vessel

requiredValue = true

targetVessel = targetVessel = Vessel().LKOStation().where(v => v.IsOrbiting()).Kerbin()

}

}

REQUIREMENT

{

name = vesselcheck

type = Expression

expression = targetVessel == true

}

What do you think?

That expression is questionable - it won't know that targetVessel is a vessel, so it'll read as a double and get 0.0. Under the development version, this should work:

        expression = Vessel(targetVessel).IsOrbiting()

Speaking of which, release pushed to tomorrow... just too much pain in getting docking working. I think I've got it right, but it needs a bit more testing.

Link to comment
Share on other sites

Tons of little bug fixes and new stuff for modders. Download it now!

Contract Configurator 0.7.5

  • Possible fix for duration counters resetting (thanks dorin6565 and many others).
  • Fix for HasCrew with count > 0 (thanks Yemo).
  • Fix for undefined vessels showing up in Tourism contracts (thanks Kaa253).
  • Improvements to tracking across docked vessels.
  • SpawnPassengers now only spawns passengers on Kerbin (closes EPL exploit).
  • Sequence parameter no longer fails if child parameters complete out of order.
  • Added hideChildren attribute to contract parameters to hide children.
  • Added requiredValue attribute to DATA nodes.
  • Added CelestialBody(), Kerbal() and Vessel() functions to expressions.
  • Added resources to expressions.
  • Debug window now highlights items with warnings in yellow.
  • Obsolete EnterOrbit.
  • Obsolete EnterSOI.
  • Obsolete LandOnBody.
  • Obsolete VesselHasVisited.
  • Minor bug fixes.

Link to comment
Share on other sites

Was told to post this here....

Exception occured while loading contract parameter 'Sequence5701' in contract 'FirstUnmannedMinmusFlyby':

System.ArgumentException: Missing required value 'failWhenCompleteOutOfOrder'.

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

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

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

Output log: http://www./view/n5jot08ea435iuq/output_log(6).txt

Link to comment
Share on other sites

Quick question: If i fetch 0.7.6, will there be problems with the two packs i use ? I use Advances Progression and Kerbin Space Station.

None expected, in fact some of the fixes are targeted towards those (I'm hoping there won't be any more issues with "losing" track of the station in KSS).

Link to comment
Share on other sites

I just upgraded from Contract Configurator 0.7.4 to 0.7.6 via CKAN and am now getting the following exception when switching to the FlightScene (or when loading a savegame which is in the FlightScene). It seems this aborts the load as shortly after this KCT complains violently. Rolling back to 0.7.4 makes the issues disappear.


InvalidOperationException: Operation is not valid due to the current state of the object
at System.Linq.Enumerable.First[UInt32] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at ContractConfigurator.ContractVesselTracker.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0
at ScenarioModule.Load (.ConfigNode node) [0x00000] in <filename unknown>:0
at ScenarioRunner.AddModule (.ConfigNode node) [0x00000] in <filename unknown>:0
at ProtoScenarioModule.Load (.ScenarioRunner host) [0x00000] in <filename unknown>:0
at ScenarioRunner+^K .MoveNext () [0x00000] in <filename unknown>:0

I have the following Contract Packs installed:

- Contract Pack: Anomaly Surveyor 1.0.5

- Contract Pack: RemoteTech 1.1.0

- Contract Pack: SCANSat 0.5.0

- Contract Pack: Tourism 1.0.0

I think, of these I only have RemoteTech and Tourism contracts active at the moment.

Savegame is at https://gist.github.com/lwho/ab86a7d329cd20e4befc (caveat: a lot of other mods installed).

Link to comment
Share on other sites

I just upgraded from Contract Configurator 0.7.4 to 0.7.6 via CKAN and am now getting the following exception when switching to the FlightScene (or when loading a savegame which is in the FlightScene). It seems this aborts the load as shortly after this KCT complains violently. Rolling back to 0.7.4 makes the issues disappear.


InvalidOperationException: Operation is not valid due to the current state of the object
at System.Linq.Enumerable.First[UInt32] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at ContractConfigurator.ContractVesselTracker.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0
at ScenarioModule.Load (.ConfigNode node) [0x00000] in <filename unknown>:0
at ScenarioRunner.AddModule (.ConfigNode node) [0x00000] in <filename unknown>:0
at ProtoScenarioModule.Load (.ScenarioRunner host) [0x00000] in <filename unknown>:0
at ScenarioRunner+^K .MoveNext () [0x00000] in <filename unknown>:0

I have the following Contract Packs installed:

- Contract Pack: Anomaly Surveyor 1.0.5

- Contract Pack: RemoteTech 1.1.0

- Contract Pack: SCANSat 0.5.0

- Contract Pack: Tourism 1.0.0

I think, of these I only have RemoteTech and Tourism contracts active at the moment.

Savegame is at https://gist.github.com/lwho/ab86a7d329cd20e4befc (caveat: a lot of other mods installed).

Another hotfix inbound! Download now!

Contract Configurator 0.7.7

  • Hotfix for loading saves from 0.7.4 or older (thanks SpaceNomad).

Link to comment
Share on other sites

I can't reproduce this, but after upgrading to the newest CC (7.6) All my Advanced Progression Contracts Reset. I figured no big deal, I bugged out the 7 day orbit and EVA in space contract anyway, so I could start them over. I picked up the first Kerbal in Orbit Contract and loaded a ship that had invalid parts. Game locked up, had to alt-F4. loaded back up, built a new ship, went to orbit, notice I have no active contracts. Go back to Mission Control, and I have no completed, failed, or active contracts at all.

I tried to reproduce using the same crash method, but I kept my active contracts this time around. Not sure what happened.

My mod list includes, well all of them, but notably; CC, Advanced Progression Contracts, Remote Tech Contracts, ScanSat Contracts.

Edit: Just saw you did another update, I will pick that up and see if it repeats.

Edited by Nachocuban
7.7
Link to comment
Share on other sites

That expression is questionable - it won't know that targetVessel is a vessel, so it'll read as a double and get 0.0. Under the development version, this should work:

        expression = Vessel(targetVessel).IsOrbiting()

Speaking of which, release pushed to tomorrow... just too much pain in getting docking working. I think I've got it right, but it needs a bit more testing.

I first thought it was an odd way to read it to, but it seems as if the expression is making sure the contract requirement of the target vessel matches the value stored in the DATA node which is the specific vessel orbiting Kerbin. It seems to not care that it is a string. Like I said, it seems to work, but does have a bug in it so I will definitely give your suggestion a try. I figure if anyone knows how it works under the hood, you would be the person to ask! thanks for pushing out the updates to docking :)

Well, it was working (I thought. I might just not have cycled the contracts enough to get it to come up again.) It accepts my original syntax as valid, but it seems to have no effect on whether the contract appears.

Using the suggestion you gave, I get an error that says the value supplied for the expression is invalid. And i didn't have any luck trying to write my own requirement. WAY above my ability! LOL!

Edited by metl
update
Link to comment
Share on other sites

I first thought it was an odd way to read it to, but it seems as if the expression is making sure the contract requirement of the target vessel matches the value stored in the DATA node which is the specific vessel orbiting Kerbin. It seems to not care that it is a string. Like I said, it seems to work, but does have a bug in it so I will definitely give your suggestion a try. I figure if anyone knows how it works under the hood, you would be the person to ask! thanks for pushing out the updates to docking :)

No problem, although there was a little grief with updates today.

Re-reading your original post on this, the expression (even my corrected one) is actually useless.... the DATA node already checks for a "null" value and fails the requirement test if it is null. The exception is when you set requiredValue to false (which you have not done). So you should get the same behaviour regardless of the expression.

Link to comment
Share on other sites

No problem, although there was a little grief with updates today.

Re-reading your original post on this, the expression (even my corrected one) is actually useless.... the DATA node already checks for a "null" value and fails the requirement test if it is null. The exception is when you set requiredValue to false (which you have not done). So you should get the same behaviour regardless of the expression.

That's what I thought it was supposed to do and that is probably why it worked before and didn't now. I took that line out thinking it was redundant. So how do we reverse it to where the contract appears under the false condition?

Edited by metl
Link to comment
Share on other sites

That's what I thought it was supposed to do and that is probably why it worked before and didn't now. I took that line out thinking it was redundant. So how do we reverse it to where the contract appears under the false condition?

If you want the contract to show up even when targetVessel is null then you would use requiredValue = false (ie. "target vessel is not a required value for the contract to show up"). Is that what you mean?

Link to comment
Share on other sites

If you want the contract to show up even when targetVessel is null then you would use requiredValue = false (ie. "target vessel is not a required value for the contract to show up"). Is that what you mean?

Nevermind. I'm an idiot. I should have looked at the error log better. It isn't the requiredValue flaging. It says "Can't find method Kerbin for class List 1."

Lts of parser stuff, then it shows

error occured near "*"

[ LKOStation ].where(v =>v.IsOrbiting()).Kerbin()

.*<--Here

I'm thinking I need to define "Celestialbody().Kerbin()" maybe? Or can i do "[ Kerbin ]"? I know, you are probably about getting sick of playing 20 questions just trying to help an idiot (me) solve this one problem. I just assumed the "Random" that was on the wiki example could be swapped with a planet name. I should have known it wouldn't be that simple :P

Link to comment
Share on other sites

Nevermind. I'm an idiot. I should have looked at the error log better. It isn't the requiredValue flaging. It says "Can't find method Kerbin for class List 1."

Lts of parser stuff, then it shows

error occured near "*"

[ LKOStation ].where(v =>v.IsOrbiting()).Kerbin()

.*<--Here

I'm thinking I need to define "Celestialbody().Kerbin()" maybe? Or can i do "[ Kerbin ]"? I know, you are probably about getting sick of playing 20 questions just trying to help an idiot (me) solve this one problem. I just assumed the "Random" that was on the wiki example could be swapped with a planet name. I should have known it wouldn't be that simple :P

[ LKOStation ].where(v =>v.IsOrbiting() && v.CelestialBody() == Kerbin).Random

()

Hope that came out right, on mobile. For more details, have a look at the function reference wiki page.

Link to comment
Share on other sites

Another hotfix inbound! Download now!

Contract Configurator 0.7.7

  • Hotfix for loading saves from 0.7.4 or older (thanks SpaceNomad).

Great, thanks. That fixed that one ;)

I originally wanted to report another bug before I got derailed by not being able to load any savegames anymore ;), but I think this is actually specific to "Contract Pack: RemoteTech 1.1.0", so I'll head over to the other thread...

Link to comment
Share on other sites

[ LKOStation ].where(v =>v.IsOrbiting() && v.CelestialBody() == Kerbin).Random

()

Hope that came out right, on mobile. For more details, have a look at the function reference wiki page.

That took care of the errors, but it doesn't have any effect on whether the contract is offered or not. Does the DATA node need to go within a parameter or requirement? It's currently on it's own. I tried it in the VesselParameterGroup, but it didn't make a difference. On the bright side, by the time I get this figured out, I just might know what I am doing :P

Link to comment
Share on other sites

Ive noticed a small problem over the last week or two. I have been using contract configurator on and off and it seems the only glitch I have noticed is that every time I load up ksp and load my career I get the "launch a new vessel" contract. Even without CC now I get "launch a new vessel" contract whenever I load a current career. Im not sure if this has to do with CC or if anyone else seems to be having this same problem. It is a completely benign issue as it just require launching a new vessel or cheat completing the contract. It just seems like an interesting "glitch"

Link to comment
Share on other sites

That took care of the errors, but it doesn't have any effect on whether the contract is offered or not. Does the DATA node need to go within a parameter or requirement? It's currently on it's own. I tried it in the VesselParameterGroup, but it didn't make a difference. On the bright side, by the time I get this figured out, I just might know what I am doing :P

The DATA node needs to be under the CONTRACT_TYPE. If you put them somewhere else, they will be silently ignored (raised [#174] to output a warning and save you from yourself). When you say, "it doesn't have any effect", what do you mean? Do you mean it's never offered?

Head to the Contract Configurator debug menu (alt-F10), find your contract type and hover over it. That should show the config node details on the right hand side. Slide the mouse over carefully (I know, it's a pain, I'll make it better one of these days) and scroll down in that second area. You should see some details about the values for the attributes after expressions have been expanded. Throw a screenshot of that up and I can take a closer look (although seeing it yourself may make things click if the issue is in the contract type....)

- - - Updated - - -

Ive noticed a small problem over the last week or two. I have been using contract configurator on and off and it seems the only glitch I have noticed is that every time I load up ksp and load my career I get the "launch a new vessel" contract. Even without CC now I get "launch a new vessel" contract whenever I load a current career. Im not sure if this has to do with CC or if anyone else seems to be having this same problem. It is a completely benign issue as it just require launching a new vessel or cheat completing the contract. It just seems like an interesting "glitch"

Definitely sounds like a symptom of a bigger problem. When a contract throws an exception when loading from the save file, it'll kill the contract system, effectively wiping out all your contract history. No contract history is one good reason why you'll see contracts that are supposed to be one time only offered again and again.

Alternate explanation would be that the scenario module that tracks your launch history (ProgressTracking, I think) is crashing in a similar way. Seen that happen when you fire Kerbals (one of Claw's bug fix modules is for that exact scenario).

Regardless, post up a KSP.log and I can have a quick peek.

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...