Jump to content

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


nightingale

Recommended Posts

3 minutes ago, VoidSquid said:

Hey @nightingale,

Since a couple of days I have an quite interesting issue between CC and the new ScanSat (20.4 atm), though this also happened with the two or three previous CC versions.

What happens is, when I accept a new contract (seems independent of the contract pack), fly the rocket, switch to map view, and active a ScanSat overlay (terrain, or biome, makes no difference), the terrain info under the mouse pointer flickers alternating with the initial contract duration time (e.g. recover a satellite after 60 days, the ScanSat terrain info alternates with a small box displaying 60:00:00) several times a second. Finishing the contract, all all is back to normal.

Console doesn't give any output about this, and before I bother you with any logs: any at least faint idea what's going, or have you heard / seen this ever before?

I have never heard of anything like this.  Those things sound like they should not be related in any way.  Can you post some screenshots (or a video) and I'll take a closer look?

Link to comment
Share on other sites

Will do when I'm back at home.

What is so totally weird about this: when I remove CC and the contract point and load the save game again, the issue is totally gone, including the flickering of all orbit lines for about 10s when switching to map view. Ofc, this kills the persistent.sfs, when reenabling CC plus packs, all progress ever is gone.

Funny fact: it doesn't matter if switch to another craft (and another CB) but the one from the contract, same result.

I went back 2 or 3 CC versions, one ScanSat version, no difference.

And as per my superficial view across, nothing useful in the logs too.

Edited by VoidSquid
Link to comment
Share on other sites

Recording and contract: https://easyupload.io/m/3899om

Btw, the time displayed during the flickering is the remaining time for the contract, not the total required time.

I admit, it seems to be a very odd issue - you're sure you want to invest your time here, @nightingale ?

Already feel a bit silly bothering you with this, let me know, please :) 

Edited by VoidSquid
Link to comment
Share on other sites

@VoidSquid - I have a vague sense of what's going on here.  The Contracts appis a bit silly and doesn't have the ability to support dynamic text.  Contract Configurator fakes this the same way it does everything else - through hacking internals.  In this case it walks through the UI elements associated to the contracts app, and then updates it when it finds it based on what has changed.  I don't really know how it could get crossed up though, as Contract Configurator looks for children of the Contracts App.  I'll have a look later tonight to see if I can reproduce, unless @DMagic knows off the top of their head what could possibly be causing this.

Link to comment
Share on other sites

Hey @nightingale, I found some more time for testing, interesting result: when I replace CC with the older 1.29.0 version, the bug is gone! As soon as I use any 1.30.x version, the bug appears.

Hope this helps to narrow down finding what's going on here.

Question: will it be save to continue using 1.29.0 for the time being, or will it ruin my career save game due to incompatibilities?

Edited by VoidSquid
Link to comment
Share on other sites

9 hours ago, VoidSquid said:

Hey @nightingale, I found some more time for testing, interesting result: when I replace CC with the older 1.29.0 version, the bug is gone! As soon as I use any 1.30.x version, the bug appears.

Hope this helps to narrow down finding what's going on here.

Question: will it be save to continue using 1.29.0 for the time being, or will it ruin my career save game due to incompatibilities?

Pretty questionable to continue on 1.29.0, I don't know what will happen.  Looking at the diffs now to see if something jumps out.  Problem is that localization happened between those two versions...  so there's a lot to diff.  I'm going to try to repro first, so if you're around, @VoidSquid and can post your save file it may help make that go a little quicker.

EDIT: No need for the save, I managed to reproduce.

EDIT: I think this is a SCANsat bug.  I haven't identified it completely, but I have enough for @DMagic to take a look.  What's happening is that SCANsat builds its tooltip based off a cached StringBuilder using a SCANSat specific caching framework.  The place that reads the tooltip releases the StringBuilder, which is questionable, but may or may not be the cause.

So what *seems* to be happening is that Contract Configurator and SCANsat are using the same cached StringBuilder (as part of some performance enhancements, I started using a StringBuilder using the stock caching framework in 1.30.0, which is why rolling back past that "fixes" the issue).

Now, I don't 100% know how/why this could be, since SCANsat does it's own caching and I use the stock StringBuilderCache.  I did see a spot where SCANsat uses the stock one, and found a questionable method that could allow injecting the stock one into the SCANsat framework (but I didn't see a call to it, so not sure if that's correct or not).

So there it is - I don't completely know what/where the issue is, but I'm fairly certain the fix needs to happen in SCANsat.  DMagic hasn't been on the forums for a couple weeks - so if we don't get a response from him then I'd suggest linking this thread from a SCANsat GitHub issue.

Edited by nightingale
Link to comment
Share on other sites

1 hour ago, nightingale said:

I managed to reproduce

So it's not just my imagination or my specific mod setup, glad to hear :)

1 hour ago, nightingale said:

DMagic hasn't been on the forums for a couple weeks - so if we don't get a response from him then I'd suggest linking this thread from a SCANsat GitHub issue.

Will do, thank you again for your time analyzing this odd bug so far.

1 hour ago, nightingale said:

Pretty questionable to continue on 1.29.0

 

1 hour ago, nightingale said:

Problem is that localization happened between those two versions

Well, I'm playing the English version of KSP, no need for any localization for me. 1.29. is safe then, what do you think?

Edited by VoidSquid
Link to comment
Share on other sites

3 hours ago, VoidSquid said:

So it's not just my imagination or my specific mod setup, glad to hear :)

Will do, thank you again for your time analyzing this odd bug so far.

 

Well, I'm playing the English version of KSP, no need for any localization for me. 1.29. is safe then, what do you think?

It's not the localization that is the problem, there's a bunch of bug fixes and stuff like that. So I'm guessing you're more likely to hit a bug that's worse than the flickering tooltip if you roll back.  More importantly, I won't provide support if you go from 1.30.x => 1.29, so read the changlogs carefully and decide for yourself whether it's worth the risk.

Link to comment
Share on other sites

Understood, then I'll stay with the current CC version, not worth taking the risk for this little annoyance. Hopefully @DMagic will soon find some time looking into this issue.

EDIT: Just opened an issue at Github https://github.com/S-C-A-N/SCANsat/issues/391 , I hope I put in the right words.

Edited by VoidSquid
Link to comment
Share on other sites

So, i've been having a habit of using the Exploration Plus contract pack instead of the stock progression stuff for the past while. However, since i've started a new game in 1.9.1 to go with the new Kopernicus version, the CC option to disable the stock Exploration contracts no longer seems to work, and i get those served up to me alongside the Exploration Plus ones. I'm not really sure whether theres something else i should be doing to get rid of the stock contracts, or if this is simply some sort of CC/contract pack issue.

Link to comment
Share on other sites

9 hours ago, ussdefiant said:

So, i've been having a habit of using the Exploration Plus contract pack instead of the stock progression stuff for the past while. However, since i've started a new game in 1.9.1 to go with the new Kopernicus version, the CC option to disable the stock Exploration contracts no longer seems to work, and i get those served up to me alongside the Exploration Plus ones. I'm not really sure whether theres something else i should be doing to get rid of the stock contracts, or if this is simply some sort of CC/contract pack issue.

It works fine for me on 1.10.1.  Can you provide a screenshot of the contract you are getting that you think shouldn't be getting?

Link to comment
Share on other sites

1 hour ago, ussdefiant said:

unknown.png

I'm getting that Explore Mun contract from the World Record Society. Keeps respawning when it expires, too.

And you can confirm that Exploration Contract is disabled in the difficulty menu?  If so, please provide a KSP.log and I'll look from there.

Link to comment
Share on other sites

Is there a way, within the expression language, to use just the Kerbal's first name?  E.g. to replicate things like we see in the stock rescue contracts, where it's "Fred's shipwreck" and not "Fred Kerman's shipwreck" ?  I mean when the kerbal is generated, so the text would be "@/lostkerbal's derelict"  Something like "@/lostkerbal.name()'s derelict".  Is that a thing?

 

Also, is there an escaping sequence - like if I'm writing a sentence, the "." seems to sometimes get confused for language syntax, e.g. in "... from @/lostbody."  The period is intended to be plain text, but in some cases it seems that the configurator thinks it's part of an expression.

Link to comment
Share on other sites

23 minutes ago, NermNermNerm said:

Is there a way, within the expression language, to use just the Kerbal's first name?  E.g. to replicate things like we see in the stock rescue contracts, where it's "Fred's shipwreck" and not "Fred Kerman's shipwreck" ?  I mean when the kerbal is generated, so the text would be "@/lostkerbal's derelict"  Something like "@/lostkerbal.name()'s derelict".  Is that a thing?

There's a couple ways.  First is to break the string and use a + to concatenate them:

    DATA
    {
        type = string

        cat = I am a cat
        catString = @cat + " and a bat"
    }

Second is to use the new Format method:

    DATA
    {
        type = string

        formatString = Eat <<1>> and <<2>>.
        formattedString = Format(@formatString, ["oats", "goats"])
    }

Results:

DmhTLim.png

The second is what you'd want to use if you ever want to support localization (and probably just better overall in terms of performance and garbage generation).

23 minutes ago, NermNermNerm said:

Also, is there an escaping sequence - like if I'm writing a sentence, the "." seems to sometimes get confused for language syntax, e.g. in "... from @/lostbody."  The period is intended to be plain text, but in some cases it seems that the configurator thinks it's part of an expression.

