How to allow actions to happen once per game "day", and then reset the next day

Hey all. So I have a structure where the game lasts seven days. I have many actions in mind that if the player does them once, there’s a positive result, but if they do it too many times in one day, there are negative consequences. If they wait until the next day to continue, they get the positive result again.

Here’s how I’ve got my days set up at the moment:

A weekday is a kind of value. The weekdays are Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, You Did It. The current weekday is a weekday that varies. The current weekday is Saturday.

When play begins: 
	the calendar tumbles at 12:00 am. 
	At the time when the calendar tumbles: 
		say "It's a new day!"; 
		now the current weekday is the weekday after the current weekday;
		we need to enqueue the timed event in 30 minutes from now. 
	At the time when we need to enqueue the timed event: 
		the calendar tumbles at 12:00 am.

And here’s an example of the type of action I’m talking about:

Instead of switching on the TV when the player has the remote control for the first time:
	now the TV is switched on;
	say "You lose yourself for a blissful hour of pure entertainment, and turn off the TV again to mull it all over.";
	increase the mood of the player by 20;
	now the TV is switched off;
	increase the time of day by 60 minutes.

Instead of switching on the TV  when the player has the remote control for the second time:
	say "You find something tolerable and watch that for a while, then turn the TV off.";
	increase the mood of the player by 10;
	increase the time of day by 60 minutes.

Instead of switching on the TV when the player has the remote control for the third time:
	say "Your eyes are starting to go square.";
	increase the time of day by 60 minutes.
	
Instead of switching on the TV when the player has the remote control for the fourth time:
	say "You're beginning to question your life goals.";
	decrease the mood of the player by 5;
	increase the time of day by 60 minutes.
	
Instead of switching on the TV when the player has the remote control more than four times:
	say "Is this what you wanted to be when you grew up?";
	decrease the mood of the player by 20;
	increase the time of day by 60 minutes.

I’m not sure how to ALSO check “if this is the first time today”, or otherwise tell it to treat the TV-watching like it’s the first time once midnight passes.

Thanks for any help!

2 Likes

I think I would try something with tables and custom phrases. For example:

"Times per Day"

Place is a room.

Weekday is a kind of value. The weekdays are Sunday, Monday, Tuesday, Wednesday, Thursday, Friday and Saturday.

Today is initially Monday.

A device called a TV is in Place.

Table of Exhaustible Actions
event (stored action)	last day done (weekday)	times done (number)
switching on the TV	Monday	0

To record (SA - stored action) being done (W - weekday):
    choose the row with event of SA in the Table of Exhaustible Actions;
    if last day done entry is not W:
	    now last day done entry is W;
	    now times done entry is 1;
    otherwise:
	    increment the times done entry.

To decide which number is the number of times (SA - stored action) has been done (W - weekday):
    choose the row with event of SA in the Table of Exhaustible Actions;
    if last day done entry is not W:
	    decide on zero;
    otherwise:
	    decide on times done entry.

After doing something:
    repeat through the Table of Exhaustible Actions:
	    if the current action is event entry:
		    record the current action being done today;
		    say "times done = [times done entry]";
    continue the action. 

Instead of switching on the tv when the number of times switching on the TV has been done today is at least 2:
    say "TV has become too boring for now."

After jumping:
    now today is the weekday after today;
    say "You hop the rest of the day away."

Test me with "switch on tv / switch it off / switch it on / switch it off / switch it on / jump / switch it on".

Performance may not be great with a lot of events being tracked. And your use of Instead rules will interfere with the action processing so that the After doing something rule will never fire, so you would have to change that. (See WWI 12.2 How actions are processed for more detail.)

Thanks, I’ll give that a whirl! Useful about the Instead rules, too - I would have gotten stuck on THAT issue for quite a while… still figuring a lot of this stuff out…