Collecting parts of an actor's name

Stupidbro

Veteran
Veteran
Joined
Jul 8, 2019
Messages
87
Reaction score
8
First Language
English
Primarily Uses
RMVXA
Basically, I'm wanting to have a spot where something has the player's initials. For example, if I end up making the player's last name "Jones" by default, and they choose the first name "Andrew", then the object may end up saying either "A. Jones" or simply "AJ" based on which one I eventually choose.

Does anyone know how to store the first letter of an actor's name?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,640
First Language
Czech
Primarily Uses
RMMV
$gameVariables.setValue(1, $gameActors.actor(1)._name[0]);

Edit: Oops, it's not for MV, but VXAce... Sorry :D
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
For VX Ace it is very similar
Code:
$game_variables[variable_id_goes_here] = $game_actors[1].name[0]
 

Stupidbro

Veteran
Veteran
Joined
Jul 8, 2019
Messages
87
Reaction score
8
First Language
English
Primarily Uses
RMVXA
For VX Ace it is very similar
Code:
$game_variables[variable_id_goes_here] = $game_actors[1].name[0]
Will that store the letter itself, or will that store the letter ID or something (Like 3 instead of C)?
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
Does anyone know how to store the first letter of an actor's name?
This was the original question, I was answering that question. For more information about how to get characters from strings you can check the documentation.

Like 3 instead of C
C in the ASCII table is 67, not 3. If you need the ASCII value for the character instead, you have to use the "ord" method on the single character string you obtain after storing it. You can find the said method in the documentation as well. If you want to obtain the index in the alphabet you have to create a table with the alphabet you want to use and get the index of the said character from that table (as not every language uses the same alphabet as other languages, even if they share characters).
 

Stupidbro

Veteran
Veteran
Joined
Jul 8, 2019
Messages
87
Reaction score
8
First Language
English
Primarily Uses
RMVXA
This was the original question, I was answering that question. For more information about how to get characters from strings you can check the documentation.


C in the ASCII table is 67, not 3. If you need the ASCII value for the character instead, you have to use the "ord" method on the single character string you obtain after storing it. You can find the said method in the documentation as well. If you want to obtain the index in the alphabet you have to create a table with the alphabet you want to use and get the index of the said character from that table (as not every language uses the same alphabet as other languages, even if they share characters).
I was just wondering if that was an issue. If it's not, then that's a "yay for me!":)
 
Last edited:

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

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,470
Members
137,821
Latest member
Capterson
Top