How can you let the player choose the names of their character?

Hi so at the beginning of the game I want to let the player choose what they want to be called but I don't know how and also in the game there will be NPCs calling the player's name so how do I make the name that the player chooses show up there. Thanks


K.V.

Hello,

This should help you:
http://docs.textadventures.co.uk/quest/guides/character_creation.html


Hi I read the guide and I sort of get it now (I'll just copy the thing they did there lol) but I couldn't find where they tell you how to let the text in the game include the name the player chooses? If it did I probably didn't understand it lol


It works for the first time I ask that, but if I try in a different part of a game for example, it doesn't work. So it's supposed to go something like this

Whats your name?
(Player types name)
Welcome so and so!
(So and so enters first room, where a message is printed right after entering)
So and so, you have a letter!
(Player opens letter)
Dear So and so blahblahblahblah

Yeah so I can make the welcome part go right but not the rest. Help?


K.V.

Try using {player.alias}, entered with the brackets in a text field.

msg ("Hi, {player.alias}.")

Ahh it works now! Thanks!!


KV's method uses the 'text processor commands', see here:

http://docs.textadventures.co.uk/quest/text_processor.html

but, you can also use normal scripting too, an example:

msg ("Hi, " + player.alias + ".")

for more detailed guide on using Attributes and the 'if' Script:

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

ask if you got any questions


K.V.

Is there a way to do this without the code?
(from another thread by archerqueen08)


I believe the problem was with the "Print" dropdown setting.

You need to switch it from "message" to "expression" when using this method:
"Hi, " + player.alias + "."

image


KV's right (forgot to explain '[MESSAGE]' vs '[EXPRESSION]' for the GUI/Editor's script options):

if you're doing it the normal scripting way, then you need to use the '[EXPRESSION]' script option:

print [EXPRESSION] "Hi, " + player.alias + "."

if you're using the 'text processor commands', than I think you can also use the '[MESSAGE]' with it:

print [MESSAGE] Hi, {player.alias}.

// or how'd you use the '[EXPRESSION]' script option and the text process command, together:

print [EXPRESSION] "Hi, {player.alias}."


this is an ERROR however (because the '[MESSAGE]' is for TEXT ONLY, and also text processor commands too):

print [MESSAGE] "Hi, " + player.alias} + "." // ERROR !!!!


the '[EXPRESSION]' let's you do any combination:

  1. TEXT ONLY:

print [EXPRESSION] "Hi, my name is HK."

  1. VARIABLE ONLY:

// player.alias = "HK"
print [EXPRESSION] player.alias

  1. TEXT and VARIABLE:

// player.alias = "HK"
print [EXPRESSION] "Hi, my name is " + player.alias + "."


the '[MESSAGE]' ONLY let's you do TEXT (unless you use a text processor command):

print [MESSAGE] Hi, my name is HK.

// player.alias = "HK"
print [MESSAGE] "Hi, my name is " + player.alias + "." // ERROR !!!!!

// player.alias = "HK"
print [MESSAGE] Hi, my name is {player.alias}.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums