nightingale

[1.6.x+] Contract Configurator [v1.27.1] [2018-12-28]

Recommended Posts

I think this is a known issue -
There are contracts "stock I believe" that when I accept them, I see them at the space center [after leaving mission control] but when I go to another scene, that contract disappears.  I do have a couple of other contract mods.

Is there something that I need to do, in order to retain that stock contract or?

My apologies for not keeping up.

Share this post


Link to post
Share on other sites

@Aelfhe1m

 

Thanks very much dude.. I will defiantly keep in mind the white space thing, going through all your fixes I started from the bottom first (cos I'm sooo random :P ) and turns out the data node was the only thing I needed to remove :wink:
No idea as to the reason why yet.. just doing stuff and seeing what happens.. I'll figure correlation at some point :D

next "issue" that I am honestly not sure if it is even doable or not.. so I want the player to kill Jeb.. horrific I know, But I have had enough of his front seat jumping ways.

In the params I thought I could make this happen by having a NOT param around the HasAstronaught unfortunately this just gives me the standard kill jeb to lose scenario, the opposite of what I want
any ideas on how to do this?

Edit : small caffeine break inspired me to try this without the "completeInSequence = true" despite the wiki saying this is important..  its not, it does in fact stop it working as I intended :wink:

Edited by Twitchi

Share this post


Link to post
Share on other sites

I'm looking at the RP-0 (v0.54) "LifeSupportStation".  I have two stations in my career game: Skylab orbiting Earth and Salyut-7 orbiting the Moon.  The Salyut-7 station is currently unoccupied and has at least 75% of it's starting life support resources, but my Skylab station is starting to run low.  Right now it's down to 16% food, 30% water and 77% oxygen.  But the "LifeSupportStation" contract will not come up as an option.  So I pulled up the contract to try and figure out what the issue was.  I'm pretty sure I see the first problem.  There is a DATA type setup as follows:

 DATA
 {
  type = Vessel
  requiredValue = true
  uniquenessCheck = GROUP_ACTIVE
  targetVessel1 = AllVessels().Where(v => v.VesselType() == Station && v.FreeDockingPorts()>0 && (v.ResourceCapacity(Food) / v.ResourceQuantity(Food))>0.26 || (v.ResourceCapacity(Water) / v.ResourceQuantity(Water))>0.26 || (v.ResourceCapacity(Oxygen) / v.ResourceQuantity(Oxygen))>0.26).SelectUnique()
  title = Must have an open Docking Port and 25% or less of Life Support Supplies
 }

The v.ResourceCapcity() and v.ResourceQuantity() pieces are wrong, I believe.  As written, if the food capacity of my station is 5000 and I currently have 500 food, that's going to give a result of 5000 / 50 which is 100 and therefore "100 > 0.26" would absolutely be true.  I'm pretty sure it needs to be rewritten as (v.ResourceQuantity()\v.ResourceCapacity()) < 0.26.  However, when I do that, both stations become viable options and the amount of resources I'm supposed to being is always 0. 

There is a second DATA section which is supposed to calculate the amount of life support resources you need to take with you to complete the contract:

 DATA
 {
  type = int
  foodSpace = Round(@/targetVessel1.ResourceCapacity(Food) - @/targetVessel1.ResourceQuantity(Food))
  waterSpace = Round(@/targetVessel1.ResourceCapacity(Water) - @/targetVessel1.ResourceQuantity(Water))
  oxygenSpace = Round(@/targetVessel1.ResourceCapacity(Oxygen) - @/targetVessel1.ResourceQuantity(Oxygen))
  title = Get empty space for Life Support
 }

No matter what I do, those three variables (foodSpace, waterSpace and oxygenSpace) are always set to 0.  I've tried changing the DATA type to double since that is apparently what ResourceCapacity and ResourceQuantity are supposed to return but that had no effect.  I tried removing the Round() function but that didn't help.  I'm assuming that the first DATA type is actually getting some kind of results for ResourceCapacity and ResourceQuantity since the contract doesn't return a divide by 0 error.  Can you take a look at this contract and see what might be the problem?

Share this post


Link to post
Share on other sites

Hey guys.. so I have a situation where all the conditions are met for my contract to be offered, but alas I still am not able to take them. I used to think the cooldownDuration on the CompleteContract requirement might be to blame for this but  after playing about have been convinced this is not so

A bit of forum searching points me to some mythical RNG based selection process turning over in the background.. but is there any way to over ride this and make it immediately available?

I'm typing this before going  to bed and don't have the time to check right now but would turning off the other contracts (I forget which flag turns off contact  groups right now) and having very few contracts to choose from be a dirty  way to make this happen?

Thanks for any assistance :wink:
 

Edited by Twitchi
forgot my manners :P

Share this post


Link to post
Share on other sites

I've noticed that anytime there is an error in the scripting of a Contract Pack cfg file, the Contract Configurator goes ballistic with null refs and then starts randomly showing and hiding many contracts about every 5 seconds.

 

One of my Contract Packs' contracts includes the following which causes it to go haywire. Does anyone know what's wrong with this line?
targetBody1 = ReturnedFromBodies().Where(body => @/stations.Where(v => v.CelestialBody() == body).Count() == 0).SelectUnique()

 

    DATA
    {
        title = Find the stations
        stations = AllVessels().Where(v => v.VesselType() == Station)
        requiredValue = false
        type = List<Vessel>
    }

 

The programmer in me says that Contract.stations is null when the player has not created any spacestations yet (instead of being a 0 count list), thus trying to execute a linq Where clause on it causes a nullref, but I've no experience with making contracts for CC, so perhaps that is not the case?

Edited by Electrocutor

Share this post


Link to post
Share on other sites

I'm having a similar problem, the contracts UI is very active, contracts are jumping in and out, I can occasionally click on them but sometimes can't accept them, even stock ones. The explore minmus one time to expire also counted down really fast. I have a lot of mods, but ScanSat and ReasearchBodies are the only two in the CC settings. I'm also on Linux so this could be a "punctuation matters" kind of an error in a pack.

Share this post


Link to post
Share on other sites

Same issue with appearing and disappearing contracts here as well. So strange.

Affected are Field Research and Bases and Stations.

Edited by Thygrrr

Share this post


Link to post
Share on other sites

This latest Contract Configurator seems to collide with the way upgrade levels and Strategia mix up.

On level 1 Administration permits 2 strategies at a time. Without installing this mod here and entering Administration of course you see no contracts but in the lower half of the window there are 2 strategies permitted. Installing that required mod Contract Configurator here, leads to only one permitted strategy, although the upgrade level still suggests 2 strategies. 

 

Is this known to anyone? Unfortunately I can not say, how this works with KSP 1.3.0. Earlier with KSP 1.2.2 it worked as expected.

Edited by New Horizons

Share this post


Link to post
Share on other sites
    DATA
    {
        type = List<Vessel>
		requiredValue = false
        stations = AllVessels().Where(v => v.VesselType() == Station)
		title = Find the stations
    }
	
    DATA
    {
        type = CelestialBody
        requiredValue = false
        uniquenessCheck = CONTRACT_ACTIVE
        targetBody1 = ReturnedFromBodies().Where(body => @/stations.Where(v => v.CelestialBody() == body).Count() == 0).SelectUnique()
		title = Must have returned from a Celestial Body, but not have any stations deployed.
    }

NullReferenceException: Object reference not set to an instance of an object
    ContractConfigurator.ExpressionParser.CelestialBodyParser.CheckTree (KSPAchievements.CelestialBodySubtree tree, ProgressItem pi)

...

Rethrow as Exception: Error parsing statement.
    Error occurred near '*':
    ReturnedFromBodies().Where(body => @/stations.Where(v => v.CelestialBody() == body).Count() == 0).SelectUnique()
    ....................* <-- HERE

 

If we assume that all LINQ Where clauses will return a list of count 0, the problem has to be that ReturnedFromBodies() is returning null instead of an empty list, right?

Share this post


Link to post
Share on other sites
On 11/1/2017 at 7:25 PM, gamerscircle said:

I think this is a known issue -
There are contracts "stock I believe" that when I accept them, I see them at the space center [after leaving mission control] but when I go to another scene, that contract disappears.  I do have a couple of other contract mods.

Is there something that I need to do, in order to retain that stock contract or?

My apologies for not keeping up.

I didn't see any reply or query to this...  I did go back and read through the last 4 pages of the forums and did not see anything similar.

Share this post


Link to post
Share on other sites
On 11/6/2017 at 10:19 AM, Waxing_Kibbous said:

I'm having a similar problem, the contracts UI is very active, contracts are jumping in and out, I can occasionally click on them but sometimes can't accept them, even stock ones. The explore minmus one time to expire also counted down really fast. I have a lot of mods, but ScanSat and ReasearchBodies are the only two in the CC settings. I'm also on Linux so this could be a "punctuation matters" kind of an error in a pack.

It looks like my issue is caused by Research Bodies and/or Kerbal Health, if I remove one  things are normal. I'm curious if other people with issues are also using RB/KH.

Edited by Waxing_Kibbous

Share this post


Link to post
Share on other sites
21 hours ago, gamerscircle said:

I didn't see any reply or query to this...  I did go back and read through the last 4 pages of the forums and did not see anything similar.

Make sure the contract actually still exists when you click accept. There is a very annoying bug that makes contracts appear and disappear randomly (sometimes very rapidly). If your contract happened to have disappeared at the moment when you clicked accept, it will not have actually been accepted. Even when a contract disappears, it still stays showing in the right pane if you had clicked on it earlier.

Edited by Electrocutor

Share this post


Link to post
Share on other sites
3 hours ago, Electrocutor said:

Make sure the contract actually still exists when you click accept. There is a very annoying bug that makes contracts appear and disappear randomly (sometimes very rapidly). If your contract happened to have disappeared at the moment when you clicked accept, it will not have actually been accepted. Even when a contract disappears, it still stays showing in the right pane if you had clicked on it earlier.

 

1.) Go to mission control - accept contact
2.) Exit mission control, check at the Space Center - contract is still listed
3.) Enter VAB, check for contract - no longer available

