Save-Point
Scene Display Ex - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker VX/VXAce (RGSS2/3) Engines (https://www.save-point.org/forum-117.html)
+---- Thread: Scene Display Ex (/thread-5073.html)



Scene Display Ex - Mintyy - 03-20-2014

RGSS3 - Scene Display Ex
Author: Soulpour777
Web URL: infinitytears.wordpress.com
Version 1.0
Script Category: Custom Scene

Description:
This script allows you to display different images of different kind, of which it serves as a multipurpose custom scene. It can be a monster book, town book, encyclopedia of items, encyclopedia of people met, notebook or any other types of images you want to display. The script intends to display image rather than a embedded text or graphic is because for the developer to be free on making their designs on the image shown rather than limited graphic shown from the maker.

Usage:
to call the Scene Display Ex, do this script call:
SceneManager.call(Soulpour_SceneDisplay)

Credits:
- Makapri for the art used.

Script:

Code:
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# RGSS3 - Scene Display Ex
# Author: Soulpour777
# Web URL: infinitytears.wordpress.com
# Version 1.0
# Script Category: Custom Scene
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Description:
# This script allows you to display different images of different kind, of which
# it serves as a multipurpose custom scene. It can be a monster book, town book,
# encyclopedia of items, encyclopedia of people met, notebook or any other
# types of images you want to display. The script intends to display image
# rather than a embedded text or graphic is because for the developer to be
# free on making their designs on the image shown rather than limited graphic
# shown from the maker.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Usage:
# to call the Scene Display Ex, do this script call:
# SceneManager.call(Soulpour_SceneDisplay)
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Terms of Use:
# For my terms of use, visit: http://infinitytears.wordpress.com/terms-of-use/
# This script is only for NON COMMERCIAL USE. Contact me for commercial one.
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

# Do not touch this unless you know what you're doing.
$image_displayed = ""

module Soulpour

  module Scene_Display
   
    # This hash contains all the display commands. You can add as many as you
    # want, then define what they would do down on the Soulpour_SceneDisplay.
    Commands = {
   
    "Myalai" => :myalai,
    "Cyclops" => :cyclops,
    "Note" => :booknote
   
    }
   
    # This hash contains all the display images displayed on the Scene Book.
    # It contains images rather than texts because of the better design
    # that can be implemented rather than formatting plain texts on the
    # window.
    Display_Images = {
   
    1 => "Myalai",
    2 => "Cyclops",
    3 => "Book"
   
    }
   
  end

end

#==============================================================================
# ** Soulpour_DisplayCommand
#------------------------------------------------------------------------------
#  This command window appears on the Scene Display screen.
#==============================================================================

class Soulpour_DisplayCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Initialize Command Selection Position (Class Method)
  #--------------------------------------------------------------------------
  def self.init_command_position
    @@last_command_symbol = nil
  end
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # * Get Number of Lines to Show
  #--------------------------------------------------------------------------
  def visible_line_number
    item_max
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
    add_main_commands
  end
  #--------------------------------------------------------------------------
  # * Add Main Commands to List
  #--------------------------------------------------------------------------
  def add_main_commands
    Soulpour::Scene_Display::Commands.each { |key, value|
      add_command(key, value)
    }
  end
  #--------------------------------------------------------------------------
  # * Get Activation State of Save
  #--------------------------------------------------------------------------
  def save_enabled
    !$game_system.save_disabled
  end
  #--------------------------------------------------------------------------
  # * Processing When OK Button Is Pressed
  #--------------------------------------------------------------------------
  def process_ok
    @@last_command_symbol = current_symbol
    super
  end
end

#==============================================================================
# ** Window_SceneDisplay
#------------------------------------------------------------------------------
#  This window displays the Scene Display.
#==============================================================================

class Window_SceneDisplay < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(160, 0, book_window_width, book_window_height)
    refresh
    self.z = 20
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def book_window_width
    Graphics.width - 160
  end
  #--------------------------------------------------------------------------
  # * Get Window Height
  #--------------------------------------------------------------------------
  def book_window_height
    Graphics.height
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
  end
  #--------------------------------------------------------------------------
  # * Open Window
  #--------------------------------------------------------------------------
  def open
    refresh
    super
  end
end

#==============================================================================
# ** Soulpour_SceneDisplay
#------------------------------------------------------------------------------
#  This class performs the Scene Display screen processing.
#==============================================================================

class Soulpour_SceneDisplay < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    @book_screen = Window_SceneDisplay.new
    create_command_display
    display_image_in_window
  end
  #--------------------------------------------------------------------------
  # * Create Command Display
  #--------------------------------------------------------------------------
  def create_command_display
    @display_command = Soulpour_DisplayCommand.new
    @display_command.set_handler(:ok, method(:on_display_ok))
  end

  #--------------------------------------------------------------------------
  # * On Display OK
  # This is where you would edit the functions that would happen when you
  # press the options. Adding is easy, just follow the format of the
  # commands below and add the functions you made or modified from above.
  # display_image_in_window and @display_command.activate must be always
  # present, and redispose should be on top everytime.
  #--------------------------------------------------------------------------
  def on_display_ok
    case @display_command.current_symbol
    when :myalai
      redispose
      $image_displayed = Soulpour::Scene_Display::Display_Images.values[0]
      display_image_in_window
      @display_command.activate
    when :cyclops
      redispose
      $image_displayed = Soulpour::Scene_Display::Display_Images.values[1]
      display_image_in_window
      @display_command.activate
    when :booknote
      redispose
      $image_displayed = Soulpour::Scene_Display::Display_Images.values[2]
      display_image_in_window
      @display_command.activate
    end
  end

  #--------------------------------------------------------------------------
  # * Display Image
  # This is where the displaying of the alternate images is created
  #--------------------------------------------------------------------------   
  def display_image_in_window
    @image_displayed = Plane.new
    @image_displayed.bitmap = Cache.picture($image_displayed)
    @image_displayed.z = 120
  end

  #--------------------------------------------------------------------------
  # * Redispose
  # Redispose means that you need to destroy the image when you press the
  # commands, as to it is already present and create it again to display
  # the image. Once displayed, you need to destroy that image again when
  # you select another command.
  #--------------------------------------------------------------------------   
  def redispose
    @image_displayed.bitmap.dispose
    @image_displayed.dispose
  end

  #--------------------------------------------------------------------------
  # * Update Basic
  #--------------------------------------------------------------------------   
  def update
    update_basic
    if Input.trigger?(:B)
      redispose
      RPG::SE.new("Cancel1",100,100).play
      SceneManager.goto(Scene_Map)
    end
  end

end