Hello, all! Jack here.
I know there are script calls for things like this to capitalize Actor's names:
var charName = $gameActors.actor(ActorID).name().toUpperCase();
$gameVariables.setValue(VarID, charName );
But is there a way to use only the first letter of the Player's chosen name? Would like to have this to help with creating a sad scene or a surprise scene. Whatever scenes there are. Lol.
Any help would be appreciative.
EDIT!
This post has been solved thanks to @Eliaquim and @Warilized !
Here is the example.
@Eliaquim Script Call
Change ActorID to the number of Actor of your choosing. Replace INDEX with 0. And then replace VarID with the Variable you wish to use in the game.
var firstLetter = $gameActors.actor(ActorID).name()[INDEX]
$gameVariables.setValue(VarID, firstLetter );
Should show like this;
var firstLetter = $gameActors.actor(1).name()[0]
$gameVariables.setValue(1, firstLetter );
@Warilized Script Call
It is pretty much the same as the one above.
var charName = $gameActors.actor(ActorID).name();
var capitaliseName = charName.charAt(0).toUpperCase() + charName.slice(1);
$gameVariables.setValue(VarID, charName );
This is Warilized's words.
.charAt(0) will give you the first letter of their name (e.g. "W")
.slice(1) will give you their name starting at second letter (e.g. "arilized")
I know there are script calls for things like this to capitalize Actor's names:
var charName = $gameActors.actor(ActorID).name().toUpperCase();
$gameVariables.setValue(VarID, charName );
But is there a way to use only the first letter of the Player's chosen name? Would like to have this to help with creating a sad scene or a surprise scene. Whatever scenes there are. Lol.
Any help would be appreciative.
EDIT!
This post has been solved thanks to @Eliaquim and @Warilized !
Here is the example.
@Eliaquim Script Call
Change ActorID to the number of Actor of your choosing. Replace INDEX with 0. And then replace VarID with the Variable you wish to use in the game.
var firstLetter = $gameActors.actor(ActorID).name()[INDEX]
$gameVariables.setValue(VarID, firstLetter );
Should show like this;
var firstLetter = $gameActors.actor(1).name()[0]
$gameVariables.setValue(1, firstLetter );
@Warilized Script Call
It is pretty much the same as the one above.
var charName = $gameActors.actor(ActorID).name();
var capitaliseName = charName.charAt(0).toUpperCase() + charName.slice(1);
$gameVariables.setValue(VarID, charName );
This is Warilized's words.
.charAt(0) will give you the first letter of their name (e.g. "W")
.slice(1) will give you their name starting at second letter (e.g. "arilized")