Joined
Aug 13, 2019
Messages
101
Reaction score
15
First Language
english
Primarily Uses
RMMV
how to display text on screen without using message box? but anywhere on the screen.

The problem with message boxes is that it only limits you to showing text above, in the middle and below the screen and you must press Enter to continue the event process.

Is there a way to display a text anywhere on the screen?

Thank you
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
4,827
Reaction score
1,372
First Language
English
Primarily Uses
RMVXA
MOG - Event Text
Efeberk - Show textbox
Meowface - Display quick text
Nelderson - Text over event

From your request I would guess that efeberk's show text box would fit best with a modification to it for displaying at specific location.
The others use events to locate the text or a specific location

*update, I tested the script it does input not text.
I may be able to change it to show text. I'll work on it later.

Does this fit your needs?
Ruby:
# Coder : efeberk
# Mod : Roninator2
#
# Show text box with a message
#
# Script call:
# show_textbox(x, y, width, height, variable, title = nil, txt = "Hello!")
#
# x : X position for the window
# y : y position for the window
# height : message window height
# width : message window width
# variable : which variable will be used to display text, 0 = not used
# title : optional
# txt : text to display if variable is not used.
#
# Sample : show_textbox(120, 50, 270, 48, 0, "PIN Code", "Looks like it says 25871")
# Sample : show_textbox(120, 50, 270, 48, 10, "PIN Code", "")
# Variable 10 = "Looks like it says 25871"

class Window_TextBox < Window_Base
 
  attr_accessor :enabled
  attr_reader :finished
 
  def initialize(x, y, width, height, var, title, txt)
    @txt = txt
    @var = var
    @title = title
    @x = x
    @y = y
    @width = width
    @finished = false
    super(x, y, width, height)
  end
 
  def update
    self.contents.clear
    update_textbox if @var != 0 || @txt != ""
    update_keyboard
  end
 
  def update_keyboard
    if Input.trigger?(:C)
      @finished = true
      @text = ""
    end
  end
 
  def update_textbox
    if @var != 0
      draw_text_ex(@width / 2 - @var.size * 6, 0, @var)
    else
      draw_text_ex(0, 0, @txt)
    end
  end
 
end

class Scene_TextBox < Scene_Base
 
  def prepare(x, y, width, height, var, title, txt)
    @x, @y, @width, @height, @var, @title, @txt = x, y, width, height, $game_variables[var.to_i], title, txt
  end
 
  def start
    super
    create_background
    create_textbox
  end
    
  def create_background
    @background_sprite = Spriteset_Map.new
  end
 
  def create_textbox
    if @title
      @header = Window_Base.new(@x+@width/2-@title.size*6, @y-48, @title.size*12, 48)
      @header.draw_text(0, 0, @header.contents_width, @header.contents_height, @title, 1)
    end
    @textbox = Window_TextBox.new(@x, @y, @width, @height, @var, @title, @txt)
  end
 
  def update
    super
    if @textbox.finished then return_scene end
  end
 
end

class Game_Interpreter
 
  def show_textbox(x, y, width, height, var = 0, title = nil, txt = "")
    SceneManager.call(Scene_TextBox)
    SceneManager.scene.prepare(x, y, width, height, var, title, txt)
    Fiber.yield while SceneManager.scene_is?(Scene_TextBox)
  end

end
 
Last edited:

Latest Threads

Latest Posts

Latest Profile Posts

oneOfUs.jpg
Streaming more Poppet Quest game even in about 12 minutes.
Some dog owners really impress me. I'm pushing 2-3 metric tons of garbage containers that destroy everything they hit. What do you think is going to happen to your tiny dog when I run it over? And why are you crossing my path to argue with me? Have you never been hit by 200kgs of garbage?

Lesson for you folks. Never mess with an angry garbage container. Or its driver.
I didn't dispose of a file properly and now my whole game won't start: I get a script error in the Scene Manager stage of game launch. What to do? Transfer it all to a new project? That's going to be tedious. Fortunately I am only nine workdays into it.
>< IMGUR!!!! *clenches fist*

Forum statistics

Threads
131,680
Messages
1,222,158
Members
173,425
Latest member
gem1win
Top