How to Text Message via script? [RPG Maker XP]

The answer is:
Code:
$game_temp.message_text = "your text here"
I don't get why this was so hard to answer.

All I'm wondering is how I write script in RPG Maker XP to call for a Text Message Box with text to appear... Next step is to have it display a variable's value. I haven't found an answer as of yet.
Moved to: RGSSx Script Support

(Scripts is where you share scripts you have written)

Why do you want to do it via a script? You can add variables to a text box using the Show Text command.
Why do you want to do it via a script?
Because there are endless situations where you want a text message to appear during the run of a script... Right now I would like to call a Message Box during a battle. I presume I wanna use the Window_Message class but I honestly don't see a method for writing text with.
That doesn't explain why you want to use a script. You can make message boxes appear during battle, by using the Show Text command in the event commands in the Troops tab.

Can you show a screenshot of what you've already got, and where you want to insert this message box? I am not sure if you really are making a script, or if you are just doing event commands and want to use a script call to show a message box rather than the Show Text command.

In either case, if you really are scripting, this thread is exactly where it needs to be - unless you are actually asking someone to write a script for you, and it doesn't sound like you are.
1627040493716.png

Exactly here I want to call for a Text Message Box that shows the text. It should disappear when the player presses a button just like a regular text message.
Thanks a lot @gman! I was trying to do this and I imagined there should be an easy way to do it, as you pointed out.

Cheers.
View attachment 196491
Exactly here I want to call for a Text Message Box that shows the text. It should disappear when the player presses a button just like a regular text message.
Closest thing I could find is this: https://www.neoseeker.com/forums/22121/t742558-message-window/
First you edited your first post and left a curious piece of code there.

$game_temp.message_text = "Type something here!"

You had also revealed your motivation to ask us for such a solution here:

Because there are endless situations where you want a text message to appear during the run of a script... Right now I would like to call a Message Box during a battle. I presume I wanna use the Window_Message class but I honestly don't see a method for writing text with.

Even if the line of code above DOES work as you might have intended, it's not your best shot at all. The script edit is hard to mantain or look for if some day you take a long break and forget that you have ever altered that method.

First of all, you need to alter the state_plus method that isn't very modular at all. This means that future scripts or even existing scripts could overwrite it at any given time, preventing you from either setting the text message or getting any other additional effects the other scripts had to offer.

Second you can actually achieve the same goal via a Common Event by setting the one to be called by a skill or item at any given time during gameplay.

Third on the Common Events tab you can simply pick a common event and open a Show Text command and edit it at will and press F2 and see how it would look like ingame. It's impossible to view it while editing the state_plus method.

My Advice​

So my serious recommendation is to leave the original state_plus method unaltered and go set a common event either at the Skill or Item database. Then you can edit the common event's Show Text command as many times as needed and you will be always able to fix anything that is wrong there.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-text-message-via-script-rpg-maker-xp.138757/