Akianzax

AR3 ~ Syntax

Jul 1st, 2014
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.33 KB | None | 0 0
  1. #                            ~ Akian~RGSS3 ~
  2.  
  3. # Nombre del script: AR3 ~ Syntax
  4. # Scripter: Akian~RGSS3
  5. # Requiere?: Nada :3
  6. # Versión: 1.4
  7.  
  8. # Historial:
  9. # 1.0 Comienzo y Finalización del script
  10. # 1.1 Posibilidad de cambiar el texto mediante script call
  11. # 1.2 Mejora de frames
  12. # 1.3 Edición de fuente y tamaño
  13. # 1.4 Mejora del modulo
  14.  
  15. # Este script se cambió totalmente desde la versión 1.1
  16. # Antes solo mostraba un texto pero ahora te da la posibilidad
  17. # de cambiar ese texto por medio de un script call
  18. # Setea el texto que quieras mostrar y la posición en la region editable
  19. # luego con los siguientes scripts calls podrás cambiar el texto en el momento
  20. # que lo necesites
  21.  
  22. # ~ ~ Script Call ~ ~
  23. #  change_syntax_text("Texto")    Cambia el primer texto mostrado
  24. #  change_syntax_text_2("Texto")  Cambia el segundo texto mostrado
  25.  
  26. #==============================================================================
  27. # Condiciones de uso:
  28. # Puedes usar libremente este script en proyectos comerciales y no comerciales
  29. # Los créditos son requeridos, por el trabajo, el esfuerzo, el sudor, bueno no
  30. # tanto por el sudor.
  31. # Si posteas este script en algún foro debes señalar la página oficial
  32. # http://akianzax.wix.com/akian-rgss3
  33. # También nombrar la página en los créditos si lo usas para un proyecto.
  34. #==============================================================================
  35.  
  36. $imported = {} if $imported.nil?
  37. $imported["AR3_Syntax"] = true
  38.  
  39. module AR3
  40.   module SYNTAX  
  41.    
  42. #==============================================================================
  43. #
  44. #                         REGION EDITABLE
  45. #
  46. #==============================================================================
  47.     FONT_NAME   = "Comic Sans Ms"  # Fuente
  48.     FONT_SIZE   = 18       # Tamaño de fuente
  49.    
  50. #                   Texto                   x       y  
  51.     LINEA1      = ["Texto texto texto",     0,    -35]
  52.     LINEA2      = [nil,                     0,    -15]
  53. # Dejar nil en el texto si no se quiere poner nada o simplemente ""
  54.    
  55.     COLOR1      = 18  # Color de la linea 1
  56.     COLOR2      = 18  # Color de la linea 2
  57.    
  58. # Colores 0 = Blanco || 1 = Celeste || 2 = Rojo || 3 = Verde || 4 = Celeste(Claro)
  59. # 5 = Lila || 6 = Amarillo || 7 = Gris(Oscuro) || 8 = Gris ||  9 = Azul
  60. # 10 = Rojo(Fuerte) || 11 = Verde(Fuerte) || 12 = Azul(Fuerte) || 13 = Violeta
  61. # 14 = Naranja || 15 = Negro || 16 = Lila(Suave) || 17 = Amarillo
  62. # 18 = Rojo || 19 = Negro || 20 = Marron || 21 = Marron(Claro) || 22 = Azul(Agua)
  63. # 23 = Celeste(Fuerte) || 24 = Verde(Claro) || 25 = Marron(Raro)
  64. # 26 = Violeta || 27 = Rosado || 28 = Verde(Fuerte) || 29 = Verde(Claro)
  65. # 30 = Violeta(Fuerte) || 31 = Violeta(Suave)
  66. # Esto teniendo el windowskin normal, con otros puede ser igual o no, prueben.
  67.  
  68.     SWITCH_ID      = 5    # Switch que activará y desactivará el script
  69.                           # Dejarlo en cero para usarlo siempre
  70.                      
  71. #==============================================================================
  72. #
  73. #                      FIN DE LA REGION EDITABLE
  74. #
  75. #==============================================================================
  76.   end
  77. end
  78.  
  79. # Tocarás algo a partir de aquí?
  80. # Pium pium, muere muere.
  81.  
  82.  
  83. #==============================================================================
  84. # ** Scene_Map
  85. #------------------------------------------------------------------------------
  86. #  This class performs the map screen processing.
  87. #==============================================================================
  88.  
  89.  
  90. class Scene_Map < Scene_Base
  91. # Incluyendo modulo
  92.  include AR3::SYNTAX
  93. # Método de alias
  94.  alias akian_syntax_start_zack    start
  95.  alias akian_syntax_update_zack   update
  96. #--------------------------------------------------------------------------
  97. # ▼ Proceso de comienzo
  98. #--------------------------------------------------------------------------
  99.   def start
  100.     akian_syntax_start_zack
  101.     create_syntax_window
  102.     end
  103. #--------------------------------------------------------------------------
  104. # ▼ Seteando Syntax Window
  105. #--------------------------------------------------------------------------  
  106.    def create_syntax_window
  107.     @syntax_text = Window_Syntax.new
  108.     @syntax_text.set_texto
  109.     @syntax_text.visible = $game_switches[AR3::SYNTAX::SWITCH_ID] || AR3::SYNTAX::SWITCH_ID == 0
  110.   end  
  111.  
  112. #--------------------------------------------------------------------------
  113. # ▼ Actualización
  114. #--------------------------------------------------------------------------
  115.    def update
  116.      akian_syntax_update_zack
  117.      syntax_update
  118.    end
  119.    
  120.    def syntax_update
  121.     @syntax_text.visible = $game_switches[AR3::SYNTAX::SWITCH_ID] || AR3::SYNTAX::SWITCH_ID == 0
  122.     @syntax_text.set_texto
  123.     return
  124.     end
  125.   end
  126.  
  127. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  128. # Class Window
  129. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  130. class Window_Syntax < Window_Base
  131.  
  132. #--------------------------------------------------------------------------
  133. # ▼ Proceso de initialize
  134. #--------------------------------------------------------------------------
  135.   def initialize
  136.     super(0, 0, Graphics.width, 100)
  137.     self.opacity = 0
  138.   end
  139.  
  140. #--------------------------------------------------------------------------
  141. # ▼ Frame Update
  142. #--------------------------------------------------------------------------
  143.   def update
  144.   end
  145. #--------------------------------------------------------------------------
  146. # ▼ Seteando texto
  147. #--------------------------------------------------------------------------  
  148.   def set_texto
  149.     contents.font.name = AR3::SYNTAX::FONT_NAME
  150.     contents.font.size = AR3::SYNTAX::FONT_SIZE
  151.     contents.clear
  152.     change_color(text_color(AR3::SYNTAX::COLOR1))
  153.     draw_text($game_system.syntax_text_1, AR3::SYNTAX::LINEA1[1], AR3::SYNTAX::LINEA1[2], Graphics.width, 100, 0)
  154.     change_color(text_color(AR3::SYNTAX::COLOR2))
  155.     draw_text($game_system.syntax_text_2, AR3::SYNTAX::LINEA2[1], AR3::SYNTAX::LINEA2[2], Graphics.width, 100, 0)
  156.   end
  157.  
  158. #--------------------------------------------------------------------------
  159. # ▼ Dibujando el texto
  160. #--------------------------------------------------------------------------  
  161.   def draw_text(text, x, y, width, height, alignment)
  162.     contents.draw_text(x, y, width, height, text, alignment)
  163.   end
  164. end
  165. #==============================================================================
  166. # ▼ Game_System
  167. #------------------------------------------------------------------------------
  168. #  This class handles system data. It saves the disable state of saving and
  169. # menus. Instances of this class are referenced by $game_system.
  170. #==============================================================================
  171.  
  172. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  173. # Class Game_System
  174. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  175.  
  176. class Game_System
  177.   alias akian_initialize_zack initialize
  178.   #--------------------------------------------------------------------------
  179.   # ▼ Public Instance Variables
  180.   #--------------------------------------------------------------------------
  181.   attr_accessor :syntax_text_1            # Texto 1
  182.   attr_accessor :syntax_text_2            # Texto 2
  183.  
  184.   #--------------------------------------------------------------------------
  185.   # ▼ Object Initialization
  186.   #--------------------------------------------------------------------------
  187.   def initialize
  188.    @syntax_text_1 = AR3::SYNTAX::LINEA1[0]
  189.    @syntax_text_2 = AR3::SYNTAX::LINEA2[0]
  190.    akian_initialize_zack
  191.   end
  192. end
  193.  
  194. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  195. # Class Game_System
  196. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  197.  
  198. class Game_Interpreter
  199.   def change_syntax_text(text)
  200.     return unless text.is_a?(String)
  201.     $game_system.syntax_text_1 = text
  202.   end
  203.   def change_syntax_text_2(text)
  204.     return unless text.is_a?(String)
  205.     $game_system.syntax_text_2 = text
  206.   end
  207. end
  208. #===============================================================================
  209. #
  210. #                 ▼ Fin del mundo, acá se acaba todo
  211. #                         ~  Akián RGSS3 ~
  212. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment