Name Inputting

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.)

*set name (firstname&" ")&surname

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

That is probably what you’re looking for :slight_smile:

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

${firstname} ${surname}

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

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 (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. :wink: 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. :wink:

No, I can’t get it working. :frowning: 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.

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.

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.

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.

@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

@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.

2 Likes