Looks like no - I only ever added escaping for ".

Link to comment
Share on other sites

2 hours ago, nightingale said:

There's a couple ways.  First is to break the string and use a + to concatenate them:

How do you break a string?  I mean if @/kerbal is of type Kerbal, how do you get the *first* name?  That is, I want "Jebediah", not "Jebediah Kerman".

Link to comment
Share on other sites

5 hours ago, NermNermNerm said:

How do you break a string?  I mean if @/kerbal is of type Kerbal, how do you get the *first* name?  That is, I want "Jebediah", not "Jebediah Kerman".

Whoops, sorry.  I got caught up with the second question and didn't realize that I never answered the first one.  You can use the FirstWord() method on any string (from https://github.com/jrossignol/ContractConfigurator/wiki/String-Type):

Quote
string FirstWord() Returns the first word in a space-seperated list (ie. pull Jebediah out of Jebediah Kerman).

 

Link to comment
Share on other sites

13 hours ago, nightingale said:

You can use the FirstWord() method on any string

Well yeah, but what if @/kerbal is not a string, but rather of type Kerbal?  There's some shenanigans I could pull, e.g. Format("{0}", @kerbal).FirstWord(), but maybe there's a first-class way to get the name of the kerbal?  @kerbal.name doesn't seem to be a thing...

 

Link to comment
Share on other sites

10 hours ago, NermNermNerm said:

Well yeah, but what if @/kerbal is not a string, but rather of type Kerbal?  There's some shenanigans I could pull, e.g. Format("{0}", @kerbal).FirstWord(), but maybe there's a first-class way to get the name of the kerbal?  @kerbal.name doesn't seem to be a thing...

 

There isn't a Name or FirstName method on Kerbal.  Would be pretty easy to add, but I think @kerbal.ToString().FirstWord() should work (didn't test though).

Edited by nightingale
Link to comment
Share on other sites

On 9/28/2020 at 11:55 AM, nightingale said:

And you can confirm that Exploration Contract is disabled in the difficulty menu?  If so, please provide a KSP.log and I'll look from there.

Yeppers, here it is.

The "[ERR 13:05:02.226] [ContractSystem]: Contract type 'ExplorationContract' not found" is something that quite caught my eye.

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

 

Link to comment
Share on other sites

On 9/30/2020 at 1:15 PM, ussdefiant said:

The "[ERR 13:05:02.226] [ContractSystem]: Contract type 'ExplorationContract' not found" is something that quite caught my eye.

That message actually means it's working (sort of).  The Exploration contracts are special to stock, so it makes extra sure those get generated.  I needed to add a little bit more logic to fully disable those.  Should be good in the next release now.

Link to comment
Share on other sites

Hey @nightingale,

I don't know if this of interest for you, but @severedsolo's Clever Sats contract pack still works fine KSP 1.10.1 with these two little changes:

A MM patch made by  @4x4cheesecake:

Spoiler

//Add revamped probe core to the cleversat contract pack
//Add Kopernicus solarpanel if available
@CONTRACT_TYPE[CleverSatCore]:FINAL
{
    !REQUIREMENT[Probe] {}
    
    REQUIREMENT
    {
        name = Any
        type = Any
        
        REQUIREMENT
        {
            name = Probe
            type = PartUnlocked
            part = probeCoreSphere
        }
        
        REQUIREMENT
        {
            name = Probe_v2
            type = PartUnlocked
            part = probeCoreSphere_v2
        }
    }
    
    @REQUIREMENT[Any]:HAS[@REQUIREMENT[PartModuleUnlocked]]:NEEDS[Kopernicus]
    {
        REQUIREMENT
        {
            name = PartModuleUnlocked
            type = PartModuleUnlocked
            partModule = KopernicusSolarPanel
        }
    }
}
 

plus correcting line 19 from CleverSatRandomShift.cfg (a closing bracket too much).

 

EDIT 10.03.2021: @4x4cheesecake found, that for Korpernicus version 1.8+, the line

partModule = KopernicusSolarPanel

needs to be changed to

partModule = KopernicusSolarPanels

 

Edited by VoidSquid
Link to comment
Share on other sites

I've been learning about Lingoona script, but am having some trouble applying it to ContractConfigurator because there seems no way to get a kerbal name with the right gender marker on it (e.g. "Valentina Kerman^f").  If I'm reading the source code right, there's no native way to do it.  For kerbals, I think I see how I could make it happen with some fancy expression stuff using the Gender() method, but that seems hacky and wrong.  For celestial bodies (which have a language-specific gender as well), I don't think I see a way.

If I'm right and it really is missing, I would be happy to submit a PR, as I think I see how it should be done.  (I'd probably take care of that first-name thing at the same time).

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