Random Generation & Calenders

I’m going to be creating a game that requires randomly generated object/character, except I don’t know how. And how would I assign conversation tables (if possible without much work) to these randomly generated characters?

Also, how do I work a daily calender? I know how to do the parts involving a table of months and their days, but how do I have Inform reset the day and move forward the day? Like February 1st instead of January 32nd?

Depends on what you mean by randomly generated - do you mean you have some amount of ready made objects/characters and the game chooses one of them at random? Or is there one person that has random characteristics, like hair color, different clothes etc? Or do you want to create stuff on the fly (for example a sock drawer where the player can pick up as many socks as they want)? Are you using some extension for the conversation?

If you have the months and their days in a table, you could check if the day part is greater than that month’s amout of days in the table. If it is, change it to 1 and increment the month. It’s hard to give code examples without knowing how you’ve handled the dates in general, so if you could post that part of the code it would be easier to give more precise instructions.

No extension. Unless you have one to suggest. I’m only asking about the I just want to create objects/characters with random names and characteristics or values. Although I could work around random names.

Another problem came up though. I’m treating congress as a container not placed in a room:

Obviously I’m trying to have multiple conservatives. Like multiple matches.

Ok. The reason I was asking was because you specifically mentioned conversation tables which led me to believe you had already chosen a discussion system.

Here’s how to do random characteristics:

[code]Hair tint is a kind of value. Hair tints are black, brown, white, and red.

The shopkeeper is a man. The shopkeeper can be happy or disgruntled. The shopkeeper has a hair tint called hair color. The description is “His hair is [hair color]. He looks [if happy]happy[otherwise]disgruntled[end if].”

When play begins:
change the hair color of the shopkeeper to a random hair tint;
if a random chance of 1 in 2 succeeds:
now the shopkeeper is happy;
now the shopkeeper is disgruntled.
[and so on][/code]
Random names are a bit more trickier, because you probably want the player to be able to refer to the character by their name (see chapter 16.15. in the manual).

[code]Table of shopkeeper names

The shopkeeper has some indexed text called first name. Understand the first name property as describing the shopkeeper.
The printed name of the shopkeeper is “[first name]”.

When play begins:
choose a random row from the table of shopkeeper names;
change the first name of the shopkeeper to the name entry.[/code]
This should have no effect on whatever conversation model you’re using.

“Day” seems to be a reserved word. It’s easier to just use a number: “The current day is a number that varies.”

Sleeping is already defined in the standard library, so you can’t define it again. It’s best to use the one that’s there and modify its behavior.

[code]The current day is a number that varies. The current day is 20.

Table 1.0 - Table of Months
Month Day
January 31
February 28
March 31
April 30
May 31
June 30
July 31
August 31
September 30
October 31
November 30
December 31

Instead of sleeping:
say “Yawn.”;
change the time of day to morning;
advance the day.

To advance the day:
change the current weekday to the weekday after the current weekday;
if current day is greater than the day corresponding to the month of current month in the table 1.0:
change the current month to the month after the current month;
change the current day to 1.

Morning is a time that varies. Morning is 7:00 AM.[/code]

Could you treat it as a room that’s not connected to any other room, if that solves the problem?

Thanks for the help. Wouldn’t have thought of that naming system myself. Now people can’t be certain which butler did it.

How do I modify the behavior of sleep, and have it only apply to a type of object called a hay?

I am just starting with Inform, but I think I might know the answer to your sleeping problem. I am sure this code still needs a lot of work, and it assumes you mean that you want the day to be advanced if the player sleeps when he is on the hay, but this should be functional. Instead of sleeping: if player is on the hay: say "Yawn."; change the time of day to morning; advance the day; otherwise if the hay is in the location: try entering the hay; say "Yawn."; change the time of day to morning; advance the day; otherwise: continue the action. Make sure that the hay is enterable and either a supporter or a container. The above example was written with the hay being a supporter, so if you want it to be a container you will need to change the “on” in the second line to an “in”.