Skip to content

IntStories/twine-sugarcube2-realtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•’ Twine SugarCube 2 – Live Clock

A lightweight, real-time date and time widget for Twine games using the SugarCube 2 story format.
Displays a live, updating clock directly within your passage or globally via StoryCaption.

✨ Features

  • Live updating every second
  • AM/PM format with full date
  • Easy to integrate in any Twine passage
  • Optional fixed display in the UI (using StoryCaption)

πŸ“¦ Installation

  1. Copy the code from live-clock-sugarcube.html.
  2. Paste it directly into a passage in your Twine project.
  3. (Optional) Paste it in the StoryCaption to make it appear on all pages.
<span id="live-time"></span><script>var u=()=>{const d=new Date(),h=((d.getHours()%12)||12),m=d.getMinutes().toString().padStart(2,"0"),s=d.getSeconds().toString().padStart(2,"0"),ampm=d.getHours()<12?"AM":"PM",date=d.toDateString();document.getElementById("live-time").textContent=`${date} β€’ ${h}:${m}:${s} ${ampm}`};u();setInterval(u,1000);</script>

About

Displays a live, updating in-game clock showing the current date and time with hours, minutes, seconds, and AM/PM, refreshing every second.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages