Já viram qual a arte dessa semana?Exposição dos Artistas #8
2 Respostas   205 Visualizações
0 Membros e 1 Visitante estão vendo este tópico.
#==============================================================================# XaiL System - History Book# Author: Nicke# Created: 31/12/2012# Edited: 04/01/2013# Version: 1.0a#==============================================================================# Instructions# -----------------------------------------------------------------------------# To install this script, open up your script editor and copy/paste this script# to an open slot below ? Materials but above ? Main. Remember to save.#==============================================================================# Requires: XS - Core Script.#==============================================================================## This script adds a new scene to your game, which can be called by the# following script call:# SceneManager.call_ext(Scene_HistBook, :symbol)## Example:# SceneManager.call_ext(Scene_HistBook, :ancient_book)## Basicially you call the scene with the book you want the player to see.# In the above example ancient_book is used. Those books can be edited below# in the settings module.## Each book can have unlimited pages.# Font and skin settings for the window can be changed.## *** Only for RPG Maker VX Ace. ***#==============================================================================($imported ||= {})["XAIL-HISTORY-BOOK"] = truemodule XAIL module HIST_BOOK #--------------------------------------------------------------------------# # * Settings #--------------------------------------------------------------------------# # FONT: # FONT = [name, size, color, bold, shadow] FONT = [["Calibri", "Verdana"], 18, Color.new(255,255,255), true, true] # Setup the books. # :title => [page1, page2, page3...] # In the array for pages you can use the following to output a string: # %{Some text}, "Some text" etc. # The title will be converted, capitalized and any underlines will # be removed. #--------------------------------------------------------------------------# BOOKS = { # EXAMPLE 1. :ancient_book => [%{Oh haaai... Latin text!Qui id vide molestie, graeco evertitur conceptam at est. Te vis erant convenire, wisividisse expetendis mea ex, eos in dicant graeco. Eum eu novum decore, ei qui mundi labitur inciderint, eam ne partem nullam. Eam mutat aeque fabulas in. Quisconsequat cu est, soluta iriure no cum, ad pro feugiat perpetua. Id mel wisi ridensreprimique, no has adhuc affert.}, %{This is the next page. Fantastic right?}, %{Yet another page... Awesome.}], # EXAMPLE 2. :a_history_of_madness => [%{Testing with some 'quotes'. This doesn't "work" or?!}], } # Don't remove this line! #--------------------------------------------------------------------------# # Change page text. # PAGE_TEXT = string PAGE_TEXT = "Change page with Left/Right buttons." # Single page text. # SINGLE_TEXT = string SINGLE_TEXT = "" # Use default background. (snapshot of the map) # BACK = true/false BACK = true # Custom background. # CUST_BACK = [filename, hide_window] # Optional to use, set filename to "" to disable. CUST_BACK = ["", false] # SKIN: # The windowskin to use for the windows. # Set to nil to disable. # SKIN = string SKIN = nil endend# *** Don't edit below unless you know what you are doing. ***#==============================================================================## ** Error Handler#==============================================================================# unless $imported["XAIL-XS-CORE"] # // Error handler when XS - Core is not installed. msg = "The script %s requires the latest version of XS - Core in order to function properly." name = "XS - History Book" msgbox(sprintf(msg, name)) exit end#==============================================================================## ** Window_HistoryBook#==============================================================================#class Window_HistoryBook < Window_Command def initialize(x, y) # // Method to initialize the window. super(x, y) @page = 1 end def window_width # // Method to return the width. return Graphics.width end def window_height # // Method to return the height. return Graphics.height end def set_book(book) # // Method to set book. if book != @book @book = book refresh end end def change_page(page) # // Method to change page. if page != @page @page = page refresh end end def refresh # // Method to refresh the window. super contents.clear unless @book.nil? draw_book draw_details end end def draw_book # // Method to draw the tp text to the window. title = @book.to_s.slice_char("_").cap_words text = XAIL::HIST_BOOK::BOOKS[@book][@page - 1] # // Title. draw_font_text(title, 0, 0, contents_width, 1, XAIL::HIST_BOOK::FONT[0], 30, XAIL::HIST_BOOK::FONT[2]) # // Line. draw_line_ex(0, 22, Color.new(255,255,255), Color.new(0,0,0)) # // Book text. draw_font_text_ex(text, 0, 36, XAIL::HIST_BOOK::FONT[0], XAIL::HIST_BOOK::FONT[1], XAIL::HIST_BOOK::FONT[2]) end def draw_details # // Method to draw details. current_page = @page.to_s max_page = XAIL::HIST_BOOK::BOOKS[@book].size.to_s page = "Page: " + current_page + " / " + max_page # // Line. draw_line_ex(0, contents_height - 36, Color.new(255,255,255), Color.new(0,0,0)) if XAIL::HIST_BOOK::BOOKS[@book].size > 1 # // Change page text. page_text = XAIL::HIST_BOOK::PAGE_TEXT draw_font_text(page_text, 0, contents_height - calc_line_height(page_text), contents_width, 0, XAIL::HIST_BOOK::FONT[0], 20, XAIL::HIST_BOOK::FONT[2]) # // Current page and max page. draw_font_text(page, 0, contents_height - calc_line_height(page), contents_width, 2, XAIL::HIST_BOOK::FONT[0], 20, XAIL::HIST_BOOK::FONT[2]) else # // Single page text. single_text = XAIL::HIST_BOOK::SINGLE_TEXT draw_font_text(single_text, 0, contents_height - calc_line_height(single_text), contents_width, 0, XAIL::HIST_BOOK::FONT[0], 20, XAIL::HIST_BOOK::FONT[2]) end end end#==============================================================================## ** Scene_HistBook#==============================================================================#class Scene_HistBook < Scene_Base def initialize(book = nil) # // Method to initialize the scene. super @book = book end def start # // Method to start the scene. super @page = 1 create_history_window create_background if XAIL::HIST_BOOK::BACK create_custom_background unless XAIL::HIST_BOOK::CUST_BACK[0] == "" end def create_background # // Method to create a background. @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set(16, 16, 16, 128) end def create_custom_background # // Method to create a custom background. begin @custom_background = Sprite.new @custom_background.bitmap = Cache.picture(XAIL::HIST_BOOK::CUST_BACK[0]) rescue msgbox("Error! Unable to locate the custom background: " + XAIL::HIST_BOOK::CUST_BACK[0]) exit end end def valid_book? # // Method to check if book is valid. (included in book list) # // Return (skip it) if included else show error. return if XAIL::HIST_BOOK::BOOKS.include?(@book) msgbox("Error! The book " + @book.to_s + " is not added in the list.") exit end def create_history_window # // Method to create command list window. # // Check first if book is a valid one, i.e it is added in the book list. valid_book? @history_window = Window_HistoryBook.new(0, 0) @history_window.opacity = 0 if XAIL::HIST_BOOK::CUST_BACK[1] @history_window.windowskin = Cache.system(XAIL::HIST_BOOK::SKIN) unless XAIL::HIST_BOOK::SKIN.nil? # // Add page left/right methods if a book have more then one page. if XAIL::HIST_BOOK::BOOKS[@book].size > 1 @history_window.set_handler(:pageright, method(:next_page)) @history_window.set_handler(:pageleft, method(:prev_page)) end @history_window.set_handler(:cancel, method(:return_scene)) @history_window.set_book(@book) @history_window.unselect end def next_page # // Method to select next page. @page += 1 unless @page == XAIL::HIST_BOOK::BOOKS[@book].size @history_window.activate @history_window.change_page(@page) end def prev_page # // Method to select previous page. @page -= 1 unless @page == 1 @history_window.activate @history_window.change_page(@page) endend # END OF FILE#=*==========================================================================*=## ** END OF FILE#=*==========================================================================*=#