Share this post


Link to post
Share on other sites
4 minutes ago, gamerscircle said:

 

1.) Go to mission control - accept contact
2.) Exit mission control, check at the Space Center - contract is still listed
3.) Enter VAB, check for contract - no longer available

I've not seen or heard of a disappearing bug like that mentioned anywhere; only odd completions and failures. If it happens again, I'd say grab your KSP.log and if not a stock contract, the log for the contract pack under GameData/ContractConfigurator/log; then drop them along with a description into https://github.com/jrossignol/ContractConfigurator/issues.

Share this post


Link to post
Share on other sites
On 12-11-2017 at 8:16 PM, Electrocutor said:

I've not seen or heard of a disappearing bug like that mentioned anywhere; only odd completions and failures. If it happens again, I'd say grab your KSP.log and if not a stock contract, the log for the contract pack under GameData/ContractConfigurator/log; then drop them along with a description into https://github.com/jrossignol/ContractConfigurator/issues.

I have the same problem. I don't use this mod tho. But my contracts are disappearing too whenever I go back to the VAB or the launchpad. Sometimes it does work, so it's hard to find which mod this causes.

Share this post


Link to post
Share on other sites
On 11/12/2017 at 10:26 AM, Electrocutor said:

Make sure the contract actually still exists when you click accept. There is a very annoying bug that makes contracts appear and disappear randomly (sometimes very rapidly). If your contract happened to have disappeared at the moment when you clicked accept, it will not have actually been accepted. Even when a contract disappears, it still stays showing in the right pane if you had clicked on it earlier.

I'll have to dig back through posts at the end of 2016 / start of 2017, but a lot of that is caused by contracts that are not written properly.  For instance, there's a good way and a bad way to calculate the target body for your contract.  Do it the bad way and CC will be constantly recalculating until it finds a contract.

I've never had the issue with ResearchBodies contracts, but whichever contract pack that I use for ScanSAT and Bases & Stations have the issue.

(I remember having to work through the issue when I was putting together Stock Antenna Balance contracts.)

Edit 1: If you're digging through the post history, it's somewhere prior to page 150 where this is talked about it.  I haven't found it yet, but I know it's discussed in this thread.  Or maybe on the wiki...

Edit 2: It's this post that distills some wisdom on how to properly pick a random target.

 

Edited by WuphonsReach

Share this post


Link to post
Share on other sites

I've been having problems in recent version where Contract Configurator is expecting an integer for the last random seed and it is receiving a float.   This is triggering an NRE, at least on Linux.

I can isolate it, get a bug report, and make sure it is contract configurator and not a mod conflict..  Do you know a specifically "Clean" contract set I should use to test it?

Share this post


Link to post
Share on other sites
On 05.11.2017 at 7:20 PM, Jalaris said:

I've found a bug: the launch your first vessel and gather scientific data from kerbin contracts no longer work with seti-contracts installed. You can see them, and you can accept them, but when you go to the VAB or launchpad, they disappear entirely and go back to the mission giver.

Hi there!

I'm having the same problem:

Contracts of "Kerbal World Record-Keeping Society" like "Launch your First vehicle", "Gather Scientific data from Kerbin", "Explore Kerbin" can be accepted in Mission Control, but they disappear and can not be completed, when entering VAB/SPC

Edited by Nik Power

Share this post


Link to post
Share on other sites

How do you disable certain types of contracts like parts testing after you don't want them anymore? I could only disable them as part of the game start setup but not afterwards. 

Share this post


Link to post
Share on other sites

@sardia Click the difficulty options button at the top of the settings window. This will give you access to most of the same settings that were available during game start.

Share this post


Link to post
Share on other sites

Hi nightingale,

A couple of players reported a Reflection issue of Contract Configuration 1.23.3 against newly-released RemoteTech 1.8.9 on KSP 1.3.1. Here's my output_log file.

Based on my investigation, the reflection issue seems to be due to the attributes of a new functionality added to RT 1.8.9. Here's the offending commit of RT codebase. I guess CC was compiled particularly against RT 1.8.8 and didn't expect the new attributes but I can hardly believe the reflection could fail against new attributes.

If possible, please advise me on possible changes required to be make to RT codebase to resolve the reflection issue.

Share this post


Link to post
Share on other sites

I think this is actually a Historic Missions: Contract Pack issue, and I have asked over there, but I'm hoping someone here might know.  I'm playing 1.2.2 with RO/RSS/RP-0 and the Historic Missions pack.  So far everything has gone just fine but recently I've starting running low on useful available contracts.  I've currently got 5 active contracts (all 2 star) including Mariner 10, Viking 2 and STS-41B (all from historic missions).  I've completed all the Apollo contracts, the ASTP contract, the Helios NASA contract as well as the first four Space Shuttle contracts.  But I've never been offered the Pioneer 10 & 11 contracts, nor the Voyager 1& 2 contracts.  As far as I can tell, I meet all the prerequisites to get those contracts, but they don't show in the list.  Anyone have any idea what the issue might be?

Share this post


Link to post
Share on other sites

How can I set multiple needs to check for AirplanePlus and TweakScale?

CONTRACT_TYPE:NEEDS[AirplanePlus]
{

 

I can check for one, but how do I add a second check?

Share this post


Link to post
Share on other sites
1 hour ago, inigma said:

How can I set multiple needs to check for AirplanePlus and TweakScale?

CONTRACT_TYPE:NEEDS[AirplanePlus]
{

 

I can check for one, but how do I add a second check?

Think you do NEEDS:[AirplanePlus,TweakScale,OtherMod,OtherMod] (I believe commas mean "AND" in context...)

Share this post


Link to post
Share on other sites

Question 1:

Looking to build a contract that says "you must produce X units of Y" (and tracks how many units you have produced/consumed since acceptance of the contract).  Very similar to the stock "RESOURCE_REQUEST {}" contracts, but done through CC.

We have "HasResource" and "ResourceConsumption", but not something that tracks resource production over time (maybe "ResourcesConsumed"?).  I could sort of get there with combining "duration" and "ResourceConsumption".

Question 2:

Also have trouble with this bit of code:

Spoiler

DATA
{
type = string
title = What to harvest
harvestResource = Ore
}

PARAMETER
{
name = ResourceConsumption
type = ResourceConsumption
title = Harvest at least @/harvestRate units per second of @/harvestResource
resource = Resource(@/harvestResource)
minRate = @/harvestRate * -1
}    

 

Not sure the global function works: resource = Resource(@/harvestResource) 

Question 3:

Is there a way to create a list of resource types and pick one at random?

 

Edited by WuphonsReach

Share this post


Link to post
Share on other sites

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