# Name Inputting

**URL:** <https://forum.choiceofgames.com/t/name-inputting/2212>\
**Category:** ChoiceScript Help\
**Created:** [March 13, 2014, 6:29am UTC](https://forum.choiceofgames.com/t/name-inputting/2212 "2014-03-13T06:29:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavidGil](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@DavidGil](https://forum.choiceofgames.com/u/DavidGil)\
**Post date:** [March 13, 2014, 6:29am UTC](https://forum.choiceofgames.com/t/name-inputting/2212/1 "2014-03-13T06:29:14Z")

</div>

I’m doing okay when it comes to learning the language, but I can’t wrap my head around how to allow players to input both a first name and a surname while having them display on the same line in the stats screen. I don’t really want to just offer the name choices as that would defeat the purpose in my view. I can, however, get the text to alter when it’s a single variable that’s being tweaked.

I have the text setup right at the start, so when you look on the stat screen, it says ‘Name: John Doe’ which I’ve done by using this code in the startup text:

\*set firstname “John”  
\*set surname “Doe”  
\*set Name (“John”&" ")&“Doe”

But when I ask players to input their first name, with ‘\*input\_text firstname’ and ‘\*input\_text surname’, John Doe never changes to correspond to the player’s inputs.

When it comes to having the text change for just one input, I can get that working fine. I’m beginning to think I should just let players enter their first name.

Any help, please, as I’ve seen that it can be done? (And I’ve tried various combinations of ‘\*input\_text ${firstname}’ too. Nothing’s working and I’ve gone through the tutorials.)

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 13, 2014, 6:35am UTC](https://forum.choiceofgames.com/t/name-inputting/2212/2 "2014-03-13T06:35:56Z")

</div>

```
*set name (firstname&" ")&surname

```

Then on the stats screen, just use:  
${name}

That is probably what you’re looking for 🙂

EDIT: If it’s easier, just printing both names separately should work too:

```
${firstname} ${surname}

```

---

<div class="post-metadata">

**Author:** ![DavidGil](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@DavidGil](https://forum.choiceofgames.com/u/DavidGil)\
**Post date:** [March 13, 2014, 6:46am UTC](https://forum.choiceofgames.com/t/name-inputting/2212/3 "2014-03-13T06:46:14Z")

</div>

Appreciate the help, but it’s still not changing unfortunately. ☹

This is the code I’ve got at the beginning of the startup.txt file:

\*title Vigilante  
\*create Calmness 50  
\*create Money 100  
\*create Alias 0  
\*create firstname 0  
\*create surname 0  
\*create Name 0  
\*set firstname “John”  
\*set surname “Doe”  
\*set Name (firstname&" ")&surname  
\*set Alias “Not set”

Then later, I have the \*input\_text first name & surname commands.

I’ll leave the link too: [https://dl.dropboxusercontent.com/u/188083660/Vigilante/web/mygame/index.html](https://dl.dropboxusercontent.com/u/188083660/Vigilante/web/mygame/index.html) (I know I need to change the ${youralias} bit at the end.)

Edit: Oh right, thanks. I’ll quickly try what you suggested in the edit. And I think I missread, unless the ‘Then on the stats screen, just use:  
${name}’ was added later. 😉 Playing catch-up. Kinda rushing about as I’ve been trying for hours to get it working. I just want to move on with the story. 😉

---

<div class="post-metadata">

**Author:** ![DavidGil](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@DavidGil](https://forum.choiceofgames.com/u/DavidGil)\
**Post date:** [March 13, 2014, 7:02am UTC](https://forum.choiceofgames.com/t/name-inputting/2212/4 "2014-03-13T07:02:16Z")

</div>

No, I can’t get it working. ☹ I’ve tried what was suggested. The stat screen simply won’t accept anything with ${name}

Edit: Oh, hold on. If I put it outside the stat chart . . .? Sorry, very new to programming with starting yesterday.

---

<div class="post-metadata">

**Author:** ![MaraJade](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/marajade/32/835_2.png) [@MaraJade](https://forum.choiceofgames.com/u/MaraJade)\
**Post date:** [March 13, 2014, 7:03am UTC](https://forum.choiceofgames.com/t/name-inputting/2212/5 "2014-03-13T07:03:43Z")

</div>

Also i recommend you use variables without capitals could cause LOT of errors ,i know with modern version you can but with oldies you even couldnt is really easy write name instead Name in variables.

---

<div class="post-metadata">

**Author:** ![DavidGil](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@DavidGil](https://forum.choiceofgames.com/u/DavidGil)\
**Post date:** [March 13, 2014, 7:14am UTC](https://forum.choiceofgames.com/t/name-inputting/2212/6 "2014-03-13T07:14:46Z")

</div>

Well, no matter what I do, with or without capitalisation, it’s not saving the inputted text for the stat screen. At this point, I’m about to give up and just let players enter the first name, while having the surname on a separate line. That or I’m just going to get very frustrated.

Edit: Actually, I could have the player input the surname too. It’ll just be on a different line. It’s just that it’s not going to look as nice as it would on the same line.

Edit 2: There we go. The text is now changing, but the first name and surname are on separate lines.

---

<div class="post-metadata">

**Author:** ![DavidGil](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@DavidGil](https://forum.choiceofgames.com/u/DavidGil)\
**Post date:** [March 13, 2014, 7:42am UTC](https://forum.choiceofgames.com/t/name-inputting/2212/7 "2014-03-13T07:42:50Z")

</div>

Well, it’s working now. Really sorry about this. I was just getting more and more frustrated really with trying since last night to get it working.

Really have no idea why it wasn’t working before.

---

<div class="post-metadata">

**Author:** ![Silent\_Shadow93](https://avatars.discourse-cdn.com/v4/letter/s/f475e1/32.png) [@Silent\_Shadow93](https://forum.choiceofgames.com/u/Silent_Shadow93)\
**Post date:** [March 19, 2014, 2:11pm UTC](https://forum.choiceofgames.com/t/name-inputting/2212/8 "2014-03-19T14:11:44Z")

</div>

@DavidGil  
I too am having this problem and would like to know how you finally got it figured out here is my startup

\*create firstname “”  
\*create surname “”  
\*create name “”  
\*create Age “”  
\*create Wealth “”  
\*create Income “”  
\*create rank\_name “Civilian”  
\*set name (firstname&" ")&surname

Later I have the player choose from one of five names or input their own which works fine, however it will not show firstname and surname as one name in my stats which look like so…

\*stat\_chart  
text Name  
text Age  
text rank\_name Rank  
text Wealth  
text Income

---

<div class="post-metadata">

**Author:** ![DavidGil](https://avatars.discourse-cdn.com/v4/letter/d/bb73d2/32.png) [@DavidGil](https://forum.choiceofgames.com/u/DavidGil)\
**Post date:** [March 19, 2014, 5:44pm UTC](https://forum.choiceofgames.com/t/name-inputting/2212/9 "2014-03-19T17:44:33Z")

</div>

@Silent_Shadow93 There are two things you can do.

First:

\*create firstname “No”

\*create surname “Name”

Then the \*input\_text firstname & surname commands when you want the player to enter their name.

Then if you go to the choicescript\_stats file and, without using a stat chart, just use as an example:

Name: {firstname} {surname}. It’ll print whatever you entered.

However, there’s a more elegant way of doing things.

If you use this coding below, it’ll only change ‘No Name’ to the proper name once both names have been entered:

\*if (firstname = “No”) and (surname = “Name”)  
Name: No Name

\*if (firstname != “No”) and (surname != “Name”)  
Name: {firstname} {surname}

I hope this helps.

PS: Where you have “” in the code for wealth etc., it’s not needed. Just go with the number 0 or whatever you want the starting value to be. You don’t really need it. I can see why you’d have possibly have it for age and rank though.
