0 votes
by (120 points)
A noob here, but I hope not for long, I tried to make a time system and add this to my game, precisely with the day counter, so far had worked well. Yes I use the sugarcube, latest version.


<<set setup.PERIODS to ["Asleep", "Early morning", "Morning", "Noon", "Afternoon", "Evening", "Early night", "Night", "Late night"]>>

<<set setup.DAYS to ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]>>

I set the work schedule to "Morning" and the normal days from Monday to Friday.

<<if $dayPeriod is "Morning" and $day <= 4>>
    &bull; [[Go to work|Work]]
    <<elseif $day >= 5>>
        Not work today!    

A simple structure for this, I'd rather not try to reinvent the wheel.... For some reason the periods of the day are identified correctly and independently but the days are not. The only option that always appears is "Not work today!" I think it is probable that I am letting something pass...

1 Answer

0 votes
by (44.7k points)
edited by

Probably the best thing to do is to make sure that those variables are what you think they are.  I'd also restructure it a bit like this:

dayPeriod = $dayPeriod
day = $day
<<if $dayPeriod == "Morning">>
	<<if $day <= 4>>
		&bull; [[Go to work|Work]]
		No work today!

Try that, and make sure that $dayPeriod and $day are giving you the values that you'd expect.  Once you've tracked down the bug, then you can get rid of those first two lines.

Hope that helps!  :-)

P.S. When asking questions here in the future, be sure to put your compiler (e.g. "twine2"), story format (e.g. "sugarcube2"), and other relevant topic names (see the "Most popular tags" list to the right) in the tags here.