#===============================================================================
# Scrolling Window_Help
#-------------------------------------------------------------------------------
# Version: 1.1a
# Author: Cozziekuns (rmrk)
# Last Date Updated: 12/6/2011
#===============================================================================
# Description:
#-------------------------------------------------------------------------------
# This script allows you to auto scroll the text in Window_Help if it becomes
# too long for the window to hold. Originally, RPG Maker would auto resize the
# text to make it thin and aesthetically displeasing to the eye.
#===============================================================================
# Updates
# ------------------------------------------------------------------------------
# o 12/06/2011 - Started Script
# o 09/07/2011 - Updated script with a bugfix.
#===============================================================================
# Instructions
# ------------------------------------------------------------------------------
# Copy and paste this script above ? Main Process but below ? Materials, and
# edit the modules to your liking.
#===============================================================================
module COZZIEKUNS
module SCROLLING_WINDOW_HELP
SCROLL_SPEED = 1 # The higher the scroll speed, the faster the text will scroll.
SCROLL_REFRESH_RATE = 1 # The lower the refresh rate, the faster the text will scroll.
SCROLL_INITIAL_WAIT = 60 # The amount of time before the text starts to scroll (in milliseconds)
end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias coz_scrolltxt_wh_14199_initialize initialize
def initialize(*args)
coz_scrolltxt_wh_14199_initialize
@scroll = false
@frames = 0
end
#--------------------------------------------------------------------------
# * Set Text
# text : character string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
if text != @text or align != @align
text_width = contents.text_size(text).width + 40 > self.contents.width - 40
text_width = false if align != 0
if text_width
self.contents = Bitmap.new(self.width + contents.text_size(text).width + 8, self.height - 32)
@scroll = true
else
self.contents = Bitmap.new(self.width - 32, self.height - 32)
@scroll = false
end
self.ox = 0
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, text_width ? self.contents.text_size(text).width : self.width - 40, WLH, text, align)
@text = text
@align = align
@frames = 0
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@frames += 1
f_refresh = COZZIEKUNS::SCROLLING_WINDOW_HELP::SCROLL_REFRESH_RATE
f_wait = COZZIEKUNS::SCROLLING_WINDOW_HELP::SCROLL_INITIAL_WAIT
speed = COZZIEKUNS::SCROLLING_WINDOW_HELP::SCROLL_SPEED
if @scroll == true
if (Graphics.frame_count % f_refresh == 0) and @frames >= f_wait
self.ox += speed
end
if self.ox >= self.contents.text_size(@text).width
self.ox = -self.contents.text_size(@text).width / 2
end
end
end
end