Joined
Aug 13, 2019
Messages
31
Reaction score
4
First Language
english
Primarily Uses
RMVXA
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
3,284
Reaction score
758
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

Even though I spent 100's of dollars on my game already. I think I might just have to give it away for free. Since I haven't heard back from people if I could use some of their graphics. Even from a global mod here. Maybe I can make a donation thing.
you know, some days you get resentful that game dev is even considered a "fun job" and other days it's like, welp, time to roll up my sleeves and code these molotov cocktails
If you suck at playing trumpets, that is probably why.
Been sick with a stomach virus for seven days now. Not going to work tomorrow because I'm still contagious according to my doctor.
Much as I love my job, I really hate playing "office politics". It would be nice if I didn't have to pretend to be someone else all day long.

Forum statistics

Threads
115,960
Messages
1,094,406
Members
151,231
Latest member
DadOfSpaceMonkey
Top