Here you go!
Code:{_ Fetch from context } {set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)} {if !reportbody.name || reportbody.name = "": I'm not sure which body you are asking about. |else: {P(reportbody.name)} is a {if reportbody.gravity < 0.5: low-gravity |elif reportbody.gravity <2: medium-gravity |elif reportbody.gravity <4: high-gravity |else: extremely high-gravity } {if reportbody.tidallylocked: tidally-locked } {if reportbody.terraformstate = "Terraformable": terra-formable |elif reportbody.terraformstate = "Terraformed": terra-formed } {if len(reportbody.rings) > 0: ringed } {reportbody.planettype} {if reportbody.terraformstate = "Terraforming": in the process of being terra-formed } that is {if reportbody.landable: suitable |else: unsuitable } for landing. {_ Atmosphere? } {if reportbody.volcanism: This planet shows signs of volcanism, with {if reportbody.volcanism.type = 'Geysers': {if reportbody.volcanism.amount = 'Major': high numbers of |elif reportbody.volcanism.amount = 'Minor': low numbers of } active {reportbody.volcanism.composition} guy-sers |else: {if reportbody.volcanism.amount = 'Major': high levels of |elif reportbody.volcanism.amount = 'Minor': low levels of } active {reportbody.volcanism.composition} magma flows }. } {if reportbody.landable : It has a {if reportbody.rotationalperiod < -20.0: slow retrograde |elif reportbody.rotationalperiod < -0.5: retrograde |elif reportbody.rotationalperiod < 0: fast retrograde |elif reportbody.rotationalperiod <= 0.5: fast |elif reportbody.rotationalperiod > 20.0: slow } rotational period of {Humanise(reportbody.rotationalperiod)} day{if Humanise(reportbody.rotationalperiod) != "1":s}. {set goodmaterials to []} {set greatmaterials to []} {for material in reportbody.materials: {if material.percentage >= MaterialDetails(material.material).greatpctbody: {set greatmaterials to cat(greatmaterials, [material])} |elif material.percentage >= MaterialDetails(material.material).goodpctbody: {set goodmaterials to cat(goodmaterials, [material])} } } {if len(greatmaterials) > 0: This body contains very high levels of {if len(greatmaterials) = 1: {greatmaterials[0].material} at {round(greatmaterials[0].percentage, 1)} percent |elif len(greatmaterials) = 2: {greatmaterials[0].material} at {round(greatmaterials[0].percentage, 1)} percent, and {greatmaterials[1].material} at {round(greatmaterials[1].percentage, 1)} percent |else: {set cur to 0} {while cur < len(greatmaterials): {if cur = 0: {greatmaterials[cur].material} at {round(greatmaterials[cur].percentage, 1)} percent |elif cur < len(greatmaterials) - 1: , {greatmaterials[cur].material} at {round(greatmaterials[cur].percentage, 1)} percent |else: , and {greatmaterials[cur].material} at {round(greatmaterials[cur].percentage, 1)} percent } {set cur to cur + 1} } } } {if len(goodmaterials) > 0: {if len(greatmaterials) > 0: and high levels of |else: This body contains high levels of } {if len(goodmaterials) = 1: {goodmaterials[0].material} at {round(goodmaterials[0].percentage, 1)} percent |elif len(goodmaterials) = 2: {goodmaterials[0].material} at {round(goodmaterials[0].percentage, 1)} percent, and {goodmaterials[1].material} at {round(goodmaterials[1].percentage, 1)} percent |else: {set cur to 0} {while cur < len(goodmaterials): {if cur = 0: {goodmaterials[cur].material} at {round(goodmaterials[cur].percentage, 1)} percent |elif cur < len(goodmaterials) - 1: , {goodmaterials[cur].material} at {round(goodmaterials[cur].percentage, 1)} percent |else: , and {goodmaterials[cur].material} at {round(goodmaterials[cur].percentage, 1)} percent } {set cur to cur + 1} } } } {if len(greatmaterials) > 0 || len(goodmaterials) > 0: . } } }
You can 'grep' this version of 'Body report' against the default to see what I did.
Thank you for this example. I've been using versions of this script, but what I'm looking for is something that reads off all the materials and percentages reguardless of if they are good percentages or not. I've had mixed results using the good materials script. Sometimes it works and other times it doesn't.