Cerca nel Forum
Showing results for tags 'Scrolling Description Text'.
Trovato 1 risultato
-
Nome script: Scrolling Description Text Versione: Rgss2 Autore: BigEd781 Informazioni: Quante volte avete scritto le descrizioni degli oggetti e non c'era lo spazio necessario e quindi dovevate ridurre le parole all'osso?Ora con questo script il testo potrà scorrere e voi potrete scrivere quello che vorrete. Screenshots: N/A in fondo è solo un testo che scorre Istruzioni: Potrete cambiare le impostazioni di scorrimento cambiando queste righe di testo: @@SCROLL_DELAY = 3 # seconds@@SCROLL_SPEED = 1 # pixels / frame (60 frames / sec)@@SHOW_ICONS = true # display icons for items and skills? Script:[/b[ class Sprite def draw_icon(icon_index, x, y, enabled = true)bitmap = Cache.system("Iconset")rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)self.bitmap.blt(x, y, bitmap, rect, enabled ? 255 : 128) endendclass Window_Help < Window_Base @@SCROLL_DELAY = 2 # seconds @@SCROLL_SPEED = 1 # pixels / frame (60 frames / sec) @@SHOW_ICONS = true # display icons for items and skills? alias :scroll_init :initialize def initialize(*args)scroll_init(*args)@internal_frame_count = 0@text_is_long = false@icon_sprite = Sprite.new@icon_sprite.x = self.x + 16@icon_sprite.y = self.y + 16@icon_sprite.z = self.z + 1@icon_sprite.bitmap = Bitmap.new(32, 32)self.windowskin = get_altered_skin end def get_altered_skindefault = Cache.system('Window')window = Bitmap.new(default.width, default.height)window.blt(0, 0, default, default.rect)window.fill_rect(80, 16, 32, 32, Color.new(0,0,0,0))return window end def set_text(text, align = 0)unless (text == @text) && (align == @align) @internal_frame_count = 0 txt_width = self.contents.text_size(text).width @text_is_long = txt_width > (self.width - 32) self.contents.dispose w = @text_is_long ? (txt_width + self.width - 32) : self.width - 32 self.contents = Bitmap.new(w, self.height - 32) self.contents.clear self.ox = 0 self.contents.font.color = normal_color i = get_icon_index(text) unless i.nil?draw_sprite(i, 0, 0)self.contents.draw_text(32, 0, self.contents.width, WLH, text, align) else@icon_sprite.bitmap.clearself.contents.draw_text(4, 0, self.contents.width, WLH, text, align) end @text = text @align = alignend end def draw_sprite(icon_index, x, y)@icon_sprite.bitmap.clear# get the background image at 'rect'# so that text does not appear under the iconbitmap = Graphics.snap_to_bitmaprect = Rect.new(@icon_sprite.x, @icon_sprite.x,@icon_sprite.bitmap.width, @icon_sprite.bitmap.height)@icon_sprite.bitmap.blt(x, y, bitmap, rect)@icon_sprite.draw_icon(icon_index, x, y) end def get_icon_index(desc)return nil unless @@SHOW_ICONS$data_items.each do |item| return item.icon_index if !item.nil? && item.description == descend$data_weapons.each do |weapon| return weapon.icon_index if !weapon.nil? && weapon.description == descend$data_armors.each do |armor| return armor.icon_index if !armor.nil? && armor.description == descend$data_skills.each do |skill| return skill.icon_index if !skill.nil? && skill.description == descendreturn nil end def updatesuper@internal_frame_count += 1if ((@internal_frame_count > @@SCROLL_DELAY * 60) && @text_is_long) if self.ox >= (self.contents.width - self.width + 48) self.ox = 0@internal_frame_count = 0 else self.ox += @@SCROLL_SPEED endend end def disposesuper@icon_sprite.dispose endend