RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
$PLAYER_1 type variable for player names to use in message text?

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 85
The game im working on allows custom player names. Is there a way to use something like "Hello There $PLAYER1" in message text to auto-insert players names?

*
Rep:
Level 87
If the RMVX has the same code as RMXP.

Posted wrong code, go lower for the correct one.
« Last Edit: May 18, 2008, 07:23:39 PM by DeathLockBM »


**
Rep: +0/-0Level 85
Doesnt seem to work, what am I missing?

http://www.neasot.org/pub/ss1.jpg

*
Rep:
Level 87
Sorry about that.

Its suppose to be \n[X]. XD

Use \n[X], X = Actor ID in the database.

So, in the event you use that code for the name, and in the game it will show the name of the player.

Example:
\n[0] shows the name of the first member of the party.
\n[1] shows the name of the first actor in the database.


**
Rep: +0/-0Level 85
The syntax is correct now, but I get a windows error popup window anytime the event is invoked.  :-\

The error is "Script 'Window_Message' line 218: NoMethodError occured. undefined method 'name' for nil:nilclass"

I tried with different combinations of numbers of players in party and all that. No luck.

Thoughts?

*
Rep:
Level 87
Are you using a custom message system script?


**
Rep: +0/-0Level 85
Nope, I'm pretty "default".

*
Rep:
Level 87
Don't know, maybe you should copy all the data from your project into a new project.


*
Full Metal Mod - He will pillage your women!
Rep:
Level 93
The RGSS Dude
Actually, it's the default script's fault. It doesn't include an option to use the 0.

To fix it, go to line 218 in Window_Message and replace it with the following -

Code: [Select]
    @text.gsub!(/\\N\[([0-9]+)\]/i) { if $1.to_i == 0
                                        $game_party.members[$1.to_i].name
                                      else
                                        $game_actors[$1.to_i].name
                                      end }
"The wonderful thing about Tiggers
Is Tiggers are wonderful things
Their tops are made out of rubber
Their bottoms are made out of springs

They’re bouncy, trouncy, flouncy, pouncy
Fun, fun, fun, fun, fun!
But the most wonderful thing about Tiggers
Is I’m the only one, I’m the only one."