Naming your character

I’ve posted this on my thread at http://www.choiceofgames.com/forum/discussion/946/advice-for-a-neewbie/#Item_73 but I’m still having issues setting it up so that the player can name their character. What I’m trying to do is using the *input_text script to let the player choose their own name, but I keep getting errors regardless of how I type it out. I’ve been backwards and forwards through the wiki, and I’ve even basically copied their examples and substituting my stuff, but nothing I try works.

All of my work that I’ve wrote out to date is upload to dropbox: https://www.dropbox.com/sh/jd7w6iktsntzx1p/l98dxg7uNb/Game

You have the script right:
Example:
*input_text name

That’s it. Although you have remembered to declare the variable ‘name’ in mygame.js, haven’t you? :slight_smile:

yep

I don’t have problem with that command if you still having problems pm I can help you

I just looked through your files. In ‘Chapter1’, you have the variables ‘firstname’ and ‘surname’ and you declare them right. However, you then have the lines:
*set firstname “{firstname}" \*set surname "{surname}”
You don’t need these as when the player types their name, that sets the variables correctly.

As I have the game right now, after the player type is their last name and click “next”, the following error appears: line 18: Invalid expression at char 17, expected no more tokens, found: OPERATOR [&

Delete the lines:
*set firstname “{firstname}" \*set surname "{surname}”

The line *set fullname “{firstname} {surname}” is also wrong. I would just use the two variables you have created to display the full name. Eg:

Your name is {firstname} {surname}.

If you really want a separate variable for it combining the two variables you have created, you will have to ask around the forum for someone who knows how to do it.

Ok, I changed the line: *set fullname firstname &" " &surname to *set fullname “{firstname} {surname}” but now the name in the stat screen stays blank.

Eureka! Never mind, I fixed it and now it’s working properly. Per usually with me, it was actually fairly simple and straight forward.

*set firstname “John”
*set lastname “Doe”
*set fullname (firstname&" ")&surname

${fullname} -> John Doe

From the Wiki: