Advertisement
diamondandplatinum3

Morality Title Escape Character ~ RGSS3

Apr 24th, 2013
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.30 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Morality Title Escape Character ~ Add-On
  3. #             Authors: DiamondandPlatinum3
  4. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. #  Description:
  6. #
  7. #    This Add-On makes it so that in any of your events, when you display a
  8. #    variable with the same ID as the Morality Variable, it will convert the
  9. #    display into your current morality title.
  10. #
  11. #    For Example, if the Morality Variable is Variable ID 2 and I use:
  12. #       \v[2]
  13. #    in a show text event, it will end up as "Evil" or "Neutral", etc
  14. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. #------------------------------------------------------------------------------
  16. #  Instructions:
  17. #  
  18. #     Plug and Play, nothing required. Just make sure that the latest version
  19. #     of the Morality script is being used and that it is placed anywhere above
  20. #     this add-on.
  21. #
  22. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23.  
  24.  
  25. #==============================================================================
  26. # ** Window_Base
  27. #------------------------------------------------------------------------------
  28. #  This is a super class of all windows within the game.
  29. #==============================================================================
  30.  
  31. class Window_Base < Window
  32.   #--------------------------------------------------------------------------
  33.   # * Alias Listings
  34.   #--------------------------------------------------------------------------
  35.   alias dp3_windowsbase_convertescapecharacter_6s5d4g7     convert_escape_characters
  36.   #--------------------------------------------------------------------------
  37.   # * Preconvert Control Characters
  38.   #--------------------------------------------------------------------------
  39.   def convert_escape_characters(text)
  40.     result = text.to_s.clone
  41.     result.gsub!(/\\/)            { "\e" }
  42.     result.gsub!(/\eV\[#{DiamondandPlatinum3::MoralityMetre::MORALITY_VARIABLE_ID.to_s}\]/i) { dp3_get_morality_title() }
  43.    
  44.    
  45.     # Call Original Method
  46.     return dp3_windowsbase_convertescapecharacter_6s5d4g7( result )
  47.   end # Function
  48.  
  49.   #--------------------------------------------------------------------------
  50.   # * Get Morality Title
  51.   #--------------------------------------------------------------------------
  52.   def dp3_get_morality_title()
  53.     title = "Unknown"
  54.     DiamondandPlatinum3::MoralityMetre::MORALITY_NAME.each do |innerarray|
  55.       if $game_variables[DiamondandPlatinum3::MoralityMetre::MORALITY_VARIABLE_ID] >= innerarray[0]
  56.         title = innerarray[1]
  57.       end
  58.     end
  59.     return title
  60.   end
  61. end # Class
  62.  
  63.  
  64.  
  65.  
  66. #--------------------------------------------------------------------------
  67. # * Inform User of Non-working Script
  68. #--------------------------------------------------------------------------
  69. msgbox_p("This script has not detected an active version of DiamondandPlatinum3's Morality Metre.",
  70.          "It's possible you are using an outdated version or you have placed this add-on above that script.",
  71.          "If the latter is the case, please put this script in a slot below the Morality Metre Script"
  72.         ) unless ($diamondandplatinum3_scripts ||= {})[:MoralityMetre_Ver20]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement