ink icon indicating copy to clipboard operation
ink copied to clipboard

Actual time and date as Ink variables?

Open Chrisrose1967 opened this issue 5 years ago • 1 comments

I'm looking for a (relatively) simple way to get the actual (e.g. wall clock) time and date into Ink variables--is there any way to do this, short of calling C# functions?

I'm imagining a story that, for instance, would get scarier the closer to midnight it is read or played.

Chrisrose1967 avatar Aug 09 '20 22:08 Chrisrose1967

I've done a time based game where my alter time function wrapped hours every time it hit 24 and added 1 to my days variable. That's probably the simplest way to do it in ink. Below for the basics, you can, of course, add more detailed time tracking.

=== function advancetime(hours) { hours > 0.0: ~ alter(Hour, 1.0) ~ alter(hours, -1.0) {Hour == 24.0: ~alter(Day, 1.0) ~Hour = 0.0 } ~advancetime(hours) }

Which relies on this (Useful) function borrowed from the documentation.

=== function alter(ref x, k) === ~ x = x + k

libdudeak avatar Mar 08 '21 20:03 libdudeak