Advertisement
Guest User

Untitled

a guest
Aug 12th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.40 KB | None | 0 0
  1. #==============================================================================
  2. # ** Window_Message - Slow Text
  3. #------------------------------------------------------------------------------
  4. #  By Siegfried (http://saleth.fr), base on Phantou's work
  5. #------------------------------------------------------------------------------
  6. #  This script allows the game to slow down the text speed in a message using
  7. #  control characters.
  8. #    \£ : slow down the text
  9. #    \µ : bring it back to normal speed
  10. #  The speed is set back to normal on a new message.
  11. #==============================================================================
  12.  
  13. #==============================================================================
  14. # ** Window_Message
  15. #==============================================================================
  16.  
  17. class Window_Message < Window_Base
  18.   #--------------------------------------------------------------------------
  19.   # * Clear Flag
  20.   #--------------------------------------------------------------------------
  21.   alias slow_clear_flags clear_flags
  22.   def clear_flags
  23.     slow_clear_flags
  24.     @show_slow = false          # Slow down flag
  25.   end
  26.   #--------------------------------------------------------------------------
  27.   # * Destructively Get Control Code
  28.   #--------------------------------------------------------------------------
  29.   def obtain_escape_code(text)
  30.     text.slice!(/^[\$\.\|\^!><£µ\{\}\\]|^[A-Z]+/i)
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # * Control Character Processing
  34.   #--------------------------------------------------------------------------
  35.   alias slow_process_escape_character process_escape_character
  36.   def process_escape_character(code, text, pos)
  37.     # This line avoids a crash if an antislash is written by itself
  38.     code = "" if code.nil?
  39.     # Check for the slow_down control character
  40.     case code.upcase
  41.     when "£"
  42.       @show_slow = true
  43.     when "µ"
  44.       @show_slow = false
  45.     else
  46.       slow_process_escape_character(code, text, pos)
  47.     end
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # * Update Fast Forward Flag
  51.   #--------------------------------------------------------------------------
  52.   alias slow_update_show_fast update_show_fast
  53.   def update_show_fast
  54.     slow_update_show_fast
  55.     wait(10) if @show_slow and not @show_fast
  56.   end
  57. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement