EDCD / EDDI

Companion application for Elite Dangerous
Other
450 stars 82 forks source link

Body Atmosphere Report problems #1049

Closed Darkcyde13 closed 5 years ago

Darkcyde13 commented 5 years ago

EDDI version in which issue found

EDDI v3.3.2

As mentioned in my reply to the Body Volcanism issue #1045 , here are a couple of things I've noted with the Body Atmosphere Report script (from my own change log):-

Darkcyde13 commented 5 years ago

I've just found that the event data doesn't have anything for event.atmospherecompositions. So you can't get a breakdown of the atmosphere components just using event data.

Tkael commented 5 years ago

Darkcyde's script (reproduced here for reference):

{_ Preferences _}
{set reportAtmoPressure to 1}   {_ Set to 1 to report atmospheric pressure. _}
{set reportAtmoTempScale to 0}  {_ Set to 0 to report temperatures in Kelvin _}
                                {_ Set to 1 to report temperatures in Celsius _}
                                {_ Set to 2 to report temperatures in Fahrenheit _}
                                {_ Set to 3 if you don't want to hear about the temperature of the body _}
{set reportAtmoComp to 1}       {_ Set to 0 to report only the main atmospheric element. _}
                                {_ Set to 1 to report full atmospheric composition. _}

{_ Fetch from context }
{if event:
    {set reportbody to BodyDetails(event.name, system.name)}
}
{if !reportbody.name || reportbody.name = "": 
    {set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}
}
{if !reportbody.name || reportbody.name = "": 
    {set reportbody to BodyDetails(state.eddi_context_body_name)}
}

{if !reportbody.name || reportbody.name = "":
    {_ If it's still not possible to get the body name...  _}
    I'm
    {OneOf("not sure","unsure")}
    {Occasionally(2,"of")}
    which body
    {OneOf("you are","you're")}
    {OneOf("asking about","referring to")}.

|else:
    {_ Define functions for converting temperature scales _}
    {set ToCelsius(kelvin) to: {round(kelvin - 273)}}
    {set ToFahrenheit(kelvin) to: {round((kelvin-273)*9/5 + 32)}}
    {set TempCalc(kelvin) to: 
        {if reportAtmoTempScale = 0: {round(kelvin)}}
        {if reportAtmoTempScale = 1: {ToCelsius(kelvin)}}
        {if reportAtmoTempScale = 2: {ToFahrenheit(kelvin)}}
    }

    {_ Name our temperature scale _}
    {if reportAtmoTempScale = 0: {set tempscale to: Kelvin}}
    {if reportAtmoTempScale = 1: {set tempscale to: degrees Celsius}}
    {if reportAtmoTempScale = 2: {set tempscale to: degrees Fahrenheit}}

    {if !body:
        {F("Body Name Tidy")}
        For {body},
    }

    {if find(reportbody.planettype, "giant") > -1:
        {if find(reportbody.planettype, "Class") > -1: 
            {set sudarsky to Occasionally(3, "Sud-dar-ski")}
        }
        {set planetdesc to OneOf("{sudarsky} Gas giants like this one have", "This {sudarsky} gas giant has")}
        {if find(reportbody.planettype, "Class V") > -1:
            {planetdesc} 
            {if reportAtmoTempScale < 3: 
                {set tempmin to: {TempCalc(1373)}}
                temperatures above {Humanise(tempmin)} {tempscale}, {OneOf("and", "with", "forming")}
            }
            a dense cloud layer of {OneOf("vaporized silicates and iron", "silicate and iron vapors")}.
        |elif find(reportbody.planettype, "Class IV") > -1:
            {planetdesc} 
            {if reportAtmoTempScale < 3: 
                {set tempmin to: {TempCalc(354)}}
                {set tempmax to: {TempCalc(903)}}
                temperatures {OneOf("of", "ranging")} between {Humanise(tempmin)} and
                {Humanise(tempmax)} {tempscale}, {OneOf("and", "with", "forming")}
            }
            a dense cloud layer of {OneOf("alkali metals vapors", "vaporized alkali metals")}.   
        |elif find(reportbody.planettype, "Class III") > -1:
            {planetdesc} 
            {if reportAtmoTempScale < 3: 
                {set tempmin to: {TempCalc(251)}}
                {set tempmax to: {TempCalc(353)}}
                surface temperatures {OneOf("of", "ranging")} between {Humanise(tempmin)} and
                {Humanise(tempmax)} {tempscale},
            }
            a temperature at which
            {OneOf("no gaseous elements will form any clouds",
                   "suitable chemicals are not present in the atmosphere to form a sustained cloud layer",
                   "the atmosphere cannot sustain a persistent cloud layer")}.
        |elif find(reportbody.planettype, "Class II") > -1:
            {planetdesc} 
            {if reportAtmoTempScale < 3: 
                {set tempmin to: {TempCalc(154)}}
                {set tempmax to: {TempCalc(250)}}
                surface temperatures {OneOf("of", "ranging")} between {Humanise(tempmin)} and
                {Humanise(tempmax)} {tempscale}, {OneOf("and", "with", "forming")}
            }
            a dense cloud layer of water vapors.  
        |elif find(reportbody.planettype, "Class I") > -1:
            {planetdesc} 
            {if reportAtmoTempScale < 3: 
                {set tempmin to: {TempCalc(153)}}
                {set tempmax to: {TempCalc(83)}}
                surface temperatures of {Humanise(tempmax)} {tempscale}
                {Occasionally(2, OneOf(", or less,", ", at most,"))} {OneOf("and", "with", "forming")}
            }
            a dense cloud layer of ammonia vapor.  
        }

    |elif reportbody.atmosphere = "No atmosphere" || !reportbody.atmosphere:
        {Occasionally(4, OneOf("There is no atmosphere.",
                               "It is devoid of any atmosphere.",
                               "The years have scoured it clean of any atmosphere."))}
        {if reportbody.temperature && reportAtmoTempScale < 3:
            The surface temperature averages
            {TempCalc(reportbody.temperature)} {tempscale}.
        }

    |elif reportbody.pressure: 
        {if reportbody.pressure < 0.1:
            {set pressdesc to OneOf("trace gas", "super thin")}
        |elif reportbody.pressure < 0.25:
            {set pressdesc to "very thin"}
        |elif reportbody.pressure < 0.5:
            {set pressdesc to "thin"}
        |elif reportbody.pressure < 2:
            {set pressdesc to ""}
        |elif reportbody.pressure < 10:
            {set pressdesc to "thick"}
        |elif reportbody.pressure < 50:
            {set pressdesc to OneOf("dense", "very thick")}
        |elif reportbody.pressure < 100:
            {set pressdesc to OneOf("very dense", "super thick")}
        |elif reportbody.pressure >= 100:
            {set pressdesc to OneOf("crushing", "super dense")}
        }

        {if find(reportbody.atmosphere, "-rich") > -1:
            {set element to token(reportbody.atmosphere, "-rich", "")}
            {set desc to OneOf("It is a", "There is a", "Sensors detect a")}
            {OneOf("{desc} {pressdesc} {reportbody.atmospherecompositions[0].name} atmosphere",
                   "The {pressdesc} atmosphere is {reportbody.atmospherecompositions[0].name}")}
            {if reportbody.atmospherecompositions[0].name != element:
                , {OneOf("that is","and")}
                {OneOf("rich in {element}", "{element}-rich")}
            }
        |elif find(reportbody.atmosphere, "vapour") > -1:
            The {pressdesc} atmosphere 
            {OneOf("is composed of {reportbody.atmosphere}s",
                   "is rich in {reportbody.atmosphere}s",
                   "contains high levels of {reportbody.atmosphere}s")}
        |else:
            {if len(reportbody.atmospherecompositions) > 1:
                {set mostly to OneOf("primarily", "mainly", "mostly")}
                {OneOf("The {pressdesc} atmosphere is composed {mostly} of",
                       "Most prevalent in the {pressdesc} atmosphere is")}
            |else:
                The {pressdesc} atmosphere is
                {Occasionsally(2,"composed of")}

            }
            {reportbody.atmospherecompositions[0].name}
        }

        {_ Atmospheric Composition _}
        {if reportAtmoComp = 1 && len(reportbody.atmospherecompositions) > 1:

            {set atmocomp to []}
            {set cur to 1}

            {while cur < len(reportbody.atmospherecompositions):
                {if (reportbody.atmospherecompositions[cur].name != element):
                    {set atmocomp to cat(atmocomp, [reportbody.atmospherecompositions[cur].name])}
                }
                {set cur to cur + 1}
            }

            {if len(atmocomp) = 1:
                , with {OneOf("some","an additional element of")}
                {atmocomp[0]}
                {Occasionally(2,"also present")}
            |elif len(atmocomp) > 1:
                , with {OneOf("some","additional elements of")}
                {set cur to 0}
                {set length to len(atmocomp) - 1}
                {while cur < len(atmocomp):
                    {P(atmocomp[cur])}
                    {set cur to cur + 1}
                    {if cur = length: and
                    |elif cur < length:,
                    }
                }
                {Occasionally(2,"also present")}
            }
        }.

        {if reportAtmoPressure = 1:
            {if reportAtmoComp = 1 && len(reportbody.atmospherecompositions) > 0:
                {OneOf("It has", "There is", "Sensors detect")}
            |else:
                , with
            }
            a surface pressure of {Humanise(reportbody.pressure)}
            Earth atmosphere{if Humanise(reportbody.pressure) != "1":s}
        }

        {if reportbody.temperature && reportAtmoTempScale < 3:
            {set temp to: {TempCalc(reportbody.temperature)}}
            {if reportAtmoPressure = 1: and |else: with }
            an average surface temperature of {temp} {tempscale}
        }.
    }
}
hoksilato2 commented 5 years ago

omg... now I see this script xD awesome work.