Newbie trying to implement a system he can't solve himself

So here’s the scene. The player starts in a bedroom. They can get out of bed and examine it. When they examine it, they’ll notice the fitted sheet has been untucked. I want to put a system which allows the player to tuck in the sheet, and thus change the description of the bed.

Any and all help is appreciated.

1 Like

Here’s one way you could do it:

Bedroom is a room.

A bed is a supporter in Bedroom.
The bed can be untucked or tucked. The bed is untucked. Understand "fitted" and "sheet" as the bed.
The description of the bed is "An ordinary bed[if untucked], but it looks like the fitted sheet is untucked[end if]."

The player is on the bed.

Tucking is an action applying to one touchable thing.
Understand "tuck [something]" and "tuck in [something]" and "tuck [something] in" as tucking.

Check tucking:
	if the noun is not the bed, say "[The noun] [aren't] something you can tuck." instead.

Check tucking the bed:
	if the bed is tucked, say "The fitted sheet is already tucked in." instead.

Carry out tucking the bed:
	now the bed is tucked.
Report tucking the bed:
	say "You tuck in the fitted sheet."

If you think you might want to tuck other things in the same story, you can make the Check tucking rule a little more general:

Check tucking (this is the block tucking rule):
	say "[The noun] [aren't] something [we] [can] tuck." instead.

Then for anything you do want to be able to tuck (declared near the object to be tucked):

The block tucking rule does nothing when the noun is the bed.

This lets you more easily add more objects that can be tucked later on, without constantly having to adjust that rule directly. (There are other ways to do this as well, to make it even more general.)


You can also write response messages following your normal story tense and viewpoint. Gavin is demonstrating the advanced thing writing substitutions with tokens that adjust the tense and viewpoint based on what the story is set to - unless you’re changing tense and viewpoint in your story (or creating an extension for general use), you can also just write a custom message.

Check tucking (this is the block tucking rule):
	say "[The noun] isn't something you can tuck." instead.
1 Like