Xjph / ObservatoryCore

Elite Observatory: Extensible tool for processing Elite Dangerous journals
https://observatory.xjph.net/
MIT License
78 stars 13 forks source link

Help Needed - Custom criteria #34

Closed sleepfishl closed 2 years ago

sleepfishl commented 2 years ago

Hi,

i need a little help (or an Example)for custom criterea. The function "Landable with Atmosphere" is great, but I want to use own, custom criteria which gives out the type of the atmosphere.

For example "Landable with Oxygen Atmosphere".

Xjph commented 2 years ago

Coincidentally someone else asked for something very similar on the Frontier forums recently.

There is an example criteria in the documentation that already does something very close to this, near the end of the complex criteria section. As written it checks for landable with CO₂ + nitrogen atmosphere, but could be pretty easily modified to look for other types.

Orvidius also provided an example of a threshold check on the forums in response the the question there: https://forums.frontier.co.uk/threads/elite-observatory-search-your-journal-for-potentially-interesting-objects-or-notify-you-of-new-ones-on-the-fly-while-exploring.521544/page-58#post-9594193 Note that in Orvidius example the ::End:: tag is malformed and you'll have to correct it (just add the missing :) before the criteria will work.

Finally, while I don't mind helping here, you'll most likely get more prompt responses to questions either in the forums thread or on the Observatory Discord. I'm the only person likely to ever see or response to issues here, and I often do things like sleep and work. The forums and discord are a better bet for getting help from the community at large.

Discord: https://discord.gg/y2evtaas Forum thread: https://forums.frontier.co.uk/threads/elite-observatory-search-your-journal-for-potentially-interesting-objects-or-notify-you-of-new-ones-on-the-fly-while-exploring.521544/

sleepfishl commented 2 years ago

Thank you. I just joined the discord and go learn the Lua stuff. =)

khenness commented 1 year ago

Sorry to necro an old thread but for posterity I wrote some lua code that does this:


::Criteria::
if scan.Landable and scan.Atmosphere ~= nil and scan.Atmosphere ~= '' then
    composition_string = ""
    for mat in materials(scan.AtmosphereComposition) do
       composition_string = composition_string .. mat.name .. " " ..tonumber(string.format("%.1f", mat.percent)) .. " percent "
  end

    return true, 'Landable with ' .. scan.AtmosphereType .. " atmosphere. " .. composition_string, scan.Atmosphere
end
::End::

It shows up like so: image