0 votes
by (950 points)

Hello :)

I am fairly new with Twine and been trying to work out a character creation for players... I want them to be able to type in a name they want and choose from a list of variables their characters looks.

I created something using this link https://twinery.org/forum/discussion/2990/remembering-character-creation-options

I put this into the StoryInit:

<<set $name to "Jane">>
<<set $Age to "18">>
<<set $BodyType to "Slender">>
<<set $BodyHeight to "5 ft 7 inches">>
<<set $SkinColor to "Pale">>
<<set $HairColor to "Blonde">>

 

I put into the start box [[Character Creations]] which opened a new passage. Inside that new passage with that name on it which contains now this:

1) [[Skin color]]: $SkinColor
2) [[Body Type]]: $BodyType
3) [[Body Height]]: $BodyHeight
4) [[Hair Color]]: $HairColor
5) [[Age]]: $Age
<<textbox "$name" "Type your name, here!">>
[[Stats]]

Each of those added variable such as $BodyHeight has made a new passage. To put out just one example, I will show what is inside the  $SkinColor string passage:

[[Pale Skin|Character Creations][$SkinColor to "Pale Skin"]]
[[Light Skin|Character Creations][$SkinColor to "Light Skin"]]
[[Light-Brown Skin|Character Creations][$SkinColor to "Light-Brown Skin"]]
[[Ebony Skin|Character Creations][$SkinColor to "Ebony Skin"]]
[[Dark Skin|Character Creations][$SkinColor to "Dark Skin"]]

Then I got a Stats passage which contains this:

<b>Name:</b> <<display $name>>
<b>Age:</b> <<display $Age>>
<b>Skin Color:</b> <<display $SkinColor>>
<b>Body Type:</b> <<display $BodyType>>
<b>Body Height:</b> <<display $BodyHeight>>
<b>Hair Color:</b> <<display $HairColor>>

My original means had been to make the stats passage show the choosen stats before you continue to the actual game, but I get a message saying:

Error: <<display>>: passage "Jane" does not exist 

It seem to detect the choices one makes correctly. If i change the name for example from the default name, Jane, to something else the error message has that instead of Jane listed...

I am pretty sure, I am missing out on something but I fail to see what. Can someone help me figure it out?

Later on, I mean to bind these variables with some strings to make an NPC rate the PC based on the character sets... but for now, I would be already happy someone helps me out discovering how to correctly get it displayed. :)

Thank you a lot in advance

Mr. Peppermint

 

 

 

1 Answer

0 votes
by (63.1k points)
selected by
 
Best answer

That's not what <<display>> does, it shows the contents of a passage within another passage. It's actually deprecated anyway, you should use <<include>> instead. 

To display the value of a variable, just type the variable's name into the editor. 

<b>Name:</b> $name
<b>Age:</b> $Age

You can also use <<print>> (and its related macros, <<=>> and <<->>) to print more complicated values, like the results of expressions or functions. 

Also, I suggest picking a capitalization scheme and sticking to it. You're using upper CamelCase (i.e. $Name, $FirstName, etc), except for $name. This will make it hard to remember the correct variable names. Most Twine users tend to use lower camelCase, (i.e. $name, $firstName, etc). It doesn't really matter what you pick, but it's best to be consistent. 

by (950 points)
*facepalm*

Thank you very much, that was completely my mistaking <<display>> with <<print>>. It works, now :)

YaaY
...