Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Time Since option for choices (Similar to TURNS_SINCE) #473

Open
Inkynoob739 opened this issue Apr 17, 2023 · 1 comment

Comments

@Inkynoob739
Copy link

Hello!

I would like to request a feature that might be cool to add. There should be a way to make specific choices appear after a certain amount of time, along with other uses. Like, if a player waits for 2 minutes without picking a choice, another appears and they can pick that. I think it would be similar to TURNS_SINCE, but like TIME_SINCE.

For example...

===first_knot===
 * [normal choice] -> knot
 * [also normal choice] -> knot 
  * {TIME_SINCE(-> first_knot) = 00:02:00} [secret choice] -> knot

(The 00:02:00 would mean 2 minutes)

I think it would be cool to see. Thanks.

@Inkynoob739 Inkynoob739 changed the title [Feature request] Time Since (Similar to TURNS_SINCE) [Feature request] Time Since option for choices (Similar to TURNS_SINCE) Apr 17, 2023
@robinsloan
Copy link

Just chiming in here as a fellow Ink user:

The Ink interpreter doesn't have any concept of "clock time", and it also doesn't directly control the display of text, so I don't think this feature is a good fit at the language level.

However, it would be easy (and cool!) to implement this on the display side of an application. For example, if you were rendering your choices in HTML+CSS, you could apply a CSS animation that kept the text hidden for the specified amount of time. If it was me, I would implement this using Ink tags, something like:

===first_knot===
 * [normal choice] -> knot
 * [also normal choice] -> knot 
 * [secret choice #wait=120] -> knot

Then, in (for example) JavaScript, I'd do something like this:

story.currentChoices.forEach( choice => {
  let choiceElement = document.createElement("p");
  choiceElement.innerHTML = choice.text;
  choice.tags?.forEach( tag => {
    if (tag.includes("wait") {
      choiceElement.className = "wait";
      // this class would be defined in the page's CSS, and would have an appropriate CSS animation
    }
  }

  // here you would append choiceElement to the correct place in the document, etc.
}

I hope that's at least mildly helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants