0 votes
by (130 points)
I'm sure this is a very basic question, but: I'm making an in-game clock system, and I want the story to change whether $timeofday is either "AM" or "PM" depending on the value of $hour. I can get "if" to change text depending on $hour, but I can't make it change $timeofday, which I'd like to use to set up different scenes depending on the time of day. How do I do this simple interaction?

I guess to add an additional bit of info, my beginner brain always thinks I'll be able to do:
(if: $hour < 12)(set: $timeofday to AM)

But of course that doesn't work.

1 Answer

+3 votes
by (159k points)

There are a number of issues with your example:

1. The (if:) macro is missing it's associated hook.

If you look at the first (if:) macro example you will see that the macro call is associated with a hook, and the code that is executed when the related Conditional Expression evaluates to true is placed within that hook.

2. The String value you are assigning to the $timeofday story variable is missing it's start & end quotes.

3. It doesn't handle the case where $hour is greater-than or equal-to 12.

Your example should look something like the following.

(if: $hour < 12)[
	(set: $timeofday to "AM")
	(set: $timeofday to "PM")


by (130 points)
That cleared things right up. Thank you so much!