Calling an Actors Class via Variable

Hi I apologise if this has been asked before, I have seen a couple of threads where they can call an actors class by using a combination of Conditional Branches and Control Variables, but I dont quite understand it and I dont think they fit my purpose.

To start explaining:

I have a Conditional Branch which leads into a choice of Martial, Caster, Hybrid and from there a sub choice in each of three classes.

For example Martial > Paladin, Barbarian, Fighter.
When [Fighter] as the example; the following are triggered;

@>Change Actor Class: [NAME], [Fighter]
@>Control Variables: [7:Class] = 1
@>Text: -,-, Dark, Bottom
: : There can be only one.
: : You are \N[1] the \v[7]

Now naturally this changes the active actor, to the fighter class (in my case this is 1st in the list), then sets Variable 7 to 1.
The text box correctly outputs as You are [NAME] the 1.

I am curious as to how I can get that 1 to be looked up against a list and output the correct class name. ie instead of outputting
You are [NAME] the 1, it out puts [NAME] the [Fighter].

I am trying to do this via variables as this is primarily a practice route for me to see how to convert variables into strings etc,
However doing it this way to me vs using a script to call on the actors class directly, means I can modify the variable for RNG purposes. (Was thinking I could have an NPC incorrectly call someone the wrong class by using the Variable 7 + Rand(5))

I hope this is clear enough to help me further?
You could use a message script, like Yanfly's here or Modern Algebra's here, and then you can use the additional special message codes to write the name of class with ID x.

Alternatively, you can set an additional variable to the name of the class in a script call, like so:
Code:
$game_variables[8] = $data_classes[$game_variables[7]].name
Then it will appear when you use \v[8] in the message box.

EDIT: Or, if you don't want to worry about using lots of variables, you can just do:
Code:
$game_variables[8] = $data_classes[$game_actors[1].class_id].name
That first scriptcall worked excellently thankyou!

So you can see how I used it in my 'test room';

@>Control Variables [0009:1d10] = Random No. (1...10)
@>Script: $game_variables[8] = $data_classes[$game_variables[9]].name
@>Text: -, -, Dark, Bottom

You are \N[1] the \v[8]
REAL Class No. is: \v[7]
Random No. is: \v[9]
Random Class is: \v[8]

@>Script: $game_variables[8] = $data_classes[$game_variables[7]].name
@>Exit Event Processing

Could you for see any potential issues doing it this way later?

Is it essential that I run the Script Call the second time with the correct name variable?
As I imagine without doing so, it will keep Variable 8 stored as what was given in Variable 9 earlier, even if the event ended?
It depends on what you are using it for. You could use one variable to hold the correct class name and another to hold the random class name if you didn't want to accidentally mix them up.

Original thread: https://forums.rpgmakerweb.com/threads/calling-an-actors-class-via-variable.115701/