EDCD / EDDI

Companion application for Elite Dangerous
Other
445 stars 81 forks source link

Scanned and mapped Date/Time properties of bodies error? #2468

Closed Darkcyde13 closed 1 year ago

Darkcyde13 commented 1 year ago

What's Wrong (please be as specific as possible)

Expected

The .scanned and .mapped properties of bodies to give a timestamp of when they were scanned or mapped, or be void if not yet done.

Observed

Both properties appear to be an array (map) and always seem to report the current number of seconds since 01-01-70.

Steps to reproduce

  1. Set up body to BodyDetails() for one you have scanned and/or mapped.
  2. Test out the properties body.scanned and body.mapped.
  3. Using SecondsSince(body.scanned) results in the number of seconds since 01-01-1970.
  4. Using format(body.scanned, "d:MM-dd-yy") always results in 01-01-70.

Configuration

My Investigation

Investigation Notes

I wanted to find out when I had scanned or mapped a body, but I just keep getting 01-01-70 as a result by using the above method. It seems like they are not being populated or converted correctly maybe?

I tried type(body.scanned) and it resulted in "map", but I can't see why these would be a map. Using List(body.scanned) gave some very odd results:

, and 5249292803817387904, and 637606785390000000, and 4611686018427387904, and, and 30, and, and 181, and 19, and, and 0, and 35, and 6, and 39, and 637606785390000000, and, and 2021 1672709779 01-01-70

Doing len(body.scanned) gave 16, and using body.scanned[16] (or and number between 0 and 16) resulted in 1672709779 01-01-70.

If I tried to use dump() on them it crashes EDDI.

Are these broken, or am I doing something wrong?

EDDI Logs

N/A

Player journals

N/A

Tkael commented 1 year ago

These are stored as a DateTime object rather than as a unix timstamp so SecondsSince() will not work. Essentially, they are intended to be accessed like a boolean value (either null or true).

That said, the fields from the object are still accessible from the Speech responder as follows:

{set Day to reportBody.scanned.Day}
{set Month to reportBody.scanned.Month}
{set Year to reportBody.scanned.Year}
You scanned {reportBody.name} on {Month}-{Day}-{Year}.
Darkcyde13 commented 1 year ago

Oh, OK, I see. My plan was to check to see if the body was scanned (or mapped) more than a few seconds ago, for use just after a scan. I wanted to check if the 'Surface signals detected' script triggers immediately after a scan, or if it gets triggered when you approach the body after having scanned it some time in the past.

I see there are also elements for Hour, Minute, and Second, so maybe I can use these to create a kind of timestamp that I can compare to find out how long ago a body was scanned.

Thank you, this gives me something I can work on now. 🙂

As a side note, would it be possible to expand the variables help page to better describe these two properties? At the moment it just says it's a 'DateTime' with no explanation on how it's formatted. Also, would it not be better to change it to a UNIX timestamp, as that's how other date/time properties are recorded? Or would that be too much of a problem with existing data from past scans?

Tkael commented 1 year ago

I'll have to think about this but I agree that moving to a UNIX timestamp may be preferable.

Darkcyde13 commented 1 year ago

Cool, thank you.

Well, I have come up with a solution to my problem now, so there's no hurry for this one. 😄