Howdy, Stranger!

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

Need help with timed pregnancy

Hey all,
VERY new to programming. I'm using Twine 2 with Sugarcube 2

I was able to get a running clock with the advice in:
https://twinery.org/forum/discussion/3195/clocks-still-driving-me-nuts

Is there a way to put in:
<<if $gameDate gte Date(2017, 5, 30, 6, 0, 0)>>
You're in labor!
Go to hospital
<</if>>

So that it will go off of the clock of the game for timed events?

Thanks in advance!

Comments

  • First of all you should give us the full version number of the versions of both Twine 2 and SugarCube 2 you are using.

    Also, can you maybe provide us with the code you have in place for the clock right now. Post code by clicking the little C above the comment box or pressing ctrl+O.
  • I think you can simply use javascripts subtraction for dates (which results in amount of ms difference). so for example
    <<if $gameDate-Date(2017, 5, 30, 6, 0, 0) gte 0>>
    
    assuming thate $gameDate contains a valid Date object
  • I'm using Twine 2.1.3 and Sugarcube 2.18.0




    In passages at top:
    <<if $gameDate gte Date(2017, 5, 30, 6, 0, 0)>>
    You're in labor!
    Go to hospital
    <</if>>


    In StoryInit
    StoryInit
    <<set $now to new Date(2017, 5, 29, 6, 0, 0)>>
    <<set $pregnant to true>>
    Home
Sign In or Register to comment.