Jump to content

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


Recommended Posts

After doing some more editing, I think I've figured most of the things out, however there's something that I find odd and I don't know why CC is working this way:

I have an int DATA node in the Groups.cfg for a funds multiplier like this:

DATA
{
	type = int
	title = Fund Modifier
	fundModifier = 1
}

and in a CONTRACT_TYPE, I have this:

advanceFunds = 10000 * @localMod
rewardFunds = 5000 * @localMod

DATA
{
	type = int
	localMod = $fundModifier
}

BEHAVIOUR
{
	name = NoFailureProfit
	type = Expression
	
	CONTRACT_COMPLETED_SUCCESS
	{
		$fundModifier = 0
	}
}

Now, my intention with this is for Contract 1 to be completed once with a >0 advance and reward fund. And imo this should, in theory work. However, CC seems to register localMod as 0, even though $fundModifier hasn't been, or shouldn't've been affected by the BEHAVIOUR node.

Is there any way to fix this problem? Any alternate solution I should use?

Link to post
Share on other sites
54 minutes ago, Teykn said:

however there's something that I find odd and I don't know why CC is working this way:

Data from a group config is accessed by @[groupname]:[variable] in an expression. In your example if your group name was "MyGroup" your variable in a contract would be @MyGroup:fundModifier. Group data is good for static values that do not change that can be shared with all contracts offered by the group.  

The $fundModifier is a variable in the persistent data store that you are referencing in your contract. If not previously set, the default value of 0 is set for numbers and whatever the default value is for other data types like strings etc. 

Your initial contract should set values in the data store to what you want. In the example below I set the value I want in my first contract in a series when the contract is offered. Subsequent contracts can then read this value and then update it on success of failure. It is a good idea to prepend some kind of mod identifier on your persistent data store variables (I use "ksrgap") because it is accessible by all contracts from any pack. If some other mod uses "fundModifier" it will interfere with yours.   

// Persistent Storage routines
	BEHAVIOUR
	{
		name = Expression
		type = Expression

		CONTRACT_OFFERED
		{
			type = int		
			ksrgapFlightProgress = -2
		}		
		
		// On success set the progress counter
		CONTRACT_COMPLETED_SUCCESS
		{
			type = int
			ksrgapFlightProgress = $ksrgapFlightProgress + 1
		}
	}

You can see the contents of the persistent data store in your games save persistent.sfs file. Open it with a text editor and search for Persistent Data Store and you can see all the values that are set there.

Link to post
Share on other sites
  • 2 weeks later...

Hi, I got this error:

[EXC 21:28:12.726] NullReferenceException: Object reference not set to an instance of an object
	ContractConfigurator.ExpressionParser.ExperienceTraitParser.EQ (Experience.ExperienceTrait a, Experience.ExperienceTrait b) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ApplyBooleanOperator (T lval, System.String op, T rval) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ApplyOperator[TResult] (T lval, System.String op, T rval) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseOperation[TResult] (T lval, System.String op) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] (T lval) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatementInner[TResult] () (at <ef0243a06f2841fe9bf57034a334902e>:0)
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] () (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ListExpressionParser`1[T].ParseWhereMethod[TResult] (System.Collections.Generic.List`1[T] obj) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ListExpressionParser`1[T].ParseMethod[TResult] (ContractConfigurator.ExpressionParser.BaseParser+Token token, System.Collections.Generic.List`1[T] obj, System.Boolean isFunction) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseMethod[TResult] (ContractConfigurator.ExpressionParser.BaseParser+Token token, T obj, System.Boolean isFunction) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].CompleteIdentifierParsing[U] (U value) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
	System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSpecialIdentifier (ContractConfigurator.ExpressionParser.BaseParser+Token token) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSimpleStatement[TResult] () (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatementInner[TResult] () (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] () (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	Rethrow as Exception: Error parsing statement.
	Error occurred near '*':
	@/targetVessel.Crew().Where(k => k.ExperienceTrait() == "Scientist").Count() > 0
	...................................................................* <-- HERE
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ExecuteExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ConfigNodeUtil.ParseSingleValue[T] (System.String key, System.String stringValue, System.Boolean allowExpression) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ConfigNodeUtil.ParseValue[T] (ConfigNode configNode, System.String key, System.Boolean allowExpression) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	ContractConfigurator.ConfigNodeUtil.ParseValue[T] (ConfigNode configNode, System.String key, System.Action`1[T] setter, ContractConfigurator.IContractConfiguratorFactory obj, T defaultValue, System.Func`2[T,TResult] validation) (at <ef0243a06f2841fe9bf57034a334902e>:0)
	UnityEngine.DebugLogHandler:LogException(Exception, Object)
	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
	UnityEngine.Debug:LogException(Exception)
	ContractConfigurator.LoggingUtil:LogException(Exception)
	ContractConfigurator.ConfigNodeUtil:ParseValue(ConfigNode, String, Action`1, IContractConfiguratorFactory, Boolean, Func`2)
	ContractConfigurator.ConfigNodeUtil:ParseValue(ConfigNode, String, Action`1, IContractConfiguratorFactory, Func`2)
	ContractConfigurator.DeferredLoadUtil:ExecuteLoad(DeferredLoadObject`1)
	System.Reflection.MethodBase:Invoke(Object, Object[])
	ContractConfigurator.<UpdateNonDeterministicValuesIterator>d__31:MoveNext()
	System.Linq.ConcatIterator`1:MoveNext()
	ContractConfigurator.<GenerateContract>d__33:MoveNext()
	ContractConfigurator.<ContractEnumerator>d__32:MoveNext()
	ContractConfigurator.ContractPreLoader:Update()

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

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

Hi, I got this error:

See the attached post. The exception occurs when no rover is deployed, or when a rover without a scientist is deployed. Once there is a rover with a scientist the parse will work correctly and allow the contract to work.  

 

Link to post
Share on other sites
1 minute ago, Caerfinon said:

See the attached post. The exception occurs when no rover is deployed, or when a rover without a scientist is deployed. Once there is a rover with a scientist the parse will work correctly and allow the contract to work.  

 

Right, so I just ignore it then. Thanks!

Link to post
Share on other sites
  • 3 weeks later...

How do you change the max of accepted contracts in a given level?

I mean, I want to accept a lot, or even infinite, contracts in all levels, current level is 2, how do I modify the mod files to allow that?

Link to post
Share on other sites
58 minutes ago, Darks :v said:

How do you change the max of accepted contracts in a given level?

The max number of contracts per level is controlled by upgrades to mission control this can be changed with a Custom Barn Kit config.

The maximum number of contracts that can be accepted of each prestige level can be set in Contract Configurator by the game difficulty settings.  Change the Active Contract Multiplier slider to a value you would like. The default value is 1.0 

  • At slider 8 (maximum value)  it allows 42 trivial, 33 significant, and 24 exceptional contracts at the same time. 

If you want to change the values per Mission Control level use this;

 

Link to post
Share on other sites
Quote
On 5/4/2021 at 6:34 PM, Caerfinon said:

Change the Active Contract Multiplier slider to a value you would like. The default value is 1.0 

 

I have installed Custom Barn Kit but that boat sailed, the game is on going

 

On 5/4/2021 at 6:34 PM, Caerfinon said:
  • At slider 8 (maximum value)  it allows 42 trivial, 33 significant, and 24 exceptional contracts at the same time. 

 

I know that persistent files in save folder are the current status of the game, so i search that value in persistent.sfs, and use notepad to change that value, specifically in ContractConfiguratorParameters, from 1 to 8

ActiveContractMultiplier = 1 >> ActiveContractMultiplier = 8

 

But nothing changed, values still the default, i enter control station, and only shows max active contracts, in actives label. When i change to All lable, it shows the default values, then i close the game, and reopened persistent.sfs, but value was still 8

 

persistenct,loadmeta contains only values about the game, like science and money
 

Edited by Darks :v
Link to post
Share on other sites
21 minutes ago, Darks :v said:

so i search that value in persistent.sfs

Why not just change it in the in-game settings?  Press ESC, go into settings, choose difficulty, find the Contract Configurator tab and set the setting there?  

Link to post
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...