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.

Text Entry by Script Calls (Not Quite Solved)

mawk

Sponsor

Since the font I'm using is smaller than the honkin' huge font that comes bundled with the RTP (thanks, Dubealex's AMS!,) there's a little more room in text boxes; however, the size constraints for the Show Text event command don't change at all. Three lines in 22 font isn't three lines in 18, yano?

So what I'm asking you fine folk is how to show text in a dialog box using a script call, as well as any important things that might come with it (for instance, indenting a new line using ":    :," as it does in the event menu.) I'm assuming that such a call would work with any CMS' commands (\a, \., etc.,) but if that's not the case please tell me so I don't wind up wasting time that could be better spent procrastinating.

Normally I'd pull up a couple likely classes in the Script Editor and check out which script command is bound to Show Text, but my screen's cracked and slowly dripping into my hard drive, leaving the bottom third looking like a carelessly vomited Royal Rainbow. This has pretty much put a halt on development, since the majority of windows in RMXP can't be resized, and all store their OK buttons and scroll bars under said Royal Rainbow's domain. So I'm sorry for the inconvenience and the highly inexperienced question, but at least I'll be learning something new about Ruby. XD

EDIT: I'm quite stupid and don't know how to read FAQs.

However, some things in this baffle me.

object.contents.draw_text(x pos, y pos, width, height, text, align)

For instance, what would I place under object?

Erm... That's really my only question. I can get the X and Y position through experimentation.
 

mawk

Sponsor

I'm sorry, but that's not what I asked. XD
If you had a fix that could increase the size of the text entry window itself (in the Show Text event command) that would be awesome, but that I need now is...

[object].contents.draw_text([x pos], [y pos], [width], [height], [text], [align])
^
An idea what to place right there instead of Object. All the bracketed commands are placeholders for actual values that will be used with the actual message window.

Thanks for your effort so far, though.

EDIT: You've given me an idea!
Code:
class Interpreter
  #--------------------------------------------------------------------------
  # * Show Text
  #--------------------------------------------------------------------------
  def command_101
    # If other text has been set to message_text
    if $game_temp.message_text != nil
      # End
      return false
    end
    # Set message end waiting flag and callback
    @message_waiting = true
    $game_temp.message_proc = Proc.new { @message_waiting = false }
    # Set message text on first line
    $game_temp.message_text = @list[@index].parameters[0] + "\n"
    line_count = 1
    # Loop
    loop do
      # If next event command text is on the second line or after
      if @list[@index+1].code == 401
        # Add the second line or after to message_text
        $game_temp.message_text += @list[@index+1].parameters[0] + "\n"
        line_count += 1
      # If event command is not on the second line or after
      else
        # If next event command is show choices
        if @list[@index+1].code == 102
          # If choices fit on screen
          if @list[@index+1].parameters[0].size <= 4 - line_count
            # Advance index
            @index += 1
            # Choices setup
            $game_temp.choice_start = line_count
            setup_choices(@list[@index].parameters)
          end
        # If next event command is input number
        elsif @list[@index+1].code == 103
          # If number input window fits on screen
          if line_count < 4
            # Advance index
            @index += 1
            # Number input setup
            $game_temp.num_input_start = line_count
            $game_temp.num_input_variable_id = @list[@index].parameters[0]
            $game_temp.num_input_digits_max = @list[@index].parameters[1]
          end
        end
        # Continue
        return true
      end
      # Advance index
      @index += 1
    end
  end

That's the part of Interpreter 3 that runs the Show Text command. Is there something in that block of script that would allow me to increase the number of characters allowed on each line, or should I look elsewhere?
 

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