I’m trying to make it so when play begins the player gets random personality traits. Should I use a table or is their an easier way to do this?
Depends on what specifically you’re trying to achieve. If you just want a random personality description, for example, the following example illustrates a very simple way to do that:
[code]Personality is a kind of value. The personalities are sanguine, choleric, melancholy, and phlegmatic. A person has a personality.
When play begins: now the personality of the player is a random personality.
The description of the player is “You’re feeling very [the personality of the player] today.”
The White Room is a room.
The player is in the White Room.[/code]
That depends upon how you want those traits to work, how many of them there are, and how often you want to refer to them. (My instinct would be to make traits into individual objects and give active traits a relation with the player, but that may be overkill for your purposes.) But of the various ways of doing this, none are particularly complicated or laborious. If you can see a straightforward way of doing it with tables, I would try doing it that way first.
The benefit of tables is in the source; they’re easy to read, and easy to edit in the future, and being able to break a table across multiple sections using (continued) is especially useful.
The benefit of relations is they allow powerful, compact code to be written (EG now every visible dog owned by Bob hates the player), and they are somewhat easier to change during run-time. It really comes down to how exactly you want to use the traits.
Really beginner question.
I have only recently begun figuring out tables and would like to Know how to get the game to pick a random entry in a specific row. I know this is pretty basic but for some reason I can’t seem to find it properly in the documentation.
That actually isn’t basic or beginner at all, so don’t feel bad! There isn’t a provision for doing this, I don’t think, because the different entries in different rows are usually totally different types. You could have one column containing text, one containing things, one containing a number, etc. So picking a random one of those usually wouldn’t be something you wanted to do.
Can you post the thing that you would like to do and we can see if there’s another way to do this?
You may have to rotate your table 90 degrees. Inform can easily select a particular column and a random row, but not the other way round.
I don’t know exactly what you’re trying to do, but perhaps lists are more appropriate than tables, in this case. Or maybe a table with one column containing lists.
Ok good news I got my table working bad news its not doing what it’s supposed to. I want the player to have a certain haircolour preference. And a person to have a haircolour. I’ve got this working using values, here’s a snippet
Haircolour is a kind of value. The haircolours are blonde, brunette, Auburn, black, maroon, ginger, silver, and purple.
Now I need the player to like a person I think a number value that increases or decreases will work. I originally tried to make a table that if the hairpreference and the npc’s haircolour lined up it would go up. A bunch of problems were created. So does anyone know how I could do this? Preferably with a table cause I want to get used to it.
PS: I hope you don’t mind me asking here but when is the Annual IFcomp held normally.
This doesn’t seem to be something a table would help that much with. You can do something like this:
A person has a haircolour. The player has a haircolour called haircolour preference. Definition: A person (called model) is nice-haired if the haircolour of the model is the haircolour preference of the player.
And then, depending on how you’re calculating the number value for liking, you could give people a bonus for being nice-haired.
(The website opens May 10th, sign up is any time before the 1st of September. 1st October the games become publicly available for play and vote. Comp ends some 6 weeks later.)