Jump to content

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


nightingale

Recommended Posts

I'm getting this error

Exception occured while loading contract 'MannedAltitude18km': System.NullReferenceException: Object reference not set to an instance of an object at ContractConfigurator.Behaviour.Expression.OnLoad (.ConfigNode configNode) [0x00000] in <filename unknown>:0 at ContractConfigurator.ContractBehaviour.Load (.ConfigNode configNode) [0x00000] in <filename unknown>:0 at ContractConfigurator.ContractBehaviour.LoadBehaviour (.ConfigNode configNode, ContractConfigurator.ConfiguredContract contract) [0x00000] in <filename unknown>:0 at ContractConfigurator.ConfiguredContract.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0

ive uninstalled and reinstalled all my contracts but still same error whats causing it? (when i load the ship building)

Link to comment
Share on other sites

I'm getting this error

Exception occured while loading contract 'MannedAltitude18km': System.NullReferenceException: Object reference not set to an instance of an object at ContractConfigurator.Behaviour.Expression.OnLoad (.ConfigNode configNode) [0x00000] in <filename unknown>:0 at ContractConfigurator.ContractBehaviour.Load (.ConfigNode configNode) [0x00000] in <filename unknown>:0 at ContractConfigurator.ContractBehaviour.LoadBehaviour (.ConfigNode configNode, ContractConfigurator.ConfiguredContract contract) [0x00000] in <filename unknown>:0 at ContractConfigurator.ConfiguredContract.OnLoad (.ConfigNode node) [0x00000] in <filename unknown>:0

ive uninstalled and reinstalled all my contracts but still same error whats causing it? (when i load the ship building)

Hmmm... I couldn't reproduce this one. Are you able to send me your save file (persistent.sfs)?

Link to comment
Share on other sites

Ok. I guess I'm just looking in the wrong place.

I swear I'd done the Duration.Round(), but it's not there and I don't have unmerged stuff on the wiki. So fixed it now. The Reputation() function is in a dumb place (the ContractPrestige page). So I'm going to move it to where it should be - the Global Functions page.

Link to comment
Share on other sites

I've created a duration variable named "Duration" which generated a random, rounded duration between 7 and 14 days. I want to use the resulting number of days as an int value so I created an int variable named "DurationText" but I'm running into issues. I know you can cast duration variables as double. I also know you can't do math on a duration. So I tried the following line:

DurationText = double(@Duration) / 86400

This doesn't work though I'm not exactly sure why not. Shouldn't the double() function convert @Duration into a float variable so that the rest of the equation can complete?

Link to comment
Share on other sites

I've created a duration variable named "Duration" which generated a random, rounded duration between 7 and 14 days. I want to use the resulting number of days as an int value so I created an int variable named "DurationText" but I'm running into issues. I know you can cast duration variables as double. I also know you can't do math on a duration. So I tried the following line:

DurationText = double(@Duration) / 86400

This doesn't work though I'm not exactly sure why not. Shouldn't the double() function convert @Duration into a float variable so that the rest of the equation can complete?

It should work - you'll have to say what's actually going wrong though for me to help much more. :)

Also, the variable name confuses me - why DurationText if it's an integer? I assume you want to end up with it in the form "7 days" or something?

Link to comment
Share on other sites

It should work - you'll have to say what's actually going wrong though for me to help much more. :)

Also, the variable name confuses me - why DurationText if it's an integer? I assume you want to end up with it in the form "7 days" or something?

Got it - think I see the issue. Try the latest dev build.

Link to comment
Share on other sites

It should work - you'll have to say what's actually going wrong though for me to help much more.

Also, the variable name confuses me - why DurationText if it's an integer? I assume you want to end up with it in the form "7 days" or something?

Is there an output file that includes the contract configurator log details? I could get you the exact error that way. Without manually writing the entire error it basically says:

Rethrow as System.Exception: Error parsing statement.

Error occurred near '*':

double(@Duration) / 86400

As for why the name, no reason really. I'm using the variable in the description field: "....(must orbit for @/DurationText days)..." But I needed it to be an int instead of a string because I'm also using the variable to alter the mission reward. So the longer the mission has to run, the more it's worth.

Link to comment
Share on other sites

Is there an output file that includes the contract configurator log details? I could get you the exact error that way. Without manually writing the entire error it basically says:

Rethrow as System.Exception: Error parsing statement.

Error occurred near '*':

double(@Duration) / 86400

As for why the name, no reason really. I'm using the variable in the description field: "....(must orbit for @/DurationText days)..." But I needed it to be an int instead of a string because I'm also using the variable to alter the mission reward. So the longer the mission has to run, the more it's worth.

It's all in KSP.log. And that's not the full error - there should be the actual error as well. Anyway, if it's the same issue that I found, try the dev version linked in my previous post.

Link to comment
Share on other sites

It's all in KSP.log. And that's not the full error - there should be the actual error as well. Anyway, if it's the same issue that I found, try the dev version linked in my previous post.

Yeah, that looks like it fixed it.

Link to comment
Share on other sites

So I have a new question, I am trying to add a description to a contract that changes based on the targetbody2. To do this I am trying to use a long if-then statement listing all the valid bodies and stating the desired description, however it picks up the @/targetbody2 and returns the body name for all of them but just lists the entire if-then statement. I tried putting parentheses and double quotes around it but maybe I did put them in the correct places. This method works in other areas so I thought it might be a good start here. Tried finding some samples like what I'm trying to do first but couldn't find anything other than coherent contracts, should I try to write it more like that? As always, link to the file in question: http://s000.tinyupload.com/index.php?file_id=45793942251904849091

Link to comment
Share on other sites

So I have a new question, I am trying to add a description to a contract that changes based on the targetbody2. To do this I am trying to use a long if-then statement listing all the valid bodies and stating the desired description, however it picks up the @/targetbody2 and returns the body name for all of them but just lists the entire if-then statement. I tried putting parentheses and double quotes around it but maybe I did put them in the correct places. This method works in other areas so I thought it might be a good start here. Tried finding some samples like what I'm trying to do first but couldn't find anything other than coherent contracts, should I try to write it more like that? As always, link to the file in question: http://s000.tinyupload.com/index.php?file_id=45793942251904849091

Doing that is a bit tricky due to the way that strings are handled (only limited "search and replace" type operations are really possible within the string. You can do what you want by breaking it up. There's a good example here in Field Research.

Link to comment
Share on other sites

Hmm, Everytime i boot up KSP i have to configure the contracts again. Is that normal? It doesnt seem to remember filter settings inbetween play sessions.

I have the exact same issue with stock contracts, it forgets my settings each time i exit the application (curiously, it always remembers my non-stock settings). It wouldn't bother me at all to simply set it up every time I play if it weren't for the fact that all contracts which belong to one of the temporarily enabled groups get dropped from my active listing each time I load the save.

I had a go at creating a .cfg file with the content from https://github.com/jrossignol/ContractConfigurator/wiki/Miscellaneous, but it still resets enabled/disabled tags when I load a save.

Edited by algeo
Link to comment
Share on other sites

Hmm, Everytime i boot up KSP i have to configure the contracts again. Is that normal? It doesnt seem to remember filter settings inbetween play sessions.

There was a bug with how it sets those on startup, should be fixed for the next release.

Link to comment
Share on other sites

Stupid noob question.

Looking over the docs (it's been a month or three since I've done serious syntax work) I've got a question about the best way to script "flying" contracts.

What I'm trying to do are make some atmospheric aviation related contracts, and it seemed like the best way to do that is to create a contract to go perform some objective (science at X biome, reach speed X, whatever) with some argument in the parameter like "maxAltitude = 35000" or something, to force the use of an aircraft rather than a suborbital ballistic flight.

Am I on the right track, or is there a better way to approach this?

Link to comment
Share on other sites

Stupid noob question.

Looking over the docs (it's been a month or three since I've done serious syntax work) I've got a question about the best way to script "flying" contracts.

What I'm trying to do are make some atmospheric aviation related contracts, and it seemed like the best way to do that is to create a contract to go perform some objective (science at X biome, reach speed X, whatever) with some argument in the parameter like "maxAltitude = 35000" or something, to force the use of an aircraft rather than a suborbital ballistic flight.

Am I on the right track, or is there a better way to approach this?

Sounds like you're on the right track. You can also do a ReachState with state = FLYING, which is a bit more generic. But be advised there's a few ways for players to cheese that - an EVA Kerbal standing on his craft is considered flying, for example. But if you have other constraints based on altitude or speed then those exploits usually go away naturally.

Link to comment
Share on other sites

There was a bug with how it sets those on startup, should be fixed for the next release.

Would this work for say station science contracts? I have to keep turning those off everytime I play along with Nehemiah's contracts. I tried the latest in dev version and that didn't seem to do it.

Link to comment
Share on other sites

Would this work for say station science contracts? I have to keep turning those off everytime I play along with Nehemiah's contracts. I tried the latest in dev version and that didn't seem to do it.

Can you try the dev version again (I hadn't checked in the .dll right away, so you may have grabbed an older one). If it's still not working, please describe how it's not working and I'll look into it (is it showing the contracts as disabled in the settings menu, but still offering them, or is it just not keeping the "disabled" state in the settings menu).

Link to comment
Share on other sites

Can you try the dev version again (I hadn't checked in the .dll right away, so you may have grabbed an older one). If it's still not working, please describe how it's not working and I'll look into it (is it showing the contracts as disabled in the settings menu, but still offering them, or is it just not keeping the "disabled" state in the settings menu).

Will do! Will be back ASAP.

Link to comment
Share on other sites

Alright upon loading in with the latest dev version the station science contracts are enabled in the setting menu. Meaning it is not persisting the disabled state. Let me know if you want more info or anything else. Thanks!

Link to comment
Share on other sites

Alright upon loading in with the latest dev version the station science contracts are enabled in the setting menu. Meaning it is not persisting the disabled state. Let me know if you want more info or anything else. Thanks!

Should hopefully be enough for me to reproduce. I'll let you know if I hit trouble.

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