Newbie question: How to get a player's name?

cliffale
How can you acquire and store a user's name? I went through the Docs but I swear I can't seem to find anything about asking the user for input and then, say, printing that input in a sentence. Just a simple string.

HegemonKhan
here's really good help on this stuff:

http://docs.textadventures.co.uk/quest/ ... ation.html (character creation, this is your guide to doing what you want, and more)
^^^^^^
http://docs.textadventures.co.uk/quest/guides/ (this is the 'how to' link in the doc main/home page ~ the link below, it's easy to not see/notice it)
^^^^
http://docs.textadventures.co.uk/quest/
^^^^
path

---------------

generally people use the built-in 'alias' String Attribute to store (usually) the default 'player' Player Object's (your character's) name.

---------

my generic syntax for how to Script:

Object_name.Attribute_name
~ OR ~
Object_name.Attribute_name = Value_or_Expression
~ OR ~
if (Object_name.Attribute_name = Value_or_Expression ) { /* Script(s) */ }

so in scripting code, its:

player.alias

Object_name: player
Attribute_name: alias

if you know algebra:

x = 10
y = 50 + x
// conceptually: y = 50 + <x:10>
output: y = 60

it's the same thing:

x -> player.alias
y -> msg ("Your inputted character name is " + player.alias + ".")

player.alias = "HK"
msg ("Your inputted character name is " + player.alias + ".")
// conceptually: msg ("Your inputted character name is " + <player.alias: "HK"> + ".")
// output: Your inputted character name is HK.

--------

or, you can use the text processor commands:

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

the ' {Object_name.Attribute_name} ' text processor command

msg ("Your inputted character name is {player.alias}.")
// output: Your inputted character name is HK.

Pykrete
player.alias. To use it in printed text, you can type {player.alias}. This works for all attributes... all the ones you'd want to display, anyway!

cliffale
Thank you so much for your help!

anotherone
HegemonKhan wrote:here's really good help on this stuff:

http://docs.textadventures.co.uk/quest/ ... ation.html (character creation, this is your guide to doing what you want, and more)
^^^^^^
http://docs.textadventures.co.uk/quest/guides/ (this is the 'how to' link in the doc main/home page ~ the link below, it's easy to not see/notice it)
^^^^
http://docs.textadventures.co.uk/quest/
^^^^
path

---------------

generally people use the built-in 'alias' String Attribute to store (usually) the default 'player' Player Object's (your character's) name.

---------

my generic syntax for how to Script:

Object_name.Attribute_name
~ OR ~
Object_name.Attribute_name = Value_or_Expression
~ OR ~
if (Object_name.Attribute_name = Value_or_Expression ) { /* Script(s) */ }

so in scripting code, its:

player.alias

Object_name: player
Attribute_name: alias

if you know algebra:

x = 10
y = 50 + x
// conceptually: y = 50 + <x:10>
output: y = 60

it's the same thing:

x -> player.alias
y -> msg ("Your inputted character name is " + player.alias + ".")

player.alias = "HK"
msg ("Your inputted character name is " + player.alias + ".")
// conceptually: msg ("Your inputted character name is " + <player.alias: "HK"> + ".")
// output: Your inputted character name is HK.

--------

or, you can use the text processor commands:

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

the ' {Object_name.Attribute_name} ' text processor command

msg ("Your inputted character name is {player.alias}.")
// output: Your inputted character name is HK.



Been a week since I started playing around with codes. Just can't get the timer function to do what I want though so will have to look through threads and see if there are any info I can use on that. But thanks for all the links above. Very useful when I was creating and experimenting with ideas for my game. I'm a total noob but loving and enjoying everything about this. Can't wait to finish a complete game and share it with everybody. Thanks again.

HegemonKhan
Timers (using actual "clock" time) have lots of issues...

whereas, if you're a good programmer, you can have a (full) turn system in your game, controlling every aspect of your turns in your game. Every action you do, uses either no/zero turns or X turns, for example, checking your character information, uses up zero game turns, whereas looking at something uses up 1 turn, whereas, resting uses up 4 turns, sleeping uses up 8 turns, moving to the adjacent room-location uses up 1 turn, whereas moving to a far away room-location uses up many turns, at this turn interval (ie every 5 turns: turn 5, 10, 15, etc) this event happens, etc etc etc. Also, the turns can be coverted into a time-date system, which unlike using Timers, you'd have full control over your turn-date-time system. Turnscripts and the internal 'turns' of the game provides total control, whereas Timers (actual "clock" tiime), doesn't allow as much control.

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

Support

Forums