Character Creator

I’m new to Inform 7, and interactive fiction in general. I’ve decided to start working on a project based in a fantasy world that my friends and I came up with to play rpgs in. I’d like have a character creator that would allow them to customize certain characteristics of their characters like name, gender, attack, defense, mana, starting weapons, etc.
I’ve also run into a problem that is probably pretty easy to fix, I just haven’t figured out how, yet. Is there any way I can hide the contents of a container in the room description?

If you want an open container that doesn’t reveal its contents until you examine it, I’d say the best way probably is not to put anything in it until it is examined for the first time and also to suppress the note about its being ‘empty’ until then:

[code]The Dungeon of Doom is a room.

The carved skull is a container in the Dungeon.
A jewel of infinite value is a thing.

Rule for printing room description details of the carved skull when we have not examined the skull: do nothing.

First carry out examining the skull for the first time: now the jewel is in the skull.
[/code]

As for the character creator based on input from the player, I seem to remember that those things takes some coding work to do.

One easy tool for a character creator would be the Questions or the Simple Chat extension. Both allow you to ask numbered questions.

If you just don’t want the container contents to be part of the main room description, you can make it scenery:

The Kitchen is a room. "This is a room with a crate nearby."

The crate is an open scenery container in the Kitchen.

The rock is in the crate.

Alas, this will not work as expected if the player, for some reason, tries to search (or “look in”) the skull before examining it. A better and simpler alternative might be:

A jewel of infinite value is in the carved skull.
After printing the name of the carved skull: omit contents in listing.

Of course, this will never list the contents of the skull, not even after it has been examined. If you only want to hide the contents until someone examines the skull, you could use the following rules:

The skull can be examined or unexamined. The skull is unexamined. After printing the name of the unexamined skull: omit contents in listing. Before examining or searching the unexamined skull: now the skull is examined. and probably also:

[code]
Before inserting something into the unexamined skull:
if the skull contains something, say “You discover [contents of the skull] in the skull!”;
now the skull is examined.

Before doing something with the jewel when the skull is unexamined:
now the skull is examined.
[/code]which will take care of situations where the player immediately decides to just “take jewel” or “put flower in skull” without examining it first. You might also want to add rules to let the player discover the jewel when they do something else with the skull, like just picking it up.

Thanks for all your help. I tried to figure out how to do this for hours last night, and now I’ve finally got it.

As for the character builder, if that would be too difficult, would it be easier to have players choose from three or four different pre-made characters? How would I do that?

That’s going to depend on your game. A character chooser/builder is as complicated as you make it. Nobody can say “here’s how you create a character” because there are numerous ways technically and artistically to do it. It’s like asking “How should the first room be described?”

Here’s a quick bit to give you an idea:

[code]Strength is a number that varies.

Intelligence is a number that varies.

Requesting Stats is an action applying to nothing. Understand “stats” and “stat” and “statistics” as requesting stats.

Carry out requesting stats:
say “Your Strength is [strength], and your intelligence is [intelligence].”

Sunny meadow is a room. A heavy-looking boulder is in Sunny Meadow. A school book is in sunny meadow.

After taking heavy-looking boulder:
if strength is less than 5:
say “Wow, that’s a heavy boulder!”;
increase strength by 1;
otherwise:
say “You pick up the boulder like it weighs nothing!”.

The description of school book is “Full of [if intelligence is less than 5]difficult[otherwise]simple[end if] lessons.”

Carry out examining school book:
increase intelligence by 1.[/code]

Or for more explicit character building:

[code]Strength is a number that varies.

Intelligence is a number that varies.

Health is a number that varies.

Wisdom is a number that varies.

Charisma is a number that varies

XP is a number that varies. XP is 5.

To say /l: say “[line break]”

Requesting Stats is an action applying to nothing. Understand “stats” and “stat” and “statistics” as requesting stats.

Carry out requesting stats:
say “STR: [strength][/l]INT: [intelligence][/l]HEA: [health][/l]WIS: [wisdom][/l]CHA: [charisma][/l][/l]XP: [xp][paragraph break]”

The Room of Character Building is south of Sunny Meadow. “This is where you create your character. North lies endless adventure![paragraph break]You have [xp] points to add to your statistics. Type [bold type]STATS[roman type] to see your statistics.”

A button is a kind of thing. A button can be pushable. A button is usually pushable.

There is a red button in Room of Character Building. The description is “Strength.”. There is a blue button in Room of Character Building. The description is “Intelligence.”. There is an orange button in Room of Character Building. The description is “Health.”. There is a green button in Room of Character Building. The description is “Wisdom.”. There is a purple button in Room of Character Building. The description is “Charisma.”.

There is a sign in Room of Character Building. The description is “It says: [italic type]All buttons but Red broke. Mgmt. sorry inconvenienience. -Grunk[roman type]”

Check pushing red button:
if XP is 0:
say “Sorry, you’ll need to gain more XP before increasing your stats.” instead.

Carry out pushing red button:
increase strength by 1;
decrease xp by 1.

Check pushing a button:
if XP is 0:
say “You’ll need to gain some XP before you can add to your statistics!”

After pushing red button:
say “You have increased your strength by one; it is now [strength].[/l]”;
say “[italic type]Angelic voices harmonize.[roman type][/l]”

Sunny meadow is a room. A heavy-looking boulder is in Sunny Meadow. A school book is in sunny meadow.

To say ding xp:
increase XP by 1;
say “[italic type]You have gained an experience point![roman type][/l]”

Before taking heavy-looking boulder:
if strength is less than 5:
say “You can’t pick that up, you weakling!” instead.

After taking heavy-looking boulder:
say “You pick up the boulder like it weighs nothing![first time][ding xp][only]”;

	[/code]
1 Like

By the way, if you want to have RPG-style combat, you might want to take a look at the Inform ATTACK extension. I’m redesigning it right now, though, so the codebase at github is not the most stable. (Play a couple of games of Kerkerkruip if you want to see whether you like the system.)

Here’s another quick example, using the Questions extension that Victor mentioned:[code]Include Questions by Michael Callaghan.

A person has a number called health.
The health of the player is 50.

When play begins:
now the right hand status line is “Health: [health of the player]”.

Profession is a kind of value. The professions are tinker, tailor, soldier, spy.

A person has a profession.

The description of the player is “You excel at being a [profession of the player].”

The City Gate is a room. “The massive walls of the capital city rise above you. All overland travellers who wish to enter the city have to get registered here at the main gate.”

The gatekeeper is a man in the City Gate. “The heavily armed gatekeeper approaches you.”
The profession of the gatekeeper is soldier. The health of the gatekeeper is 100.

After looking for the first time:
now current question is “‘Well met, traveller! What is your profession?’”;
now current question menu is { “‘Tinker.’”, “‘Tailor.’”, “‘Soldier.’”, “‘Sp… uh, sailor.’”};
ask a closed question, in menu mode.

A menu question rule:
if the current question is “‘Well met, traveller! What is your profession?’”:
if the number understood is 1:
now the profession of the player is tinker;
say “‘All right, have a nice stay,’ he says jovially.”;
if the number understood is 2:
now the profession of the player is tailor;
say “‘Looking to ply your trade in the city? Well, good luck,’ he says.”;
if the number understood is 3:
now the profession of the player is soldier;
[Soldiers are usually physically fit, so let’s say they have a higher health than the average:]
now the health of the player is 70;
say “‘Well, don’t cause any trouble in our city,’ he says.”;
if the number understood is 4:
now the profession of the player is spy;
say “‘Shouldn’t you have arrived at the harbour, then? Oh, never mind,’ he says.”.
[/code]

Thanks for all your help. I have already downloaded the ATTACK extension and was planning on using it for rpg style combat. I’ve been super busy right now and haven’t had a chance to look at it yet. My wife and I have been planning on becoming foster parents and I’ve spent the better part of the past two weeks getting ready for that. This weekend I should have some more time to concentrate on my story and take a look at everyone’s suggestions.