Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Body report summary - add options to adjust temperature scale? #2235

Closed
Ekristoffe opened this issue Aug 10, 2021 · 5 comments
Closed

Body report summary - add options to adjust temperature scale? #2235

Ekristoffe opened this issue Aug 10, 2021 · 5 comments
Labels
cottle Relates to a Cottle script rather than C# code.

Comments

@Ekristoffe
Copy link

What happens now

I the Speech responder, the "Body report summary" doesn't have the option to convert the temperature reported in Celsius or Fahrenheit like the "Body atmosphere report"

What I'd like to happen

Having the option could be interesting for people not familiar with Kelvin.

How it can happen

I have updated my script to add this possibility and I would like to share it but I can't fin where it is in the source code (or even how to share profiles) ...

EDDI Version

v4.0.0

@Darkcyde13
Copy link

Darkcyde13 commented Aug 11, 2021

I'm sure it used to a long time ago, but I think it was removed for some reason. I've put it back in my version.

In mine, I have this in the preferences at the top:

{set reportTempScale to 1}         {_ Set to 0 for temperatures in Kelvin _}
                                   {_ Set to 1 for temperatures in Celsius _}
                                   {_ Set to 2 for temperatures in Fahrenheit _}

and then this further down. I put this after the radius section, and before the gravity section:

    {if reportTemperature && reportbody.tempprobability:

        {_ Convert to desired temperature scale _}
        {if reportTempScale = 0:
            {set surfTemp to reportbody.temperature}
            {set tempscale to " Kelvin "}
        |elif reportTempScale = 1:
            {set surfTemp to reportbody.temperature - 273.15}
            {set tempscale to " degrees Celsius "}
        |elif reportTempScale = 2:
            {set surfTemp to (reportbody.temperature - 273.15) * 9 / 5 + 32}
            {set tempscale to " degrees Fahrenheit "}
        }

        {set temp to cat(" surface temperature of ", Humanise(surfTemp), tempscale)}
        {if reportbody.tempprobability < 0.1:
            {set notables to cat(notables, [cat("an incredibly low", temp)])}
        |elif reportbody.tempprobability < 1:
            {set notables to cat(notables, [cat("an extremely low", temp)])}
        |elif reportbody.tempprobability < 3:
            {set notables to cat(notables, [cat("an unusually low", temp)])}
        |elif reportbody.tempprobability > 99.9:
            {set notables to cat(notables, [cat("an extremely high", temp)])}
        |elif reportbody.tempprobability > 99:
            {set notables to cat(notables, [cat("an incredibly high", temp)])}
        |elif reportbody.tempprobability > 97:
            {set notables to cat(notables, [cat("an unusually high", temp)])}
        }
    }

@Tkael Tkael added the cottle Relates to a Cottle script rather than C# code. label Aug 12, 2021
@Tkael
Copy link
Member

Tkael commented Aug 12, 2021

I think that there may have been some internal discussion around preferring the temperature scale which is

  1. chosen by the game developers and
  2. the accepted standard in the scientific community

Using the Kelvin scale arguably lends additional authenticity / adds to immersion but I do also get that many people may be less comfortable with the Kelvin scale than with Celsius or Fahrenheit. :-D

It's currently rather difficult to review changes to scripts in the format where the default values are saved. Posting code snippets like @Darkcyde13 did above is preferable while we're discussing script changes.

@Ekristoffe
Copy link
Author

Ok I will post the code I currently use when I have fully tested it (still need some test on negative temperatures)

@Tkael Tkael changed the title Body report summary improvement Body report summary - add options to adjust temperature scale? Oct 12, 2021
@CMDR-Evolution
Copy link

CMDR-Evolution commented Oct 15, 2021

I think that there may have been some internal discussion around preferring the temperature scale which is

  1. chosen by the game developers and
  2. the accepted standard in the scientific community

Using the Kelvin scale arguably lends additional authenticity / adds to immersion but I do also get that many people may be less comfortable with the Kelvin scale than with Celsius or Fahrenheit. :-D

It's currently rather difficult to review changes to scripts in the format where the default values are saved. Posting code snippets like @Darkcyde13 did above is preferable while we're discussing script changes.

Hello all,

I have a solution that works for the scientific standard and for what everyone's familiar with. I coincidentally reworked the report body script for the same purpose as this thread (which you can find in my personality here) but both solutions are quite different although they do a similar thing.

The easy solution I've done in 'Body report summary' is to have kelvin (as standard in EDDI now) with an optional comparable temperature of Celsius / Fahrenheit. To do that, an extra line was added under reportTemperature:
{set reportComparableTemp to 1} {_ Reports comparable temperatures to Kelvin - Set to 0 for off, 1 for Celsius or 2 for Fahrenheit _}

These two lines go inside the temperature section:

		{if reportComparableTemp = 1: {set temp to cat(temp2, ", ",OneOf("comparable to","the equivalent of")," ",Humanise(round(reportbody.temperature - 273))," degrees Celsius")}
		|elif reportComparableTemp = 2: {set temp to cat(temp2, ", ",OneOf("comparable to","the equivalent of")," ",Humanise(round((reportbody.temperature - 273.15) * 9 / 5 + 32))," degrees Fahrenheit")}}

Then finally and simply to make it work, you'll just need to add this after "Kelvin" at the end of each temperature line:
, temp

Hopefully you feel that ticks all the boxes. Please let me know if sharing the code block section would be easier than the code above and personality link I shared. o7

@CMDR-Evolution
Copy link

Ok I will post the code I currently use when I have fully tested it (still need some test on negative temperatures)

Hello OP Ekristoffe. Sorry, I can't tag you for some reason. If you've done something like I originally tried for 'body report' by duplicating what's already there and adding 2 onto the functions, then that won't properly work for all conditions excluding Gas Giants. However in that script, if you split out Gas Giants and non Gas Giants, apply my code from Body Report Summary above^^, then negative numbers aren't an issue anymore. See the personality link to try out both scripts if you'd like. Hope that helps o7

@Tkael Tkael closed this as completed in 60a0269 Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cottle Relates to a Cottle script rather than C# code.
Projects
None yet
Development

No branches or pull requests

4 participants