Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Show Text Through Scripting

Basta

Member

Is there anyway to emulate the effect of the show text event through scripting?

Also, how do you write four lines into the message box instead of three?
 
...teach a man to fish...

Look in Interpreter 2 for "Show Text"
It will return a method, "command_###"
Now look in Interpreter 3-7 for that method to see what it does.
 
    if $game_temp.message_text != nil
      # End
      return false
    end
 

If there is already a message waiting to display, wait until that one's done (don't worry about this)
# Set message end waiting flag and callback
@message_waiting = true
$game_temp.message_proc = Proc.new { @message_waiting = false }

These are for the interpreter, so it knows a message is displaying, and can continue when the message is canceled. (also, no concern)
# Set message text on first line
$game_temp.message_text = @list[@index].parameters[0] + "\n"

This is the part you care about. @list[@index].parameters[0] is the string of text from the event command. It just assigns that text to
$game_temp.message_text.

So, if you just set:
$game_temp.message_text = "My New Text"

That should do the trick

Remember, if the statement is too long to fit on one line, you'll need to use \ to escape the carriage return.

$game_temp.message_text =\
"My New Text"

If you have more than one line of text for the message box, you'll need to use line-feeds...

$game_temp.message_text =\
"Here is some text. With a whole\n\
bunch of other text to make it a\n\
really long string. Add some more\n\
text to make it 4 lines."
 

Zeriab

Sponsor

As for your second question:
Right click on List of Event commands and click on Batch Text Entry... (shortcut = Ctrl+N like Enter is the shortcut for a new event command)

It is a bit tedious since you can't really edit it afterwards, but at least it allows you 4 lines.
*hugs*
 

SP27

Sponsor

Please allow me to add something to your answer, Zeriab.
There is a little way to edit it.
Say you've finished entering your 4 lined text then there is a way, but that requires some tricky mouse work and blind selecting.

To do so, just move your mouse as far in the lower right corner as you can but stay in the white text zone, click and hold the left mouse button and drag all the way to the upper left corner, if done correctly you should see that you have selected the text, now just press CTRL+X and close the text window, delete it from your event and press CTRL+N to make a new one and copy it into the new text window.

It's still tedious, I know, but it beats re-entering the whole text. :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top