Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Author : Dekita
- # Written for q8fft3
- # Date : 16-o8-2014.
- #===============================================================================
- module Text_Mods
- #===============================================================================
- #-----------------------------------------------------------------------------
- # :type => switch ID to enable.
- #-----------------------------------------------------------------------------
- Switches={
- :reverse_words => 1,
- :reverse_letters => 2,
- :reverse_both => 3,
- }
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- end
- #===============================================================================
- class Game_Message
- #===============================================================================
- #-----------------------------------------------------------------------------
- # Rewrite
- #-----------------------------------------------------------------------------
- def all_text
- can_mod = can_mod_texts?.clone
- old_text = @texts.inject("") { |result, text| result += text }
- text = old_text
- if can_mod.shift
- text = old_text.split(//u).reverse.join.split(/ /).map do |w|
- w.split(//u).reverse.join
- end.join(' ')
- end
- if can_mod.shift
- ot = old_text.split(//u).reverse!.join.split(//u)
- text = ot.reverse.join.split(/ /).map do |w|
- w.split(//u).reverse.join
- end.join(' ')
- end
- if can_mod.shift
- text = old_text.split(//u).reverse!.join
- end
- return "#{text}\n"
- end
- #-----------------------------------------------------------------------------
- # New Method
- #-----------------------------------------------------------------------------
- def can_mod_texts?
- [:reverse_words,:reverse_letters,:reverse_both].inject([]) do |res,sym|
- res << $game_switches[Text_Mods::Switches[sym]]
- end.compact
- end
- #-----------------------------------------------------------------------------
- #
- #-----------------------------------------------------------------------------
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement