Create custom characters in Inform 7

Ok, I want to check that the game is saving the values of race and gender and that I can call them up if I want, so I added in the following code at the end:

say "[line break]Hello [player's full name]! You are a [player's gender] [player's race]!"; 

Unfortunately this doesn’t work and typing [gender] or [race] compiles 0k but breaks the program. Can anyone tell me what I need to do?

By the way, is there a way to make it so that I can use the [] tags in speech to insert correct pronouns for the player? Say, you have someone who calls you “lad\lass”, “sir\madam” or “gramps\grandma” depending on your age bracket (young, regular or old)?

You need [full name of the player], etc.

Yes, there is. You can do a great deal of things by making new ‘say’ statements.

To say nickname:
if the gender of the player is male begin;
 if the age of the player is young begin;
 say "lad";
 otherwise if the age of the player is adult;
 say "sir";
 say "gramps";
 end if;
 if the age of the player is young begin;
 say "lass";
 otherwise if the age of the player is adult;
 say "ma'am";
 say "grandma";
 end if;
end if;

Then you just need to use [nickname] in your text, as appropriate.

(Note: these are not pronouns, though pronoun-handling is a related issue. For that, I would use the built-in extension Plurality.)

Thanks a lot for the pronouns, but I’m not too sure what you mean by this bit:

Sorry I didn’t say, but at the moment the full name of the player does work, but gender and race don’t. :mrgreen:

To clarify: [gender of the player] should work, but [player’s gender] won’t.

Ok, that’s cool. By the way, I’ve noticed something weird, I can link rooms together, but I can’t do it in a 3x3 grid, it will link the centre on four sides, but when I try to link the corners it says there is a conflict. I’m not trying to make the player move diagonally (not yet anyway), but it seems strange that I can’t make a large room like that. Am I doing something wrong?

How are you doing it? Something like this should work:

Top Left is a room. Top Center is east of Top Left. Top Right is east of Top Center. Middle Left is south of Top Left. Middle Center is east of Middle Left and south of Top Center. Middle Right is east of Middle Center and south of Top Right. Bottom Left is south of Middle Left. Bottom Center is east of Bottom Left and south of Middle Center. Bottom Right is east of Bottom Center and south of Middle Right.

I’m guessing you accidentally defined the same way out of one of the rooms twice (tried to put two rooms east of one of the other rooms, or something like that).

I went through and checked and it seems like it’s 0k. I went through without the reference to a corner and there was nothing in the direction I wanted to use.

To make things easier I tried to make it male and female instead of masculine and feminine, but even though I changed all the references it has stopped working. Do you know what I did wrong?

“Male”, “female” and “neuter” are already used by I7, so when you try to use those words for something else, it doesn’t work.

The text substitutions ‘[player’s forename]’ and ‘[player’s full name]’ work, because you have actually created two text variables called ‘player’s forename’ and ‘player’s full name’. Inform won’t recognize ‘[forename of the player]’ or ‘[full name of the player]’, since that is not the names of those texts.

To the contrary, the player’s gender and race are not text or objects or any particular that you ever choose a special name for; instead gender is a value (or property) that gets associated with the player, because you have told Inform to associate a gender with every person in the game. To refer to such properties of objects or values associated with objects, Inform requires that you use the syntax rather than the Saxon genitive. So, in this case you need ‘[the gender of the player]’ and ‘[the race of the player]’ and can’t use ‘[player’s gender]’ or ‘[player’s race]’.

Yeah, it is kinda picky.

0k, I’ve been getting on very well with my game, but I’ve gotten stuck again. What I want to do is to make a lever that has three or four positions, up, middle, and down, and make it so that when the player pulls it it changes where a particular door leads from one room to another. Can anyone help?

In the room with the lever, create a one-sided door that initially leads to one of the goal rooms (see sect. 3.12 in the Manual):

The Green Door is a door. It is north of the White Room. Through it is the Yellow Room.

In all the goal rooms, create one-sided doors that lead to the room with the lever, all with the same printed name as the door in the room with the lever:

A door called Green Door 1 is south of the Yellow Room. The printed name is "Green Door". Through it is the White Room.

(It can be convenient to give these doors a name that includes their printed name, otherwise you have to add the relevant understand phrases.)

Make a kind of value with three or four possible named values. And make such a value a property of the lever (see sect. 4.9 of the Manual).

Then write rules for pulling and pushing the lever, that changes both the value of the lever’s property (depending on the current value) and what room is through the door in the room with the lever (depending on the new value). (Pulling and pushing are actions created by the Standard Rules, so you don’t have to create them from scratch.):

Carry out pulling the lever:
	if the lever is all the way up:
		now the lever is almost up; 
		now the Red Room is through the Green Door;
	otherwise if the lever is almost up: 
		now the lever is almost down; 
		now the Blue Room is through the Green Door;

(Like ‘male’ and ‘female’, mere ‘up’ and ‘down’ are already defined by the Standard Rules of I7, so you need to call the values of the lever something else, like ‘all the way up’ or whatever.)

Thanks, I’m still fiddling with that, but at the moment I’m having a lot of trouble with variables for some reason. My RPG game has kinda been shelved at the moment and I am working on a detective thriller instead and want the player to be able to choose a player class that affects the game. Unfortunately, just setting the class is giving me an error:

Profession is a kind of value. The Professions are Detective, and Gambler.
After reading a command when the current character-definition is proffchoice: 		
	if the player's command includes "[Profession]": 
		now the Profession of the player is the Profession understood; 
		say "[paragraph break]text[line break]";
		now the command prompt is "I will be a...... >";
		now the current character-definition is genderchoice;
		reject the player's command; 
		say "Please choose 1 or 2:"; 
		reject the player's command;

I’m not sure why it is suddenly doing this and it does it for anything I type as a variable, including just random stuff like ‘flsjfldsj’. Can anyone help? It keeps on happening in other parts of my script and I have a lot quoted out now.

You’ve told Inform that Profession is a value, but you haven’t told it that the player is allowed to have one of those values, or what that particular profession should be called. What you’re doing is a bit like saying ‘now the number of the player is 5’: a player might have a whole variety of numbers associated with them, or none at all, and Inform isn’t going to guess and hope for the best.

So you do something like this:

The player has a profession called job.

and then modify the code you’ve already got to reflect that:

now the job of the player is the profession understood;

But, if you’re not going to use professions for anything else, you can also do it without naming that value, and Inform will assume you’re always talking about the only possible profession:

The player has a profession.

Oh right, sorry. :stuck_out_tongue: That was a silly mistake.

Hey, so I was wondering if I could get an update on the development on this or even a way to make my own version of this? I’m having difficulty using the code provided here on this form.

Two potential issues here!

One is that Inform has gone through a couple of updates which change some syntaxes, so it’s possible that some of the code that is posted here won’t compile anymore.

The other is that when we converted the forum from the old software to the new software, the script we had for converting code tags missed a bunch, leaving the code in an unholy mess of wrongly indented stuff. Often the proper indentation is there somewhere so I can fix it by hand given time… but this is a pretty long thread with lots of broken code tags so it might take some time indeed! Check back in a bit.

1 Like

Ok thank you
I was just wondering if it was still being worked on…

Well, as far as the original person’s code went, I would guess that they aren’t working on that project anymore, since it’s been a long time! I’m not sure if it ever got completed/released.

But if you’re interested in using it and have questions about it and what is/isn’t working, please do ask! We like answering code questions.

Also, I fixed the tags so the code should be more readable and often possible to copy into a new Inform. It didn’t take that long, my afternoon class has been cancelled due to a massive blizzard, and fixing code tags makes me happy, so it’s no problem.


So to continue what I am trying to do, I want to make a Text Based Adventure RPG with a good amount of customization. Specifically, having customizable characters with custom attributes. Like so…

Ethnicity and/or Skin Tone
Eye color
Hair Color
Varying Weight for making it feel realistic.
Profession (With Starting items, like an adventurer would have a sword but a bard would have a mandolin.)
And Ect.

And then there is the whole entire topic of clothing in inform 7 which Im trying to get working, which it will have clothing that can be layered under armor, and the clothing can be layered over underwear, with a lot of different clothing options and types.

Its ambitious. But Im trying to see if I can get it to work. I made a clothing start, something like,

Garment is a type of value. The type of garment are Shirt, Pants, Bra, Boxers, Underpants, ect...

Cool! I’d repeat Sam’s warning from the top of the thread, that making a full-fledged RPG in I7 is a lot of work. But I also think it’s a lot of fun to tinker with ambitious projects, and it’s not like I finish anything, so I’d hardly discourage you!

Layered clothing is pretty notoriously difficult to do. There’s some complicated code going around for it–see this and this extension from this thread. Good luck!