Help with Naming Characters

Cejmr5_AJ :D

Villager
Member
Joined
Nov 13, 2016
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
So, I'm not quite sure how to do this, and I need help. When my game starts, I want the player to be able to type in their name, and I know how to do this. But, I want to add something to the end of the inputted name. For example, say the player wanted their character to be named "Sarah". But, if the game was about you being, lets say, a dog, your name would automatically end up being "Sarah the Dog". I'd like to know how to make the game automatically add words to the end of an inputted name, or in this case, how to add on "the Dog".
 

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
467
Reaction score
226
First Language
Portuguese
Primarily Uses
RMMV
You could work with variables.


var1 = inputted name


var2 = the Dog


Then you change the name of the character to var1+var2. Or you could use the Nickname field.
 

Cejmr5_AJ :D

Villager
Member
Joined
Nov 13, 2016
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
You could work with variables.


var1 = inputted name


var2 = the Dog


Then you change the name of the character to var1+var2. Or you could use the Nickname field.
Hm, that seems like it'd work, but I'm a bit confused as to how I'd do it. I tried, and it gave me an error message. Also, I don't think the nickname field would be that useful in my situation. Do you mind explaining how I'd do it?
 

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
467
Reaction score
226
First Language
Portuguese
Primarily Uses
RMMV
You would need a little knowledge in JS to get the name and do the trick. Unfortunately I'm no savvy on JS, so can't help you with more than the idea. The implementation will need additional help.
 

Cejmr5_AJ :D

Villager
Member
Joined
Nov 13, 2016
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
You would need a little knowledge in JS to get the name and do the trick. Unfortunately I'm no savvy on JS, so can't help you with more than the idea. The implementation will need additional help.
Hm, I'll look into it. Thanks anyways, though!
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Hm, that seems like it'd work, but I'm a bit confused as to how I'd do it. I tried, and it gave me an error message.


Can you show us an image of the event that you used and the error message?
 

Cejmr5_AJ :D

Villager
Member
Joined
Nov 13, 2016
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
Can you show us an image of the event that you used and the error message?
Sure!

Coding.png


This is the event. First I put the Name Input Processing. Then I did control variables, and set the variable called "inputname" to <n\[1]>, thinking it might work due to the fact that "<n\[1]>" is what you use when inserting a player's name in a text box. Then I tried setting a variable called the cat to " the cat", set a variable to add them together, but it didn't work.


Error.png


This is the error. As soon as I put in a name and hit OK, this appeared.


I'm thinking I could do it by storing the inputted name into a variable, storing the words "the cat" into a variable, and adding them together. But, I don't know how to do that.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
\N (and so are the other text escape codes) only works inside of Message Box so it will not work...


Your command should be


inputname = $gameActors.actor(1).name


I think


Also, there shouldn't be any <> in there... Even the escape codes when used on text should just be \N[index] and not <\N[index]>


It should only look like


Control Variables: # 0002 inputname = $gameActors.actor(1).name


Control Variables: # 0001 the cat = "the cat"
 
Last edited by a moderator:

Cejmr5_AJ :D

Villager
Member
Joined
Nov 13, 2016
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
Yea, I replaced \N with that and changed the cat to "the cat", but this time I don't get the error message, but there's no "The cat" afterwards. It's probably due to "the cat". So, I need to be able to store the words "the cat" into a variable. Geez, this stuff is confusing. But I've seen a game made in XP do this, so it's not impossible...
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
I tried it and I don't get any errors, can you post your new event? Are you sure you removed the < > ?


EDIT: Oh wait, using just .name will save the function not the returned value.. weird
 
Last edited by a moderator:

Cejmr5_AJ :D

Villager
Member
Joined
Nov 13, 2016
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
Yeah, when you right click it just shows the name you put in, without anything after it.
 

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Here's a working event, it shows Harold the cat in the text box..


I just did 


Variable 2 = $gameActors.actor(1).name()


Variable 1 = " the cat" (not <"the cat">)


Variable 2 += Variable 1


EDIT: Realized you dont even need two variables lol


Take note though that this doesn't actually change player's name to Name + the cat. If you want to do that, use this script call instead


$gameActors.actor(1).setName($gameActors.actor(1).name() + " the cat")


That way, Player 1's name will be changed to whatever his name currently is plus the cat


The cat.PNG
 
Last edited by a moderator:

Cejmr5_AJ :D

Villager
Member
Joined
Nov 13, 2016
Messages
15
Reaction score
1
First Language
English
Primarily Uses
RMMV
Yea, that worked! Thanks a ton!


All you need to do to change the name is put this { $gameActors.actor(1).setName($gameActors.actor(1).name() + " the cat")  String of coding. Again, thanks!!!
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
You probably saw the older version of my reply, read it again.. The new code is now working fine
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,569
Latest member
Shtelsky
Top