From 3b750b024c40b04ea2f164e7c9ed7b6bccdad45b Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Mon, 25 Sep 2017 21:52:32 +0100 Subject: [PATCH 1/8] #107 Fix getOptionalBool() Was erroneously returning false rather than null when the requested value is not present in the dictionary. --- JournalMonitor/JournalMonitor.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/JournalMonitor/JournalMonitor.cs b/JournalMonitor/JournalMonitor.cs index 1ff5e9a429..aa283537cb 100644 --- a/JournalMonitor/JournalMonitor.cs +++ b/JournalMonitor/JournalMonitor.cs @@ -2739,13 +2739,14 @@ private static bool getBool(string key, object val) private static bool? getOptionalBool(IDictionary data, string key) { object val; - data.TryGetValue(key, out val); - return getOptionalBool(key, val); - } - - private static bool? getOptionalBool(string key, object val) - { - return (bool?)val; + if (data.TryGetValue(key, out val)) + { + return val as bool?; + } + else + { + return null; + } } private static string getString(IDictionary data, string key) From 19b254d1b9f95cc1184f0ecac903773da311f1b3 Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Mon, 25 Sep 2017 22:24:25 +0100 Subject: [PATCH 2/8] #107 Amend Body Report: `landable` can be null This can occur when you scan a planet without a DSS. Since it is proving hard in Cottle to distinguish between an null `landable` property and a `false` one, we now only say anything if the body is landable. --- SpeechResponder/eddi.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SpeechResponder/eddi.json b/SpeechResponder/eddi.json index b0f62a0831..5b7530f6c3 100644 --- a/SpeechResponder/eddi.json +++ b/SpeechResponder/eddi.json @@ -33,8 +33,8 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n\r\n|elif state.eddi_context_nav_scans && state.eddi_context_nav_scans > 0:\r\n {_ Do nothing if this scan is part of a nav beacon scan _}\r\n\r\n|else:\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n that is\r\n\r\n {if reportbody.landable:\r\n suitable\r\n |else:\r\n unsuitable\r\n }\r\n for landing.\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}", - "default": true, + "script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n\r\n|elif state.eddi_context_nav_scans && state.eddi_context_nav_scans > 0:\r\n {_ Do nothing if this scan is part of a nav beacon scan _}\r\n\r\n|else:\r\n\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n {if reportbody.landable:\r\n that is suitable for landing\r\n }\r\n . {_ note the full stop}\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}", + "default": false, "name": "Body report", "description": "Function to report on the details of the contextual body" }, From 68107bb6aa8ce488184c9acade118d7dceef94ed Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Tue, 26 Sep 2017 13:26:45 +0100 Subject: [PATCH 3/8] Document the changes for #107 --- EDDI/ChangeLog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EDDI/ChangeLog.md b/EDDI/ChangeLog.md index 704725a030..d7dcd4106c 100644 --- a/EDDI/ChangeLog.md +++ b/EDDI/ChangeLog.md @@ -5,8 +5,10 @@ * Revised EDDI's methods for detecting in-game betas * Events * Fixed a bug that would cause the 'Ship transfer initiated' event to be silent + * Fixed a bug whereby scanning a landable body without a DSS would default the "landable" value to "false" rather than "null" * Speech Responder * 'Ship transfer initiated' event - revised to include both the transfer cost and the time to arrival + * Updated the 'Body Report' script to account for the possibility of the "landable" property being void ### 2.4.0-b3 * Core From cbfb6c3852f9642a946655b1951eba0beb15cf65 Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Tue, 26 Sep 2017 19:39:43 +0100 Subject: [PATCH 4/8] #107 test whether the type of reportbody.landable is void --- SpeechResponder/eddi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpeechResponder/eddi.json b/SpeechResponder/eddi.json index 5b7530f6c3..878b3a4fbb 100644 --- a/SpeechResponder/eddi.json +++ b/SpeechResponder/eddi.json @@ -33,7 +33,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n\r\n|elif state.eddi_context_nav_scans && state.eddi_context_nav_scans > 0:\r\n {_ Do nothing if this scan is part of a nav beacon scan _}\r\n\r\n|else:\r\n\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n {if reportbody.landable:\r\n that is suitable for landing\r\n }\r\n . {_ note the full stop}\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}", + "script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n\r\n|elif state.eddi_context_nav_scans && state.eddi_context_nav_scans > 0:\r\n {_ Do nothing if this scan is part of a nav beacon scan _}\r\n\r\n|else:\r\n\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n {if type(reportbody.landable) != \"void\": \r\n that is\r\n {if reportbody.landable:\r\n suitable\r\n |else:\r\n unsuitable\r\n }\r\n for landing\r\n }\r\n . {_ note the full stop}\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}", "default": false, "name": "Body report", "description": "Function to report on the details of the contextual body" From b84b6439f41b0f0ad7d531af325f2d8a07d488a7 Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Tue, 26 Sep 2017 23:19:02 +0100 Subject: [PATCH 5/8] #107 remove spurious nav scans tests --- SpeechResponder/eddi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpeechResponder/eddi.json b/SpeechResponder/eddi.json index 878b3a4fbb..439420908e 100644 --- a/SpeechResponder/eddi.json +++ b/SpeechResponder/eddi.json @@ -33,7 +33,7 @@ "enabled": true, "priority": 3, "responder": false, - "script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n\r\n|elif state.eddi_context_nav_scans && state.eddi_context_nav_scans > 0:\r\n {_ Do nothing if this scan is part of a nav beacon scan _}\r\n\r\n|else:\r\n\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n {if type(reportbody.landable) != \"void\": \r\n that is\r\n {if reportbody.landable:\r\n suitable\r\n |else:\r\n unsuitable\r\n }\r\n for landing\r\n }\r\n . {_ note the full stop}\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}", + "script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n|else:\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n {if type(reportbody.landable) != \"void\": \r\n that is\r\n {if reportbody.landable:\r\n suitable\r\n |else:\r\n unsuitable\r\n }\r\n for landing\r\n }\r\n . {_ note the full stop}\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}", "default": false, "name": "Body report", "description": "Function to report on the details of the contextual body" From 1a7810c2ae36d2e8d3f690b54577ded731211c2e Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Tue, 26 Sep 2017 23:19:42 +0100 Subject: [PATCH 6/8] re-enable data voucher event not sure how that got turned off --- SpeechResponder/eddi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpeechResponder/eddi.json b/SpeechResponder/eddi.json index 439420908e..f860c3749f 100644 --- a/SpeechResponder/eddi.json +++ b/SpeechResponder/eddi.json @@ -376,7 +376,7 @@ "priority": 3, "responder": false, "script": "{_ Data voucher awarded }\r\n{_ Triggered when you are awarded a data voucher }\r\n\r\n\r\n{_ Context }\r\n{SetState('eddi_context_last_subject', 'data_voucher')}\r\n{SetState('eddi_context_last_action', 'award')}\r\n{SetState('eddi_context_bond_amount', event.reward)}\r\n{SetState('eddi_context_bond_faction', event.payeefaction)}\r\n\r\nData voucher awarded from {event.payeefaction} for {event.reward} credits.\r\n", - "default": false, + "default": true, "name": "Data voucher awarded", "description": "Triggered when you are awarded a data voucher" }, From 0ccb5c1395f1c5b019ae96d30d374b162586be7a Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Wed, 27 Sep 2017 01:52:00 +0100 Subject: [PATCH 7/8] #107 amend default to true for Body report --- SpeechResponder/eddi.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpeechResponder/eddi.json b/SpeechResponder/eddi.json index f860c3749f..7f807a96a4 100644 --- a/SpeechResponder/eddi.json +++ b/SpeechResponder/eddi.json @@ -34,7 +34,7 @@ "priority": 3, "responder": false, "script": "{_ Fetch from context }\r\n{set reportbody to BodyDetails(state.eddi_context_body_name, state.eddi_context_body_system)}\r\n{if !reportbody.name || reportbody.name = \"\": {set reportbody to BodyDetails(state.eddi_context_body_name)} }\r\n\r\n{if !reportbody.name || reportbody.name = \"\":\r\n I'm not sure which body you are asking about.\r\n|else:\r\n {P(reportbody.name)} is a\r\n {if reportbody.gravity < 0.5:\r\n low-gravity\r\n |elif reportbody.gravity <2:\r\n medium-gravity\r\n |elif reportbody.gravity <4:\r\n high-gravity\r\n |else:\r\n extremely high-gravity\r\n }\r\n\r\n {if reportbody.tidallylocked:\r\n tidally-locked\r\n }\r\n\r\n {if reportbody.terraformstate = \"Terraformable\":\r\n terraformable\r\n |elif reportbody.terraformstate = \"Terraformed\":\r\n terraformed\r\n }\r\n\r\n {if len(reportbody.rings) > 0:\r\n ringed\r\n }\r\n\r\n {reportbody.planettype}\r\n\r\n {if reportbody.terraformstate = \"Terraforming\":\r\n in the process of being terraformed\r\n }\r\n\r\n {if type(reportbody.landable) != \"void\": \r\n that is\r\n {if reportbody.landable:\r\n suitable\r\n |else:\r\n unsuitable\r\n }\r\n for landing\r\n }\r\n . {_ note the full stop}\r\n\r\n {_ Atmosphere? }\r\n\r\n {if reportbody.volcanism:\r\n This planet shows signs of volcanism, with\r\n {if reportbody.volcanism.type = 'Geysers':\r\n {if reportbody.volcanism.amount = 'Major':\r\n high numbers of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low numbers of\r\n }\r\n active {reportbody.volcanism.composition} geysers\r\n |else:\r\n {if reportbody.volcanism.amount = 'Major':\r\n high levels of\r\n |elif reportbody.volcanism.amount = 'Minor':\r\n low levels of\r\n }\r\n active {reportbody.volcanism.composition} magma flows\r\n }.\r\n }\r\n\r\n {if reportbody.landable :\r\n It has a\r\n {if reportbody.rotationalperiod < -20.0:\r\n slow retrograde\r\n |elif reportbody.rotationalperiod < -0.5:\r\n retrograde\r\n |elif reportbody.rotationalperiod < 0:\r\n fast retrograde\r\n |elif reportbody.rotationalperiod <= 0.5:\r\n fast\r\n |elif reportbody.rotationalperiod > 20.0:\r\n slow\r\n }\r\n rotational period of {Humanise(reportbody.rotationalperiod)}\r\n day{if Humanise(reportbody.rotationalperiod) != \"1\":s}.\r\n\r\n {set goodmaterials to []}\r\n {set greatmaterials to []}\r\n {for material in reportbody.materials:\r\n {if material.percentage >= MaterialDetails(material.material).greatpctbody:\r\n {set greatmaterials to cat(greatmaterials, [material])}\r\n |elif material.percentage >= MaterialDetails(material.material).goodpctbody:\r\n {set goodmaterials to cat(goodmaterials, [material])}\r\n }\r\n }\r\n\r\n {if len(greatmaterials) > 0:\r\n This body contains very high levels of\r\n {if len(greatmaterials) = 1:\r\n {greatmaterials[0].material}\r\n |elif len(greatmaterials) = 2:\r\n {greatmaterials[0].material} and {greatmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(greatmaterials):\r\n {if cur = 0:\r\n {greatmaterials[cur].material}\r\n |elif cur < len(greatmaterials) - 1:\r\n , {greatmaterials[cur].material}\r\n |else:\r\n , and {greatmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(goodmaterials) > 0:\r\n {if len(greatmaterials) > 0:\r\n and high levels of\r\n |else:\r\n This body contains high levels of\r\n }\r\n {if len(goodmaterials) = 1:\r\n {goodmaterials[0].material}\r\n |elif len(goodmaterials) = 2:\r\n {goodmaterials[0].material} and {goodmaterials[1].material}\r\n |else:\r\n {set cur to 0}\r\n {while cur < len(goodmaterials):\r\n {if cur = 0:\r\n {goodmaterials[cur].material}\r\n |elif cur < len(goodmaterials) - 1:\r\n , {goodmaterials[cur].material}\r\n |else:\r\n , and {goodmaterials[cur].material}\r\n }\r\n {set cur to cur + 1}\r\n }\r\n }\r\n }\r\n {if len(greatmaterials) > 0 || len(goodmaterials) > 0:\r\n .\r\n }\r\n }\r\n}", - "default": false, + "default": true, "name": "Body report", "description": "Function to report on the details of the contextual body" }, From f94abc726b8f3cbc8fbd407493513224fe4cdfad Mon Sep 17 00:00:00 2001 From: Richard Buckle Date: Wed, 27 Sep 2017 20:39:20 +0100 Subject: [PATCH 8/8] Improved the change log for #107 --- EDDI/ChangeLog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EDDI/ChangeLog.md b/EDDI/ChangeLog.md index d7dcd4106c..3bb994fded 100644 --- a/EDDI/ChangeLog.md +++ b/EDDI/ChangeLog.md @@ -5,10 +5,10 @@ * Revised EDDI's methods for detecting in-game betas * Events * Fixed a bug that would cause the 'Ship transfer initiated' event to be silent - * Fixed a bug whereby scanning a landable body without a DSS would default the "landable" value to "false" rather than "null" * Speech Responder * 'Ship transfer initiated' event - revised to include both the transfer cost and the time to arrival - * Updated the 'Body Report' script to account for the possibility of the "landable" property being void + * Script changes + * If you scan without a DSS, the 'Body Report' script no longer falsely claims that all bodies are unsuitable for landing. ### 2.4.0-b3 * Core