Jump to content

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


nightingale

Recommended Posts

With it set as either true or false, it is always still offered. I've double-checked to make sure it is in the CONTRACT_TYPE area, but I will move it above everything else to make sure I haven't missed a } somewhere. On the debug menu, there aren't any errors at all for the contract. And I think your debug menu works just fine. In fact, it gives an extremely thorough amount of information! I'll get a screenshot up here in just a few.

pxgeFlK.jpg

The DATA node appears to be working correctly. the contract shows the target vessel as being LKOCore (my VAB name of the ship used to do complete the contract.) But even though the requirement is set to require a false (null?) value, the contract still appears.

In case you are wondering what in the world I am doing, I am trying to help severdsolo finish out the space station contract pack. The goal I am working on is to make it so the contract to launch the initial space station core no longer appears once there is a station in orbit, then the expansion contracts will show up. He originally used the ContractCompleted requirement, but that proved to be too buggy and did no good in the case where a station might get destroyed or disappear. I haven't tested it on the expansion contracts yet as I wanted to make it work here first.

Edited by metl
more info
Link to comment
Share on other sites

Gotcha, it's all clicking in place now. I think you may have mentioned a few days ago when we were looking at the expression requirement, but I never put the two together.

The requiredValue attribute you're referring to doesn't work the way you think it does. Here's the quick and dirty truth table to make it plain as day (also I improved the description in the wiki):

[TABLE=width: 500]

[TR]

[TD]requiredValue?[/TD]

[TD]Expression is null?[/TD]

[TD]Result[/TD]

[/TR]

[TR]

[TD]false[/TD]

[TD]false[/TD]

[TD]Contract is offered[/TD]

[/TR]

[TR]

[TD]false[/TD]

[TD]true[/TD]

[TD]Contract is offered[/TD]

[/TR]

[TR]

[TD]true[/TD]

[TD]false[/TD]

[TD]Contract is offered[/TD]

[/TR]

[TR]

[TD]true[/TD]

[TD]true[/TD]

[TD]Contract is not offered[/TD]

[/TR]

[/TABLE]

So, a few ways to get this working the way you want, but here's what I'd suggest:

DATA
{
type = Vessel
requiredValue = false
targetVessel = [COLOR=#333333][ LKOStation ].Where(v =>v.IsOrbiting() && v.CelestialBody() == Kerbin).Random[/COLOR][COLOR=#333333]()[/COLOR]
}

REQUIREMENT
{
name = NoStation
type = Expression

expression = !(@/targetVessel.IsOrbiting())
}

Your two scenarios:

  1. LKOStation exists. @/targetVessel gets set, DATA node passes. Requirement fails, because vessel is in orbit.
  2. LKOStation doesn't exist. @/targetVessel is null, but DATA node passes because requiredValue = falase. Requirement passes, because a null vessel returns false.

In future, I think I'll add a null check, maybe via something like '@/targetVessel == null' to make this a little bit simpler.

Link to comment
Share on other sites

I was pretty sure an expression would have to be used in some way. I'll play around with this and see if I can make it work. At the moment, it only wants to give the contract if I set the expression to require true (I took out the !) but then it won't stop giving it out. Hmm.

I had actually tried the '@/targetVessel == null' I don't remember what the error was, but CC wasn't happy with it! Lol!

Edited by metl
Link to comment
Share on other sites

Basically, if the expression in a requirement returns true, the contract can be offered, otherwise it can't. This should work as well - if it's not then it sounds like something wrong on my end. :)


REQUIREMENT
{
name = NoStation
type = Expression

expression = @/targetVessel.IsOrbiting()
invertRequirement = true
}

Link to comment
Share on other sites

Yeah I tried that too. I even tried


DATA
{
type = Vessel
requiredValue = true
targetVessel = [ LKOStation ].Where(!v =>v.IsOrbiting() && v.CelestialBody() == Kerbin).Random()
}

REQUIREMENT
{
name = NoStation
type = Expression

expression = (!@/targetVessel.IsOrbiting())
}

Link to comment
Share on other sites

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

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.

Here is my log. Thanks for taking a look. https://www.dropbox.com/s/j9pm1i59c04ycoi/Player.log?dl=0

Link to comment
Share on other sites

Basically, if the expression in a requirement returns true, the contract can be offered, otherwise it can't. This should work as well - if it's not then it sounds like something wrong on my end. :)


REQUIREMENT
{
name = NoStation
type = Expression

expression = @/targetVessel.IsOrbiting()
invertRequirement = true
}

I finally got it fixed with:


DATA
{
type = Vessel
requiredValue = false
targetVessel = [ LKOStation ].Random()
}

REQUIREMENT
{
name = NoStation
type = Expression

expression = (!@/targetVessel.IsOrbiting())
}

Thank you for the help. If there is a problem on your end, I hope this helps you find it.

Link to comment
Share on other sites

I finally got it fixed with:


DATA
{
type = Vessel
requiredValue = false
targetVessel = [ LKOStation ].Random()
}

REQUIREMENT
{
name = NoStation
type = Expression

expression = (!@/targetVessel.IsOrbiting())
}

Thank you for the help. If there is a problem on your end, I hope this helps you find it.

Nope, problem is between the keyboard and the chair.... I never looked that closely at the DATA node expression we'd come up with from before. This should also work, and be a bit cleaner:

DATA{
type = Vessel
requiredValue = false
targetVessel = LKOStation
}


REQUIREMENT
{
name = NoStation
type = Expression


expression = (!@/targetVessel.IsOrbiting())
}

Link to comment
Share on other sites

The problem with the hascrew parameter causing contract failure since the last update remains, anytime the parameter isn't met the contracts in question fail out, rather then stay greyed/incomplete.

Link to comment
Share on other sites

In the screenshot you included, the contract isn't actually failed - if you switch back to another vessel that meets it, the check should come back. The intention is to show the state of the parameter for the current vessel.

euexqa.jpg

If the contract line is turning red, you're getting a failure message in the top right corner (with associated penalties) or the Crew line gets an X, then those are all problems. Otherwise this seems like it's working correctly.

Link to comment
Share on other sites

If the contract line is turning red, you're getting a failure message in the top right corner (with associated penalties) or the Crew line gets an X, then those are all problems. Otherwise this seems like it's working correctly.

Getting failure message in top-right (with penalty) on saves that pre-date the current update, but on fresh saves it X's out without the top-right failure warning.

Not sure if it was a local fluke or what. *shrug*

If the X is intended behavior now, and is only a visual warning, I'll advise players to just ignore it :)

Link to comment
Share on other sites

It really shouldn't affect older saves differently... but if it's working on the newest update I'm afraid I'll have to just shrug that part off...

The X's were always intended behaviour... but I don't believe they were working correctly for HasCrew until recently. It makes a lot more sense for stuff like the RemoteTech connectivity parameter, where having the X gives the player a very clear cue as to what's wrong (when it can be one of about 5 different things). But yeah, in the name of consistency, I'd like to keep HasCrew the same even though it doesn't fit quite as well.

Link to comment
Share on other sites

Okay everyone, I'm going to be doing some cleanup in preparation for the Contract Configurator 1.0.0 release. This means that I'm planning on removing parameters from the very first release (where everything was just a wrapper to stock stuff) in favour of other stuff. There should be no loss of functionality - as everything that's being removed is redundant. Here's the plan, please let me know if anyone has concerns over any of this:

[TABLE=width: 0]

[TR]

[TD]Parameter[/TD]

[TD]0.7.5[/TD]

[TD]1.0.0[/TD]

[TD]Notes[/TD]

[/TR]

[TR]

[TD]EnterOrbit[/TD]

[TD]Obsolete[/TD]

[TD]Removed[/TD]

[TD]Use VesselHasVisited, Orbit or ReachState instead.[/TD]

[/TR]

[TR]

[TD]EnterSOI[/TD]

[TD]Obsolete[/TD]

[TD]Removed[/TD]

[TD]Use VesselHasVisited, Orbit or ReachState instead.[/TD]

[/TR]

[TR]

[TD]LandOnBody[/TD]

[TD]Obsolete[/TD]

[TD]Removed[/TD]

[TD]Use VesselHasVisited, Orbit or ReachState instead.[/TD]

[/TR]

[/TABLE]

I can deal with the removal of EnterOrbit and LandOnBody, since there is a specific replacement for each.

However, the EnterSOI does not have a specific replacement. I may be missing something, but the ReachState doesn't have anything specific related to SOI (unless the docs aren't updated). This is a problem for my contracts. For now I'm using a specific altitude, but am not too happy with it.

Link to comment
Share on other sites

I can deal with the removal of EnterOrbit and LandOnBody, since there is a specific replacement for each.

However, the EnterSOI does not have a specific replacement. I may be missing something, but the ReachState doesn't have anything specific related to SOI (unless the docs aren't updated). This is a problem for my contracts. For now I'm using a specific altitude, but am not too happy with it.

Try this out (let me know if it doesn't work as a replacement for EnterSOI):

[COLOR=#333333]PARAMETER
[/COLOR]{
name = ReachState
type = ReachState
targetBody = Minmus
}

Link to comment
Share on other sites

Okay, I'll test this out tomorrow evening and see where the problem is.

Edit: Actually, if you can send me the contract definition that may help, in case the problem is something else.

Im sorry what do you mean by that?

Link to comment
Share on other sites

Im sorry what do you mean by that?

I meant the CONTRACT_TYPE and everything in it in the .cfg file.... but I realize now that I meant that for metl and not you. :)

Anyway, taking a look at the log, that's all I needed for your issue.

- - - Updated - - -

Well, nothing particularly damning in the log, except I see that you had and then uninstalled the RemoteTech pack - which I think is sort of the root of your problem. Since Contract Configurator 0.7.3 that will no longer cause a fatal problem, but that update is 11 days old, and you originals said you'd been having the problem for "a week or two". You also said "Even without CC now I get "launch a new vessel" contract whenever I load a current career". So if you remove CC, I'm not sure how KSP will handle the "unknown" contract, but I strongly suspect it would also cause the contract system to load improperly.

So I think if you keep CC installed and keep playing as normal, you should be okay from here on out. But correct me if I'm wrong and you still keep seeing the issue....

Link to comment
Share on other sites

Experiencing a new issue. Sometimes, but not always (maybe it has to do with rocket construction?), upon staging something AFTER parameter completion, the defined "vessel" seems to change to debris (discarded part?). I'm not sure how else to explain it, but for example the following contract to simply orbit a kerbal (for context, his had been working fine previously and works about 50% of the time):

PARAMETER
{
name = VesselParameterGroup2001
type = VesselParameterGroup
define = Kerbin Orbiter
PARAMETER
{
name = HasCrew2001
type = HasCrew
trait = Pilot
minCrew = 1
}
PARAMETER
{
name = ReachState2001
type = ReachState
targetBody = Kerbin
situation = ORBITING
minAltitude = @/targetBody.AtmosphereAltitude()
disableOnStateChange = true
}
}
PARAMETER
{
name = VesselParameterGroup2002
type = VesselParameterGroup
vessel = Kerbin Orbiter
PARAMETER
{
name = ReturnHome2001
type = ReturnHome
completeInSequence = true
}
}

Launch rocket, go up, make orbit, parameter goes green everything looking good. Stage into final return section, and this happens:

fro76.jpg

Landing and recovering doesn't complete the Return Home parameter.

Any thoughts on what is happening?

(Also, the central part of the rocket is the crew pod - the staging doesn't discard anything important just dead tanks and engines)

Link to comment
Share on other sites

@tjsnh - I think this may be the same issue that I fixed for metl last night. Can you grab the dev version from here and let me know if it fixes it? If it does I'll release soon (likely tonight). If not I'll do some more digging!

Roger that, I'm heading out for a bit but I'll give it a shot this afternoon and let you know. :)

Link to comment
Share on other sites

I think there might be a problem with the duration parameter. As far as I can tell the timer should start for this parameter, but it is stuck on 2:00 (using your latest dev build)

ocW2qXJ.png

PARAMETER
{
name = Sequence
type = Sequence
hiddenParameter = Engineer
PARAMETER
{
name = VesselParameterGroup
type = VesselParameterGroup

vessel = LKOStation

PARAMETER
{
name = HasCrew
type = HasCrew

// (Optional) The type of trait required. Valid values are:
// Pilot
// Engineer
// Scientist
trait = Engineer

title = Kerbal must be an engineer and on board the KSS.
}
}
PARAMETER
{
name = Engineer
type = All

PARAMETER
{
name = VesselIsType
type = VesselIsType
vesselType = EVA
completeInSequence = True
}
PARAMETER
{
name = HasCrew
type = HasCrew

// (Optional) The type of trait required. Valid values are:
// Pilot
// Engineer
// Scientist
trait = Engineer
completeInSequence = True
}

PARAMETER
{
name = Duration
type = Duration

duration = 2m
preWaitText = Waiting for an Engineer.
waitingText = Repair in progress
// The completionText is displayed when the timer completes.
// Default = Wait time over
completionText = Module repaired! Get back to the station.
completeInSequence = true
}
disableOnStateChange = true
title = Send your Engineer on EVA to fix the panel.
}
}

Edited by severedsolo
Link to comment
Share on other sites

@tjsnh - I think this may be the same issue that I fixed for metl last night. Can you grab the dev version from here and let me know if it fixes it? If it does I'll release soon (likely tonight). If not I'll do some more digging!

FYI - looks like the DLL you linked to fixes the problem, flew 5 tests, all 5 were clean.

Link to comment
Share on other sites

Fixes the RemoteTech contract pack. Download it here!

Contract Configurator 0.7.9

  • Add support for Part (AvailablePart) in expressions.
  • Fix to passengers not being seated when the capsule crew capacity is bigger than the number of seats in the IVA (thanks SpaceNomand).
  • More fixes to vessel tracking (fixes issues with RemoteTech contract pack). Thanks to Invader Myk.
  • Minor bug fixes.

Link to comment
Share on other sites

I think there might be a problem with the duration parameter. As far as I can tell the timer should start for this parameter, but it is stuck on 2:00 (using your latest dev build)

Not sure if you fixed it with one of the latest updates, but it's working now so thanks!

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