I need help with something that involves EXP to Next Level!

Okay, so I'm making a game mechanic for a project called Project T-Rex, and it's for the Gravekeeper in Boria Cemetery. So what I want him to do when you talk to him is to give the player a choice to heal, then he tells you your EXP to next level, and then he "sends" you on your way, but every code I found for EXP to Next Level gave the game an error. I also need help with party members that are in your party and a way to make them appear in text. Is there any way to implement that?
as for the exp part - if you can give us the code you found, we might be able to tell you what is wrong with it.

as for the party members appearing in text - are you talking about their names or do you want to display their faces or what?
Names are easy with the default text codes. for the faces you'll need one of the messaging scripts to add new textcodes with that function to the show text command.
Ruby:
$gameVariables.setValue(1, $gameActors.actor(1).nextRequiredExp());

This is a code I found on another thread and I used a "Set variable" event as "Set variable to (script)". I put that as a common event and the game got an error. If you don't know what powered the parallel process event, it was an invisible event that turned a certain switch on.
As for the party members appearing in text, I'm talking about their names. Example: If one of my characters, Betolka were on the team, it sets Party Member 2 Name to Betolka. Else, it sets it to nothing.
Ruby:
$gameVariables.setValue(1, $gameActors.actor(1).nextRequiredExp());
This looks like JavaScript. In other words, this is code for MV or MZ, but not for the RGSS-based VX Ace.

I'm not very well versed in Ruby or RGSS, and I currently don't have VX Ace installed on my PC to check, but from what little research I've done, I think the correct code for VX Ace should be:

Code:
$game_variables[1] = $game_actors[1].next_level_exp

I don't guarantee this works.
Thanks! I really needed this! It works just fine!
All I need now is Party Member Names depending on which slot they're in and if they're on the team or not. If that's bothers anyone, that's fine. I'll wait patiently.
if they're on the team
Does that account for all members in the party or just the battle members?
Battle members are usually limited to 4, while you can have as many party members as you want.
A process like this can be done, but this example only accounts for one actor and its the first actor (database), not the first battle member or the first party member.
1621909417426.png

If you hover the mouse over the text box window as you're typing the message in, a window pops up telling you some escape codes. that's where the \N[1] comes into play.
$game_party.members[2] ? $game_party.members[2].name : "Unknown"

This will return the name of the third party member if there is one, otherwise it'll give you an "unknown" string.
Double-post notice: @GamoupIndustries

You might be better off using the event commands for who's in the party.

Conditional Branch has a test to let you see if a specific actor is in the party.
Control Variables lets you set a variable to the id of a specific party member (first, second, third, etc). You would need a way to stop if you don't have that many in your party (it might return a 0 as the id in that case).

If you have 7 party members, are you going to display 7 messages?
Do you care what position they're in, or if they're battlers or reserve members (in your party, but not in battles)?
Double-post notice: @GamoupIndustries

You might be better off using the event commands for who's in the party.

Conditional Branch has a test to let you see if a specific actor is in the party.
Control Variables lets you set a variable to the id of a specific party member (first, second, third, etc). You would need a way to stop if you don't have that many in your party (it might return a 0 as the id in that case).

If you have 7 party members, are you going to display 7 messages?
Do you care what position they're in, or if they're battlers or reserve members (in your party, but not in battles)?
The position matters, yes.
Why? We can't help you with the best solution unless we know what you're trying to do.

Actors have names, party members don't - their names are whatever the actor name is who is in that position. Why would it set party 2's name to Betolka if Betolka is actually in position 3?
For example, the team is:
Jorkota
Grikko
Betolka
Rula

It would say:
Jorkota needs 32 EXP to get to level 2.
Grikko needs 32 EXP to get to level 2.
Betolka needs 32 EXP to get to level 2.
Rula needs 32 EXP to get to level 2.

And I switch Betolka with Grikko.
So that makes it:
Jorkota needs 32 EXP to get to level 2.
Betolka needs 32 EXP to get to level 2.
Grikko needs 32 EXP to get to level 2.
Rula needs 32 EXP to get to level 2.

So how would I do that?
Does this work for you?
Ruby:
actor_list = $game_party.all_members
for i in 0..actor_list.size - 1 do
  actor = $game_actors[actor_list[i].id]
  pos = actor.id
  name = actor.name
  current = actor.exp
  nextlevel = actor.next_level_exp
  toget = nextlevel.to_i - current.to_i
  text = "To reach the next level #{name}, you\n" + 
         "must obtain #{toget} experience"
  $game_message.add(text)
end
I put this into a script command for the event.
Does this work for you?
Ruby:
actor_list = $game_party.all_members
for i in 0..actor_list.size - 1 do
  actor = $game_actors[actor_list[i].id]
  pos = actor.id
  name = $game_actors[pos].name
  current = $game_actors[pos].current_level_exp
  nextlevel = $game_actors[pos].next_level_exp
  toget = nextlevel.to_i - current.to_i
  text = "To reach the next level #{name}, you\n" +
         "must obtain #{toget} experience"
  $game_message.add(text)
end
I put this into a script command for the event.
It works! Thanks! Now I can just remove that previous script for EXP to Next Level from the common event and use this one for the gravekeeper!
That's basically all I needed. Thanks again!
It works!
I updated the code, there was an issue that it was always returned the experience of the current level instead of the actors current experience.
level 1 = 0 experience
level 2 = 50 experience

Original thread: https://forums.rpgmakerweb.com/threads/i-need-help-with-something-that-involves-exp-to-next-level.136795/