Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Time() is not defined in Sugarcube

Hi all!

I'm trying to store the time it takes for each user to go through a passage and thought about using the time() function in Sugarcube.
I declared a variable and I'm setting it like this afterwards:
<<set $a1 = time()>>
but I get the message that 'time' is not defined.
I also tried using Date.now() inside a <<script>> tag but no luck there either :( Any clues?

Comments

  • Try combining your two different attempts together.
    <<set $now to Date.now()>>
    
  • If the time() story function is undefined, then you are not using SugarCube 2. If you're using SugarCube at all, you're using version 1, which does not include that function.

    If you installed SugarCube 2, you likely forgot to choose it as your project's story format—or selected v1 by mistake.
  • edited June 2016
    Aaah yes, it is v1 >_< and @greyelf 's answer did the trick :smile:
Sign In or Register to comment.