Kain Nobel
Member
Good day everybody!
I got home from work and tried to make the "Scroll Status Display" script by Seph universal for any window that calls 'draw_actor_state' instead of the way he has it setup for the default main menu and the default battle. Since I don't have time to work on this since I have to get up in 4 hours, I figured I'd just post it here and see if one of you can fix the rest for me. Here's what hasn't been fixed.
I can't think of any other bugs, but this should be pretty simple if anybody wants to make a fix for me or tell me how to fix it. See ya'll tomorrow (today?) I'm off to bed so I can get up for work.
PS : The Plane_ScrollStatus was taken directly from Seph's script and hasn't been changed whatsover, I just deleted the comments.
I got home from work and tried to make the "Scroll Status Display" script by Seph universal for any window that calls 'draw_actor_state' instead of the way he has it setup for the default main menu and the default battle. Since I don't have time to work on this since I have to get up in 4 hours, I figured I'd just post it here and see if one of you can fix the rest for me. Here's what hasn't been fixed.
- Scroll states aren't drawn anywhere NEAR where a normal state would be drawn.
- When moving a window, scroll states stay in the same spot they were called at instead of going with the window.
I can't think of any other bugs, but this should be pretty simple if anybody wants to make a fix for me or tell me how to fix it. See ya'll tomorrow (today?) I'm off to bed so I can get up for work.
Code:
#===============================================================================
# ~** Universal Scroll States **~
#-------------------------------------------------------------------------------
# Written by : Kain Nobel
# Version   : 0.0
# Last Update : 09.08.2008
#-------------------------------------------------------------------------------
# * Credits  : Plane_ScrollStatus was created by SephirothSpawn.
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
SDK.log('Window.ScrollStates', 'Kain Nobel', 0.0, '09.08.2008')
#-------------------------------------------------------------------------------
# * SDK Enabled Log - BEGIN
#-------------------------------------------------------------------------------
if SDK.enabled?('Window.ScrollStates') && defined?(MACL) && MACL.is_a?(Module)
#===============================================================================
# ** Plane_ScrollStatus
#-------------------------------------------------------------------------------
#Â Â This is an object scrolls the status display seamlessly.
#===============================================================================
class Plane_ScrollStatus < Plane
 #--------------------------------------------------------------------------
 # * Show Icons When Avialable
 #--------------------------------------------------------------------------
 Show_Icons = true
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :actor
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(actor_index, x, y, w, h, z = 105)
  v = Viewport.new(x, y, w, h)
  v.z = z
  super(v)
  if actor_index.is_a?(Numeric) ; @actor = $game_party.actors[actor_index]
  else             ; @actor = actor_index
  end
  update
 end
 #--------------------------------------------------------------------------
 # * Frame Update
 #--------------------------------------------------------------------------
 def update
  unless @states == @actor.states
   @states = @actor.states.dup
   unless self.bitmap.nil?
    self.bitmap.dispose
    self.bitmap = nil
   end
   s_names, i_names = [], []
   for i in @states
    if Show_Icons && $data_states[i].icon != nil
     s_names << nil
     i_names << $data_states[i].icon_name
     next
    end
    s_names << $data_states[i].name
   end
    if s_names.empty?
    if Show_Icons && RPG::State.normal_icon != nil
     s_names << nil
     i_names << RPG::State::Normal_Icon
    else
     s_names << 'Normal'
    end
   end
   has_icons = i_names.size > 0
   string = Show_Icons && has_icons ? '' : '['
   for s in s_names
    if s.nil?
     string += " [#{i_names.shift}]"
     next
    end
    string += " #{s}"
   end
   string += ' ]' unless Show_Icons && has_icons
   if Show_Icons && has_icons
    text, icons = Bitmap.string_to_text_icons(string)
    ox = Bitmap.icon_text_sizes(text, icons)[3]
   else ; ox = Bitmap.text_size(string).width
   end
   bitmap = Bitmap.new(ox + self.viewport.rect.width, 32)
   if Show_Icons && has_icons
    bitmap.draw_icon_text(0, 0, ox, 32, string)
   else
    bitmap.draw_text(0, 0, ox, 32, string)
   end
   self.bitmap = bitmap
  end
  self.ox += 1
 end
end
#===============================================================================
# ** Window_Base
#-------------------------------------------------------------------------------
#Â Â This superclasses' normal methods have been enhanced to handle the Scroll
# Status display.
#===============================================================================
class Window_Base < Window
 #-----------------------------------------------------------------------------
 # * Alias Listings
 #-----------------------------------------------------------------------------
 alias_method :scroll_states_window_base_update,  :update
 alias_method :scroll_states_window_base_dispose, :dispose
 alias_method :scroll_states_draw_actor_state,   :draw_actor_state
 #-----------------------------------------------------------------------------
 # * Update
 #-----------------------------------------------------------------------------
 def update
  unless @scroll_states.nil?
   @scroll_states.each {|state| state.update}
  end
  scroll_states_window_base_update
 end
 #-----------------------------------------------------------------------------
 # * Dispose
 #-----------------------------------------------------------------------------
 def dispose
  unless @scroll_states.nil?
   @scroll_states.each {|state| state.dispose}
  end
  scroll_states_window_base_dispose
 end
 #-----------------------------------------------------------------------------
 # * Draw Actor State
 #-----------------------------------------------------------------------------
 def draw_actor_state(actor, x, y, width = 128, height = 32, z = 105)
  if defined?(Plane_ScrollStatus)
   @scroll_states = []
   @scroll_states << Plane_ScrollStatus.new(actor, x, y, width, height, z)
  else ; scroll_states_draw_actor_state(actor, x, y)
  end
 end
end
#-------------------------------------------------------------------------------
# * SDK Enabled Test - END
#-------------------------------------------------------------------------------
end
PS : The Plane_ScrollStatus was taken directly from Seph's script and hasn't been changed whatsover, I just deleted the comments.