Preset Character Names if the Input Screen is Left Blank

Okay, so, I'm wanting to allow a name character screen, but if the player doesn't name the character, then a default name will appear.

An example of this I can think of is the Pokémon games and how, if the name field is left empty, the game will then choose from a list of presets per gender such as Red, Fire, or Ash for the male and Leaf or Green for the female.

I can't seem to figure out how to code this, exactly... Can someone explain how to code this, please?
I think you can make that work with conditions.

Set a condition where it checks if the actor has a blank name - do that for how many spaces you can set in the name input. For example, if you set that the character can have a name up to 6 letters, put the names in the condition boxes as " ", " " and so on.

Then you can set a random variable to pick a random name to the character.

Something like this:

6dDl1f0.png


Unfortunately I don't have XP, so I don't know if it can work like this.
add your preset names into an array:
Code:
ary = ["name", "name", "name", "name", "name"]
then, pick a random number, based on the array's own length, and return the result, and use *it* to have *the array* pick the name.
Code:
rnd = rand(ary.length)
name = ary[rnd]
you can also save the name to a global variable and use the editor commands to pass it to the character.
Code:
$game_variables[ID] = ary[rnd]

you can fit all that into one single script block.
if you need to operate between script and condition blocks, set the variables to global
Code:
@ary = [ ]
@rnd = rand(@ary.length)
so they can be accessed outside of the script block, by the editor

Original thread: https://forums.rpgmakerweb.com/threads/preset-character-names-if-the-input-screen-is-left-blank.100858/