Newbie question: How to get a player's name?
cliffale
24 Mar 2016, 02:28How 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
24 Mar 2016, 03:06here'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.
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
24 Mar 2016, 03:11player.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
24 Mar 2016, 11:31Thank you so much for your help!
anotherone
09 Apr 2016, 17:21HegemonKhan 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
09 Apr 2016, 22:23Timers (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.
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.