Class Names in Dialogue Boxes

Hello, everyone! I'm back with another question!

Me:  😀

RPG Maker Community:  :headshake:

So! I know of the \P[n] command in text boxes for calling up a party member's name, but I was wondering if there were a similar command that would allow me to pull up a party member's class rather than his name.

The reason for this is that I'm currently working on a superhero-themed project, and I have the characters' names as their real names, and their classes as their heroic codenames. 

Can anyone help me? In exchange, metaphorical cookies for everyone! Chocolate chip ones, too!  
Hello, everyone! I'm back with another question!

Me:  😀

RPG Maker Community:  :headshake:

So! I know of the \P[n] command in text boxes for calling up a party member's name, but I was wondering if there were a similar command that would allow me to pull up a party member's class rather than his name.

The reason for this is that I'm currently working on a superhero-themed project, and I have the characters' names as their real names, and their classes as their heroic codenames. 

Can anyone help me? In exchange, metaphorical cookies for everyone! Chocolate chip ones, too!  
You can create your own variable and set it to text.  I suggest making a common event like this:

Conditional Branch: Eric is Soldier

Control Variable: [001:Actor1's Class_Name] = Solider

Branch End

Conditional Branch: Eric is Monk

Control Variable: [001Actor1's Class_Name] = Monk

Branch End

and so on for all of your classes.

Then you just display that variable into your text by typing \V[1] into your message window after calling this event (you'll want to use the actual number of the variable you decide to use).  That way you don't have to retype a new message every time the actor changes class.  The actual process of setting the variable to text is really simple once you know where to go.  Just go to control variables and at the bottom you'll see a tab labeled Script.  Just click that and type "Solider" into the box, or which ever class you are working on at the time.
It's easier than that.


Control Variables: [0001: Class Name] = Script: $data_classes[$game_actors[n].class_id].name


where n is the id of the actor you want to show.


And then use \v[1] in your text box, as Berylstone indicated.
You can create your own variable and set it to text.  I suggest making a common event like this:

Conditional Branch: Eric is Soldier

Control Variable: [001:Actor1's Class_Name] = Solider

Branch End

Conditional Branch: Eric is Monk

Control Variable: [001Actor1's Class_Name] = Monk

Branch End

and so on for all of your classes.

Then you just display that variable into your text by typing \V[1] into your message window after calling this event (you'll want to use the actual number of the variable you decide to use).  That way you don't have to retype a new message every time the actor changes class.  The actual process of setting the variable to text is really simple once you know where to go.  Just go to control variables and at the bottom you'll see a tab labeled Script.  Just click that and type "Solider" into the box, or which ever class you are working on at the time.
Thanks for the reply, Berylstone! Actually, I'm not sure this helps me in my current predicament, and looking back on my OP, I don't think I explained myself properly. My apologies.

What I'm working on is a common event for when someone uses a save point in my game. The save points are computers, so I've got it displaying text along the lines of:

ACCESSING: Computer Network...

USER NAME: \P[1]

PASSWORD: ***********

 

As things stand, that should call up the name of the player in the first slot of the party, the "leader" of the party, right?

However, what I'm hoping to get the save events to do instead are call up the class names of the person in the first slot of the party. So if my character Bob (class=Superlad) is lead, it'll say "USER NAME: Superlad," but if my character Anna (class=Mega Girl) is lead then the event says "USER NAME: Mega Girl." ((These are not actual names I'm using. I swear, I'm much more creative than that!  🤣 ))

 

Does that all make sense? If it didn't, I'll try again.  🤣
Control Variables: [0001: Class Name] = Script: $data_classes[$game_party.all_members[0].class_id].name
Show Text: ACCESSING: Computer Network...


USER NAME: \v[1]


PASSWORD: ****************
Control Variables: [0001: Class Name] = Script: $data_classes[$game_party.all_members[0].class_id].nameShow Text: ACCESSING: Computer Network... USER NAME: \v[1] PASSWORD: ****************
I wasn't able to put all of that into the script box. It stopped at "[0]." and I can't squeeze the rest in. 
Okay, instead of Control Variables, use Call Script:

$game_variables[1] = $data_classes[$game_party.all_members[ 0].class_id].nameCopy and paste so the line breaks are in the same spots.Then the Show Text will be just the same.
I got an error message:

Script 'Game Event' line 209: AugmentError occured.

comparison with String of 9 failed. 

Did I break it? I broke it, didn't I?  >_>  

You'd think that living with 3 software engineers, some of their knowledge of code would've rubbed off on me. ;_;   
Line 209 of Game_Event is checking event conditions, so make sure the variable you're using for the class name in the script call is ONLY used for that. Make sure you're not using the same variable for other things as well.


Easiest way to check is to assign a NEW variable to the class name (in the variables box, write Class Name DO NOT USE, just to make extra sure), and change the script call above to use $game_variables[n] where n is the variable id, instead of $game_variables[1].
add this somewhere below materials

class Window_Base < Window  def convert_escape_characters(text)    result = text.to_s.clone    result.gsub!(/\\/)            { "\e" }    result.gsub!(/\e\e/)          { "\\" }    result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }    result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }    result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }    result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }    result.gsub!(/\eCL\[(\d+)\]/i) { class_name($1.to_i) }    result.gsub!(/\eG/i)          { Vocab::currency_unit }    result  end    def class_name(n)    actor = n >= 1 ? $game_party.members[n - 1] : nil    actor ? actor.class.name : ""  end endand use \cl[n] to show party member n's class name
Thanks for the reply, Berylstone! Actually, I'm not sure this helps me in my current predicament, and looking back on my OP, I don't think I explained myself properly. My apologies.

What I'm working on is a common event for when someone uses a save point in my game. The save points are computers, so I've got it displaying text along the lines of:

ACCESSING: Computer Network...

USER NAME: \P[1]

PASSWORD: ***********

 

As things stand, that should call up the name of the player in the first slot of the party, the "leader" of the party, right?

However, what I'm hoping to get the save events to do instead are call up the class names of the person in the first slot of the party. So if my character Bob (class=Superlad) is lead, it'll say "USER NAME: Superlad," but if my character Anna (class=Mega Girl) is lead then the event says "USER NAME: Mega Girl." ((These are not actual names I'm using. I swear, I'm much more creative than that!  🤣 ))

 

Does that all make sense? If it didn't, I'll try again.  🤣
It makes sense and I understand better what you mean now.The common event I described will only work for your event if Actor1 is always the party leader.  So if you are wanting to do a conditional branch based on who is the party leader you would have to use Game Data to set a variable to member #1 instead, rather a specific actor.  Or just use scripts - of which I'm woefully inadequate. 

But just in case you want to try the event route, I would think you could write a common event something like this.

Control variables:

[Party:Leader_ID] = Game Data/Member#1's Actor ID

Conditional Branch: [Party:Leader_ID] = 1

Conditional Branch: Actor1 is Solider

Control Variables: [Party Leader's Class_Name] = "Solider"

Branch End

Conditional Branch: Actor1 is Monk

Control Variables: [Party Leader's Class_Name] = "Monk"

Branch End

Branch End

and so on for all your classes.  And since you are wanting to allow different actors in the member#1 slot, you would have to create a new conditional branch for them as well.

Conditional Branch: [Party:Leader_ID] = 2

Conditional Branch: Actor2 is Solider

Control Variables: [Party Leader's Class_Name] = "Solider"

Branch End

Conditional Branch: Actor2 is Monk

Control Variables: [Party Leader's Class_Name] = "Monk"

Branch End

Branch End

and so on again for all of your classes and possible party leaders.  So this could wind up being a pretty big event depending on how many actors and classes you have, and is probably a lot of unnecessary work since there seems to be better script alternatives. 
Success! Thanks, everyone!   😀
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/class-names-in-dialogue-boxes.16862/