Hello, I am using the scrollable text tool posted by Trickster in my RPG. I am trying to make my help windows automatically scroll text but nothinghappens and it remains the same.
Here are the areas that I edited.
At the start of main in Scene_Item:
Instead of making a help window I used the scrollable window.
Also I added the set_text method from Window_Help to the Window_Scrollable script so that the item window would draw text in it.
All that happens when I select items with long descriptions is the text gets compressed and doesnt scroll.
Does anybody know what I am doing wrong? Does the Scrollable text window need to be active? (script is below)
Here's the Window_Scrollable script posted by Trickster.
Here are the areas that I edited.
At the start of main in Scene_Item:
Code:
@help_window = Window_Scrollable.new(0, 0, 640,64)
@help_window.contents_rect = Rect.new(0, 0, 614, 32)
@help_window.horizontal_scroll = true
@help_window.speed = 2
@item_window = Window_Item.new
Also I added the set_text method from Window_Help to the Window_Scrollable script so that the item window would draw text in it.
All that happens when I select items with long descriptions is the text gets compressed and doesnt scroll.
Does anybody know what I am doing wrong? Does the Scrollable text window need to be active? (script is below)
Here's the Window_Scrollable script posted by Trickster.
Code:
#==============================================================================
# ** Window_Scrollable
#------------------------------------------------------------------------------
# This window class contains scroll functions.
#==============================================================================
class Window_Scrollable < Window_Base
attr_accessor :speed
attr_accessor :contents_rect
attr_writer :horizantal_scroll
attr_writer :vertical_scroll
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super(x, y, width, height)
@contents_rect = Rect.new(0,0,width,height)
@speed = 0
@horizantal_scroll = false
@vertical_scroll = false
end
#--------------------------------------------------------------------------
# * Can be moved vertically?
#--------------------------------------------------------------------------
def vertical?
return false if self.contents == nil
return self.contents.height > self.height - 32
end
#--------------------------------------------------------------------------
# * Can be moved horizantally?
#--------------------------------------------------------------------------
def horizantal?
return false if self.contents == nil
return self.contents.width > self.width - 32
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
return if not self.active
if Input.repeat?(Input::UP)
if self.oy > @contents_rect.y and @vertical_scroll and vertical?
self.oy = [self.oy - speed, @contents_rect.y].max
end
end
if Input.repeat?(Input::LEFT)
if self.ox > @contents_rect.x and @horizantal_scroll and horizantal?
self.ox = [self.ox - speed, @contents_rect.x].max
end
end
if Input.repeat?(Input::DOWN)
if self.oy < @contents_rect.height - (self.height - 32) and @vertical_scroll and vertical?
self.oy = [self.oy + speed, @contents_rect.height].min
end
end
if Input.repeat?(Input::RIGHT)
if self.ox < @contents_rect.width - (self.width - 32) and @horizantal_scroll and horizantal?
self.ox = [self.ox - speed, @contents_rect.width].min
end
end
end
end