Advertisement
Guest User

Autocolor

a guest
Jan 22nd, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.01 KB | None | 0 0
  1. =begin
  2. EST - AUTO TEXT COLOR PLUS
  3. v.1.2
  4. Author: Estriole
  5.  
  6. Changelog
  7. v1.0 2013.08.27 - Initial Release
  8. v1.1 2013.08.28 - Combine with regexp to recognize 'short' word.
  9. now it won't color damage if you put mag in the config.
  10. if there's bug report to me. since it's really hard dealing with regexp
  11. v1.2 2013.08.28 - Regexp sure is confusing. but manage to improve the regexp.
  12. now it should accept any character beside a-z and 0-9 and _ (underscore).
  13. and it just by removing one symbol from regexp that i have tried before and fail.
  14.  
  15. Introduction
  16. This script created because i got tired adding \c[4]Nobita\c[0] in the show
  17. message box. so this script make it automatic. each time i wrote Nobita it will
  18. change the color to what i set in the module. useful to color actor names or
  19. places or important things. i also add capitalization correction too. so if you
  20. write nobita. it could fixed to Nobita(what you set in the config) if you want.
  21. both auto color and auto caps correct can be binded to switch too if you don't
  22. want to always using it.
  23.  
  24. Feature
  25. - auto change color text you defined in the module
  26. - auto correct capitalization to what you defined in the module
  27. - have switch function for both feature (set it to 0 to make it always active).
  28.  
  29. Author Note
  30. Yes... I made doraemon games.
  31.  
  32. Feature
  33.  
  34. =end
  35. module ESTRIOLE
  36. module AUTOCOLOR
  37. #PUT THE STRING YOU WANT TO AUTO COLOR BELOW. USEFUL FOR NAMES
  38. #FORMAT: "STRING" => COLOR_ID,
  39. AUTO_SETTING = { #DO NOT TOUCH THIS LINE
  40. "Auftrag" => 0,
  41. "Siegelwald" => 23,
  42. "Ido" => 23,
  43. "Elwijen" => 23,
  44. "Elwijens" => 23,
  45. "Alan" => 23,
  46. "Alans" => 23,
  47. "Antika" => 23,
  48. "Antikas" => 23,
  49. "Kastilia" => 23,
  50. "Kastilias" => 23,
  51. "Valoria" => 23,
  52. "Valorias" => 23,
  53. "Yazak" => 23,
  54. "Yazaks" => 23,
  55. "yazakischen" => 23,
  56. "Noce" => 23,
  57. "ƙrone" => 23,
  58. "Krone" => 23,
  59. "Gaststätte" => 24,
  60. "Monte Zuma" => 23,
  61. "Nimbus" => 23,
  62. "Banditen" => 18,
  63. "Legendäre Pirat" => 18,
  64. "Legendärer Pirat" => 18,
  65. "Legendären Piraten" => 18,
  66. "Baron von Ido" => 0,
  67. "ObstOase" => 24,
  68. "Stöberkiste" => 24,
  69. "Schattenflamme" => 24,
  70. "Vensterdam" => 23,
  71. "Spielhalle" => 24,
  72. "Leuchtturm" => 23,
  73. "Yarna" => 6,
  74. "Yarnakirche" => 6,
  75. "Afrasia" => 23,
  76. "Baikal" => 23,
  77. "Baikals" => 23,
  78. "Konzentrierter Trank" => 5,
  79. "Trank" => 5,
  80. "Feldflasche" => 5,
  81. "Wundertrank" => 5,
  82. "Muntermacher" => 5,
  83. "Wunderwasser" => 5,
  84. "Ambrosia" => 5,
  85. "Heilkräuter" => 5,
  86. "Engelsfeder" => 5,
  87. "Engelsschwinge" => 5,
  88. "Engelstränen" => 5,
  89. "Sanfter Bitter" => 5,
  90. "Flachmann" => 5,
  91. "Guter Reiswein" => 5,
  92. "Feigenschnaps" => 5,
  93. "Klasse Weinbrandt" => 5,
  94. "Vitamine" => 5,
  95. "Echoschirm" => 5,
  96. "Antidot" => 5,
  97. "Augentropfen" => 5,
  98. "Baldrian" => 5,
  99. "Allheilmittel" => 5,
  100. "Dämonenblut Phiole" => 5,
  101. "Unsichtbarkeitstrank" => 5,
  102. "Notizbuch" => 5,
  103. "Vermummte Puppe" => 5,
  104. "Passierschein" => 5,
  105. "Handbuch" => 5,
  106. "Lebensnektar" => 5,
  107. "Magischer Splitter" => 5,
  108. "Kraftextrakt" => 5,
  109. "Eisencocktail" => 5,
  110. "Ginseng" => 5,
  111. "Alraune" => 5,
  112. "Vierblättriges Kleeblatt" => 5,
  113. "Käfsersammelbox" => 5,
  114. "Leuchtturmschlüssel" => 5,
  115. "Ticket nach Antika" => 5,
  116. "Forelle" => 5,
  117. "Knolle" => 5,
  118. "Orange" => 5,
  119. "Trauben" => 5,
  120. "Apfel" => 5,
  121. "Goldklumpen" => 5,
  122. "Kristall" => 5,
  123. "Rubin" => 5,
  124. "Goldenes Kreuz" => 5,
  125. "Verzierter Spiegel" => 5,
  126. "Phönixfeder" => 5,
  127. "Vase" => 5,
  128. "Dunkelseele" => 5,
  129. "Lichtseele" => 5,
  130. "Seele" => 5,
  131. "Harter Hund" => 5,
  132. "Magisches Kaubonbon" => 5,
  133. "Schnellkraut" => 5,
  134. "Hexenschmalz" => 5,
  135. "Berserkertrank" => 5,
  136. "Kürbisknolle" => 5,
  137. "Mystiapilz" => 5,
  138. "Hitzetrank" => 5,
  139. "Kältetrank" => 5,
  140. "Nebelnuss" => 5,
  141. "Siegelstein" => 5,
  142. "Giftige Brühe" => 5,
  143. "Magische Sanduhr" => 5,
  144. "Schlafspray" => 5,
  145. "Fluch der Verwirrung" => 5,
  146. "Betäubungspfeil" => 5,
  147. "Wurfmesser" => 5,
  148. "Shuriken" => 5,
  149. "Geweihtes Wasser" => 5,
  150. "Kugelbombe" => 5,
  151. "Flammensplitter" => 5,
  152. }#DO NOT TOUCH THIS LINE
  153.  
  154. #return to this color after the text finished. # default 0
  155. RETURN_COLOR = 0
  156.  
  157. #switch to activate the auto color. if switch off then don't autocolor
  158. #set it to 0. if you want to use switch (will always on)
  159. AUTO_COLOR_SWITCH = 13
  160.  
  161. #switch to activate the auto capitalization correction. (will use what you define
  162. #in AUTOSETTING #if switch off then don't auto capitalization correction.
  163. #set it to 0. if you want to use switch (will always on)
  164. CORRECT_CAP_SWITCH = 0
  165.  
  166. START_AUTO_COLOR = true
  167. START_CORRECT_CAP = true
  168. end
  169. end
  170.  
  171. class Game_Switches
  172. include ESTRIOLE::AUTOCOLOR
  173. alias est_autocolor_switch_initialize initialize
  174. def initialize
  175. est_autocolor_switch_initialize
  176. @data[AUTO_COLOR_SWITCH] = START_AUTO_COLOR if AUTO_COLOR_SWITCH != 0
  177. @data[CORRECT_CAP_SWITCH] = START_CORRECT_CAP if CORRECT_CAP_SWITCH != 0
  178. end
  179. end
  180.  
  181.  
  182. class Window_Base < Window
  183. include ESTRIOLE::AUTOCOLOR
  184. alias est_auto_text_color_convert_escape_character convert_escape_characters
  185. def convert_escape_characters(*args, &block)
  186. result = est_auto_text_color_convert_escape_character(*args, &block)
  187. return result if AUTO_COLOR_SWITCH != 0 && !$game_switches[AUTO_COLOR_SWITCH]
  188. AUTO_SETTING.each_key {|key|
  189. return_color = RETURN_COLOR
  190. color = AUTO_SETTING[key]
  191. if CORRECT_CAP_SWITCH!= 0 && !$game_switches[CORRECT_CAP_SWITCH]
  192. result.gsub!(/(?<![\w])#{key}(?![\w])/i) {"\eC[#{color}]#{$&}\eC[#{return_color}]"}
  193. else
  194. result.gsub!(/(?<![\w])#{key}(?![\w])/i) {"\eC[#{color}]#{key}\eC[#{return_color}]"}
  195. end
  196. }
  197. result
  198. end
  199. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement