Help - Search - Members - Calendar
Full Version: LAWS: Message on Game Load
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
The Law G14
LAWS: Message on Game Load
By: TheLawG14

Introduction

This is a pretty simple script, it was just based off a request I did for gRaViJa (at HBgames) and I decided to release it to those that want it as well. What it does is show a message after loading a game file (for example: "Welcome Back!") and you can customize how long this message is shown and what is shown.

Features
  • Shows a message after loading a file
  • Can customize how long the message is shown and what the message says
  • Can exit out message more quickly with action button
  • Can change message text depending on progress of game with variable (thanks to Night_Runner)


Screenshots






Demo


None, it's a pretty simple script


Script

Code
CODE
#==============================================================================
# Title: Message on Game Load | Version 1.2
# Author: TheLawG14 [aka. TheScripter]
# Requester: gRaViJa [@ hbgames.org]
#==============================================================================

#==============================================================================
# ** Module LawMessageOnGameLoad
#------------------------------------------------------------------------------
#  This is where you can customize the script for the game.
#==============================================================================

module LawMessageOnGameLoad
  # The text to show at the load screen
  Text = proc {
    # Change the message depending on the progress in the game
    case $game_variables[10] # Variable #10 measures progress (by default)
    when 0..10  then return "The game is still beginning"
    when 11, 12 then return "Prepare to return to battle"
    when 21     then return "Your party needs you"
    else                    "Welcome back Law!"
    end
  }
  # The amount of time the message is displayed on screen
  Wait_Time = 200
end


#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  alias scripter_scene_load_on_decision on_decision
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(*args)
    # Run the original on_decision
    scripter_scene_load_on_decision(*args)
    # If a map was loaded
    if $scene != self
      # Make the welcome back text
      @message_window = Window_LoadMessage.new
      # Loop
      for loop_count in 0..LawMessageOnGameLoad::Wait_Time
        Graphics.update
        Input.update
        break if Input.repeat?(Input::C)
      end
      Graphics.freeze
      @message_window.dispose
    end
  end
end


#==============================================================================
# ** Window_LoadMessage
#------------------------------------------------------------------------------
#  This window displays the loading message
#==============================================================================

class Window_LoadMessage < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @text = LawMessageOnGameLoad::Text.call()
    @text_width = Bitmap.new(32, 32).text_size(@text).width
    super(320 - (@text_width / 2), 208, @text_width + 32, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.z = 999
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, @text_width, 64, @text, 2)
  end
end

#==============================================================================
#
# *** END OF SCRIPT ***
#
#==============================================================================



Instructions

In the top of the script there are two Constant variables that you can edit. Just change them to your liking and the script does the rest.


Compatibility


There shouldn't be an compatibility issues, however if there are, please report them.


Credits and Thanks


Thanks to gRaViJa for the idea and request. Also, a big thanks to Night_Runner for adding in the progress feature where the text changes depending on where you are in the game.


Terms and Conditions

Please just give me credit if you decide to use this, thanks biggrin.gif
Night5h4d3
Simple, and smooth; Looking good Law, welcome back to the wonderful world of ruby!
The Law G14
Thanks! Yep, and its good to be back at scripting biggrin.gif
Holder
Like I said over at HBG this could be used for so many types of RPGs to enhance the theme from the word go happy.gif
Is that script number 17 now?
The Law G14
Thanks again Holder smile.gif And yea, lol I think this is #17 cool.gif
Night_Runner
Welcome back smile.gif

code
CODE
#==============================================================================
# Title: Message on Game Load | Version 1.1n1
# Author: TheLawG14 [aka. TheScripter]
# Requester: gRaViJa [@ hbgames.org]
#==============================================================================

module LawMessageOnGameLoad
  # The text to show at the load screen
  Text = proc {
    # Change the message depending on the progress in the game
    case $game_variables[10] # Variable #10 measures progress (by default)
    when 0..10  then return "The game is still beginning"
    when 11, 12 then return "Prepare to return to battle"
    when 21     then return "Your party needs you"
    else                    "Welcome back Law!"
    end
  }
  Wait_Time = 200
end


#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  alias scripter_scene_load_on_decision on_decision
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(*args)
    # Run the original on_decision
    scripter_scene_load_on_decision(*args)
    # If a map was loaded
    if $scene != self
      # Make the welcome back text
      @message_window = Window_LoadMessage.new
      # Loop
      for loop_count in 0..LawMessageOnGameLoad::Wait_Time
        Graphics.update
        Input.update
        break if Input.repeat?(Input::C)
      end
      Graphics.freeze
      @message_window.dispose
    end
  end
end


#==============================================================================
# ** Window_LoadMessage
#------------------------------------------------------------------------------
#  This window displays the loading message
#==============================================================================

class Window_LoadMessage < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @text = LawMessageOnGameLoad::Text.call()
    @text_width = Bitmap.new(32, 32).text_size(@text).width
    super(320 - (@text_width / 2), 208, @text_width + 32, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.z = 999
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, @text_width, 64, @text, 2)
  end
end

#==============================================================================
#
# *** END OF SCRIPT ***
#
#==============================================================================


It's been strange not seeing you here sad.gif
The Law G14
Woah, that's really neat, man! Thanks! I'll add that to the main script and make sure to credit you. And I'm glad to see you here, Night_Runner! And it is nice to be back lol smile.gif
carnie_natas
wow law you did the siz once more! im going to check this out

edit:any way to center the message box more?
The Law G14
Thanks! The new script version should have the text centered better though, unless your text is really long. Does it stretch from one side of the screen to the other?
carnie_natas
no not that, no matter how long the text size the box it's self begins a little too far to the right on the left side whereas the right side of the text box is even and centered.
The Law G14
I'm still not entirely sure what you mean, can you try to show a screenshot? But until then, this might work if I think I understand what you're problem is. Change line 87 that says :

CODE
self.contents.draw_text(0, 0, @text_width, 64, @text, 2)


to

CODE
self.contents.draw_text(0, 0, @text_width, 64, @text, 1)

carnie_natas
QUOTE (The Law G14 @ Aug 25 2011, 05:07 PM) *
I'm still not entirely sure what you mean, can you try to show a screenshot? But until then, this might work if I think I understand what you're problem is. Change line 87 that says :

CODE
self.contents.draw_text(0, 0, @text_width, 64, @text, 2)


to

CODE
self.contents.draw_text(0, 0, @text_width, 64, @text, 1)





The text box needs to be shifted to the left to center it.
The Law G14
Ah alright, I see what the problem is, this should work:

script
CODE
#==============================================================================
# Title: Message on Game Load | Version 1.2
# Author: TheLawG14 [aka. TheScripter]
# Requester: gRaViJa [@ hbgames.org]
#==============================================================================

#==============================================================================
# ** Module LawMessageOnGameLoad
#------------------------------------------------------------------------------
#  This is where you can customize the script for the game.
#==============================================================================

module LawMessageOnGameLoad
  # The text to show at the load screen
  Text = proc {
    # Change the message depending on the progress in the game
    case $game_variables[10] # Variable #10 measures progress (by default)
    when 0..10  then return "The game is still beginning"
    when 11, 12 then return "Prepare to return to battle"
    when 21     then return "Your party needs you"
    else                    "Welcome back Law!"
    end
  }
  # The amount of time the message is displayed on screen
  Wait_Time = 200
end


#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
#  This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  alias scripter_scene_load_on_decision on_decision
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(*args)
    # Run the original on_decision
    scripter_scene_load_on_decision(*args)
    # If a map was loaded
    if $scene != self
      # Make the welcome back text
      @message_window = Window_LoadMessage.new
      # Loop
      for loop_count in 0..LawMessageOnGameLoad::Wait_Time
        Graphics.update
        Input.update
        break if Input.repeat?(Input::C)
      end
      Graphics.freeze
      @message_window.dispose
    end
  end
end


#==============================================================================
# ** Window_LoadMessage
#------------------------------------------------------------------------------
#  This window displays the loading message
#==============================================================================

class Window_LoadMessage < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @text = LawMessageOnGameLoad::Text.call()
    @text_width = Bitmap.new(32, 32).text_size(@text).width
    super(0, 208, @text_width + 32, 96)
    self.x = 320 - (self.width / 2)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.z = 999
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, @text_width, 64, @text, 2)
  end
end

#==============================================================================
#
# *** END OF SCRIPT ***
#
#==============================================================================
carnie_natas
Perfect as usual! Another masterpiece my friend.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.