Simple Time and Day System

Twine Version: Sugarcube 2.0
[also choose a Story Format tag above]

So started the creation of my game and then realized that I need to make a day and time system and also show it on the side-bar. Something simple for time like - “morning” “afternoon” “evening” with 7 days week system. Also, need the days to cycle and time to reset to specified time when the character sleeps.

Thanks in advance.

Hello :slight_smile:
You might want to look into Chapel’s Cycle Macro.

tried using it, but all I get is that the macros don’t exist. Are there any other way?

That shouldn’t be happening. Have you pasted the code here into your Story Javascript section? That’s where the macros are defined.

tried that too. any other alternate method please. I’m new to twine so alot of the stuff goes over my head.

  1. Are you sure you pasted it in the correct section? You can find it under the “Story → JavaScript” menu.
  2. Are you using the macros correctly? Try pasting this into a passage:
<<newcycle 'time' 4>>
    <<phase 'morning' 'midday' 'evening' 'night'>>

None of the main Story Formats have a built-in Day and/or Time system, but they do allow an Author to use variables to implement their own. You can also gain access to this type of functionally by using a third-party addon.

Generally when you add an existing third-party addon library, like the Cycles System found in Chapel’s Custom Macro Collection, you will need to install JavaScript within the Story > JavaScript area of your project. And some third-party addons will also require you to install CSS within the Story > Stylesheet area of your project.

If you visit the Cycles System related page I linked to earlier you will see a THE CODE section early in the page’s contents, this section includes two links to different variations of the JavaScript source code needed to add system’s macros to your project. I suggest you click on the Minified and then use the target page’s “Copy raw contents” button (two squares, one above the other) to copy the JavaScript code so that you can then paste it into your Story JavaScript area.

If you do this correctly then the system’s macros can now be used in your project.