Advertisement
TroyZ

TroyZ - Scrolling Text Extended

Nov 25th, 2013
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.92 KB | None | 0 0
  1. # ==============================================================================
  2. # ▼▼▼▼▼▼                  TroyZ - Scrolling Text Extended                 ▼▼▼▼▼▼
  3. # ==============================================================================
  4. # Script by : Agung Prasetyo(TroyZ)
  5. # Contact me by : - Email agung.endisnear.xyz@gmail.com
  6. #                 - Forum RPGMakerID, username TroyZ
  7. #                 - Handphone 085756289121
  8. # Engine : VXAce
  9. # Level : Easy
  10. # Version : 1.0
  11. # ------------------------------------------------------------------------------
  12. # Change Logs :
  13. # 25 November 2013 : Version 1.0 released
  14. # ------------------------------------------------------------------------------
  15. # How this work :
  16. # Getting bored of the ordinary scrolling text that scrolling from the bottom
  17. # of the screen? This script can make the scrolling text appear also from the
  18. # top of the screen.
  19. # ------------------------------------------------------------------------------
  20. # How to use :
  21. # Place it between material and main.
  22. #
  23. # You can alter the direction type of scrolling text by using script call :
  24. # - scroll_dir(value)
  25. # When value is the new value. There are 2 types of scrolling :
  26. # 1. The scrolling text appear at the top.
  27. # 2. The scrolling text appear at the bottom (default).
  28. #
  29. # So input the value either 1 or 2 in the script call.
  30. # ------------------------------------------------------------------------------
  31. # Compatibility issues :
  32. # None yet. If you found some, let me know, and bug fixes will come out soon.
  33. # ------------------------------------------------------------------------------
  34. # Who to credit :
  35. # - Allah swt. : For the chance of living that he has given to me.
  36. # - Nabi Muhammad saw. : As a leader and messenger and prophet of Muslim.
  37. #                        I'm proud to be your follower. :)
  38. # - Agung Prasetyo(TroyZ) : Me? Whatever, i don't need it actually. :P
  39. # ------------------------------------------------------------------------------
  40. # License :
  41. # - Free Game : Just credit those names above.
  42. # - Commercial Game : Same as free game's license.
  43. # ------------------------------------------------------------------------------
  44. $imported = {} if $imported.nil?
  45. $imported[:TroyZ_ScrollingTextExtended] = true
  46. # ------------------------------------------------------------------------------
  47. # Configuration of script starts here
  48. # ------------------------------------------------------------------------------
  49. module AGUNG
  50.   module EXT_SCROLL_TXT
  51.     SCROLL_DIR = 2 # the default value of scrolling
  52.   end  
  53. end
  54. # ------------------------------------------------------------------------------
  55. # End of Configuration
  56. # ------------------------------------------------------------------------------
  57.  
  58. # ------------------------------------------------------------------------------
  59. # You shall not pass
  60. # ------------------------------------------------------------------------------
  61. class Game_System
  62.   attr_accessor :scroll_dir
  63.  
  64.   alias agung_scroll_dir_init_x    initialize
  65.   def initialize
  66.     agung_scroll_dir_init_x
  67.     @scroll_dir = AGUNG::EXT_SCROLL_TXT::SCROLL_DIR
  68.   end
  69. end
  70.  
  71. class Game_Interpreter  
  72.   def scroll_dir(value)
  73.     $game_system.scroll_dir = value
  74.   end  
  75. end
  76.  
  77. class Window_ScrollText < Window_Base  
  78.   def refresh
  79.     reset_font_settings
  80.     update_all_text_height
  81.     create_contents
  82.     draw_text_ex(4, 0, @text)
  83.     case $game_system.scroll_dir
  84.       when 1
  85.         self.oy = @scroll_pos = contents.height
  86.       when 2
  87.         self.oy = @scroll_pos = -height
  88.     end
  89.   end
  90.  
  91.   def update_message
  92.     case $game_system.scroll_dir
  93.       when 1
  94.         @scroll_pos -= scroll_speed
  95.         self.oy = @scroll_pos
  96.         terminate_message if @scroll_pos <= -height
  97.       when 2
  98.         @scroll_pos += scroll_speed
  99.         self.oy = @scroll_pos
  100.         terminate_message if @scroll_pos >= contents.height
  101.     end
  102.   end
  103. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement