RPG Maker Forums

Hello,

This problem probably has an easy solution but my scripting knowledge isn't great. I'm trying to create a message popup that's identical to the window that pops up when the game changes map and a text is shown in the top-left corner.

In an event I want to call a custom function named create_popup_window("Custom text goes here") and display the custom text in a top-left popup window.

I've written some sort of script but I can't get it to work. Anyone who's kind enough to help and push me in the right direction?

Thanks in advance

The script:

Code:
#==============================================================================# ** #------------------------------------------------------------------------------#  #==============================================================================class Game_Interpreter  def create_popup_window(popup_text)    @popup_text    @map_name_window = Window_Popup.new(popup_text)        #@popup_window = Window_Popup.new  endend#==============================================================================# ** Window_Popup#------------------------------------------------------------------------------#  This window displays a text similar to the Window_MapName class.#==============================================================================class Window_Popup < Window_Base  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  attr_accessor :popup_text    def initialize(popup_text)    super(0, 0, window_width, fitting_height(1))    self.opacity = 0    self.contents_opacity = 0    @show_count = 0    @popup_text    refresh  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width    return 240  end  #--------------------------------------------------------------------------  # * Frame Update  #--------------------------------------------------------------------------  def update    super    if @show_count > 0      update_fadein      @show_count -= 1    else      update_fadeout    end  end  #--------------------------------------------------------------------------  # * Update Fadein  #--------------------------------------------------------------------------  def update_fadein    self.contents_opacity += 16  end  #--------------------------------------------------------------------------  # * Update Fadeout  #--------------------------------------------------------------------------  def update_fadeout    self.contents_opacity -= 16  end  #--------------------------------------------------------------------------  # * Open Window  #--------------------------------------------------------------------------  def open    refresh    @show_count = 150    self.contents_opacity = 0    self  end  #--------------------------------------------------------------------------  # * Close Window  #--------------------------------------------------------------------------  def close    @show_count = 0    self  end  #--------------------------------------------------------------------------  # * Refresh  #--------------------------------------------------------------------------  def refresh      draw_background(contents.rect)      draw_text(contents.rect, popup_text, 1)  end  #--------------------------------------------------------------------------  # * Draw Background  #--------------------------------------------------------------------------  def draw_background(rect)    temp_rect = rect.clone    temp_rect.width /= 2    contents.gradient_fill_rect(temp_rect, back_color2, back_color1)    temp_rect.x = temp_rect.width    contents.gradient_fill_rect(temp_rect, back_color1, back_color2)  end  #--------------------------------------------------------------------------  # * Get Background Color 1  #--------------------------------------------------------------------------  def back_color1    Color.new(0, 0, 0, 192)  end  #--------------------------------------------------------------------------  # * Get Background Color 2  #--------------------------------------------------------------------------  def back_color2    Color.new(0, 0, 0, 0)  endend

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,049
Messages
1,018,547
Members
137,835
Latest member
yetisteven
Top