Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.26 KB | None | 0 0
  1. ;**************
  2. ;* WOLFCOLORS *
  3. ;**************
  4. ;A script for coloring the names of players in #wolf
  5. ;BLAME ARAMIL
  6. ;Original code by nialo
  7. ;Preset colors by modargo
  8. ;Self-coloring by modargo
  9.  
  10. ;Version 1.2.1, released 8/23/09 10:23
  11.  
  12. */
  13. *************
  14. * CHANGELOG *
  15. *************
  16. * 1.1.0: Added coloring of emotes.
  17. * 1.1.1: Removed extraneous debug echoes.
  18. * 1.1.2: Fixed coloring for replacements
  19. * 1.2.0: Added coloring of own text and emotes, plus ability to easily disable it. Removed unnecessary piping code.
  20. * 1.2.1: Various minor clarifications to use instructions. Added testing instructions. Some additional comments.
  21. * Expanded installation instructions. Split installation instructions into new and upgrade sections.
  22. */
  23.  
  24. ;****************
  25. ;* INSTALLATION *
  26. ;****************
  27. ;In mIRC, go to Tools -> Script Editor. Go to the Remote tab.
  28. ;IF YOU ARE INSTALLING WOLFCOLORS FOR THE FIRST TIME:
  29. ;Make a new script file (File -> New) and paste everything here into it
  30. ;Save the result as wolfcolors.mrc so you can easily locate it later (File -> Save As)
  31. ;(You do not need to use that specific name, but it helps to use something easy to remember)
  32. ;Check out the configuration section below
  33. ;IF YOU ARE UPGRADING FROM A PREVIOUS VERSION OF WOLFCOLORS:
  34. ;Find the previous version of the wolfcolors script. Replace everything in it with this new code, and save the result.
  35. ;Note that this will reset all the configuration changes you have made to the defaults.
  36. ;(If you have substantially changed the colors you are using, you may wish to record them so you can re-enter them).
  37. ;Check out the configuration section below.
  38.  
  39. ;********************
  40. ;* USE INSTRUCTIONS *
  41. ;********************
  42. ;Script should automatically start at the beginning of a game
  43. ;and automatically deactivate at the end
  44. ;If it does not start, it can be manually started by doing /wcs (or /startwolfcolors)
  45. ;If it does not deactivate, it can be manually deactivated by doing /wce (or /endwolfcolors or /stopwolfcolors)
  46. ;The most recently used set of colors can be reactivated by doing /wca (or /activatewolfcolors) (warning: may have weird results)
  47.  
  48. ;***********
  49. ;* TESTING *
  50. ;***********
  51. ;To verify that everything is working properly:
  52. ;1. Get a few people voiced in #wolf
  53. ;2. Do /wcs or /startwolfcolors
  54. ;3. Say the full nicks of some of the voiced people. If you have self-coloring on, the nicks should be colored.
  55. ;4. Have someone else say the full nicks of some of the voiced people. The nicks should be colored.
  56.  
  57.  
  58. ;*****************
  59. ;* CONFIGURATION *
  60. ;*****************
  61. ;You should configure the color lists below in startwolfcolors to your liking
  62. ;If you are using a default background or text color other than black or white,
  63. ;you probably want to edit the color configuration below to remove that color,
  64. ;as it is likely to be either invisible or indistinguishable from normal text
  65. ;You may want to change the background color for nicks
  66.  
  67. ;You should also to consult the misc configuration section and fiddle with things
  68.  
  69. alias startwolfcolors {
  70. ;*************************
  71. ;* BASICS OF MIRC COLORS *
  72. ;*************************
  73. ;The format for a color is: x,y
  74. ;Where x is an integer for the text color
  75. ;And y is an integer for the background color
  76. ;The comma and the background color may be ommitted, which causes the default background color to be used
  77. ;The color codes are as follows:
  78. ;0=white, 1=black, 2=dark blue, 3=dark green, 4=red, 5=brownish, 6=purple,
  79. ;7=orange, 8=bright yellow, 9=bright green, 10=tealish, 11=light blue,
  80. ;12=medium blue, 13=pink, 14=dark gray, 15=light gray
  81.  
  82. ;**********************
  83. ;* MISC CONFIGURATION *
  84. ;**********************
  85. ;CHANGE THE 1 BELOW TO 0 IF YOU DO NOT WANT YOUR OWN MESSAGES COLORED
  86. set %wolf.color_own_messages 1
  87.  
  88. ;************************
  89. ;* COLORS CONFIGURATION *
  90. ;************************
  91. ;CHANGE THIS TO THE COMPLETE LIST OF COLORS YOU WANT TO USE
  92. ;Colors are used in the order given: put marginal or ugly colors at the end
  93. ;set %wolf.colors.all 4 13 6 7 8 9 10 11 14 12 15 5
  94. ;Uncomment the below and comment out the above to have the background set to black
  95. set %wolf.colors.all 4,1 13,1 6,1 7,1 8,1 9,1 10,1 11,1 14,1 12,1 15,1 5,1
  96.  
  97.  
  98. ;*************************
  99. ;* PRESETS CONFIGURATION *
  100. ;*************************
  101. ;CHANGE THIS TO THE LIST OF PRESET NAMES/COLORS YOU WANT TO USE
  102. ;Each entry on the names list is given the color in the corresponding entry on the preset colors list
  103. ;free to add: 14 12 15 5
  104. set %wolf.presets.names modargo Kirushi ktulu ktulu- nialo Calisc LeeSharpe Leecifer Lee|work Wishthink Crispy` Crispy-
  105. ;Uncomment the below and comment out the above to disable presets entirely
  106. ;set %wolf.presets.names .
  107. ;set %wolf.presets.colors 7 13 6 6 8 4 11 11 11 9 10 10
  108. ;Uncomment the below and comment out the above to have the background set to black
  109. set %wolf.presets.colors 7,1 13,1 6,1 6,1 8,1 4,1 11,1 11,1 11,1 9,1 10,1 10,1
  110.  
  111. ;IMPORTANT NOTES:
  112. ;Lists should be the same length
  113. ;Entries in each list should be unique
  114. ;If a player with a preset color is not in the game, their color may be used for someone else
  115.  
  116.  
  117.  
  118.  
  119. ;**************************************************
  120. ;* BEGINNING OF THE ACTUAL CODE *
  121. ;* DO NOT TOUCH UNLESS YOU KNOW WHAT YOU'RE DOING *
  122. ;**************************************************
  123.  
  124. set %wolf.game 1
  125. set %wolf.colors
  126.  
  127. set %wolf.colors.unused %wolf.colors.all
  128.  
  129. if ($nick(#wolf, 0, v) > 0) {
  130. set %wolf.players.count $nick(#wolf, 0, v)
  131. set %i 1
  132. set %wolf.players
  133. while (%i <= %wolf.players.count) {
  134. set %wolf.curnick $nick(#wolf,%i,v)
  135. set %wolf.players $addtok(%wolf.players, %wolf.curnick, 32)
  136.  
  137. ;If a player with a preset color is in the game,
  138. ;remove that color from the list of available colors
  139. if ($istok(%wolf.presets.names, %wolf.curnick, 32)) {
  140. set %wolf.toknum $findtok(%wolf.presets.names, %wolf.curnick, 32)
  141. set %wolf.curcolor $gettok(%wolf.presets.colors, %wolf.toknum, 32)
  142.  
  143. set %wolf.toknum $findtok(%wolf.colors.unused, %wolf.curcolor, 32)
  144. set %wolf.colors.unused $deltok(%wolf.colors.unused, %wolf.toknum, 32)
  145. }
  146.  
  147. inc %i
  148. }
  149.  
  150. set %i 1
  151. set %wolf.players.count $numtok(%wolf.players,32)
  152. while (%i <= %wolf.players.count) {
  153. set %wolf.curnick $gettok(%wolf.players, %i, 32)
  154.  
  155. ;If the player has a preset color, use that color
  156. ;Otherwise, take the first of the available unused colors
  157. if ($istok(%wolf.presets.names, %wolf.curnick, 32)) {
  158. set %wolf.toknum $findtok(%wolf.presets.names, %wolf.curnick, 32)
  159. set %wolf.curcolor $gettok(%wolf.presets.colors, %wolf.toknum, 32)
  160. }
  161. else {
  162. set %wolf.curcolor $gettok(%wolf.colors.unused, 1, 32)
  163. set %wolf.colors.unused $deltok(%wolf.colors.unused, 1, 32)
  164. }
  165. set %wolf.colors $addtok(%wolf.colors, %wolf.curcolor, 32)
  166. inc %i
  167. }
  168. }
  169. }
  170.  
  171. ;Automatically activate/deactivate wolfcolors on +m/-m
  172. ;Note that activation on +m is currently disabled.
  173. ;Instead, activation on the "day 1 begins" message from Narrator is used.
  174. on *:mode:#wolf:{
  175. if ( *+m* iswm $1- ) {
  176. ;If for some reason you need to enable activation on +m,
  177. ;uncomment the line below
  178. ;timerwolfcolors 1 15 startwolfcolors
  179. }
  180. else if ( *-m* iswm $1- ) {
  181. timerwolfcolors off
  182. endwolfcolors
  183. }
  184. }
  185.  
  186. ;Start wolf colors when Narrator says "day 1 begins" at the start of the game
  187. on *:notice:*day 1 begins*:#wolf:{
  188. if ( $nick == Narrator ) {
  189. startwolfcolors
  190. }
  191. }
  192.  
  193. ;Give players that replace in the same color as the player they replaced
  194. on *:text:*replaces*:#wolf:{
  195. set %wolf.temp $gettok($3,1,$asc(.))
  196. set %wolf.temp $right(%wolf.temp, $len(%wolf.temp) - 1)
  197. set %wolf.newnick $strip($1)
  198. if ( ( $nick == Narrator ) && ( %wolf.temp isin %wolf.players ) ) {
  199. set %wolf.players $replace(%wolf.players,$+(%wolf.temp,$chr(32)),$+(%wolf.newnick,$chr(32)))
  200. }
  201. }
  202.  
  203. ;Deactivate wolf colors
  204. alias endwolfcolors {
  205. set %wolf.game 0
  206. }
  207.  
  208. alias stopwolfcolors {
  209. endwolfcolors
  210. }
  211.  
  212. ;Makes wolf colors display again, but DOES NOT reset anything
  213. ;Uses whatever colors and names that were last used by the script
  214. alias activatewolfcolors {
  215. set %wolf.game 1
  216. }
  217.  
  218. ;Shorter aliases for the start, end, and activate commands
  219. alias wcs {
  220. startwolfcolors
  221. }
  222.  
  223. alias wce {
  224. endwolfcolors
  225. }
  226.  
  227. alias wca {
  228. activatewolfcolors
  229. }
  230.  
  231. ;Colors a nick based on the current active colors
  232. alias color_nick {
  233. set %wolf.color.nick  $+ $gettok(%wolf.colors,$findtok(%wolf.players,$1,1,32),32) $+ $nick $+ 
  234. return %wolf.color.nick
  235. }
  236.  
  237. ;Colors a line based on the current active colors
  238. alias color_line {
  239. set %wolf.color.text $1-
  240. set %wolf.color.counter 1
  241. while ( %wolf.color.counter <= %wolf.players.count ) {
  242. ;echo -tm #wolf %wolf.color.counter $gettok(%wolf.colors,%wolf.color.counter,32)
  243. set %wolf.color.replacement  $+ $gettok(%wolf.colors,%wolf.color.counter,32) $+ $gettok(%wolf.players,%wolf.color.counter,32) $+ 
  244. set %wolf.color.text $replace(%wolf.color.text,$gettok(%wolf.players,%wolf.color.counter,32),%wolf.color.replacement)
  245. inc %wolf.color.counter
  246. }
  247. return %wolf.color.text
  248. }
  249.  
  250. ;Processing for other people's lines
  251. on ^*:text:*:#wolf:{
  252. if ( %wolf.game == 1 ) {
  253. haltdef
  254. set %wolf.color.nick $color_nick($nick)
  255. set %wolf.color.text $color_line($1-)
  256. echo -tm #wolf < $+ [ %wolf.color.nick ] $+ > %wolf.color.text
  257. }
  258. }
  259.  
  260. ;Processing for other people's emotes
  261. on ^*:action:*:#wolf:{
  262. if ( %wolf.game == 1 ) {
  263. haltdef
  264. set %wolf.color.nick $color_nick($nick)
  265. set %wolf.color.text $color_line($1-)
  266. echo -tm #wolf * [ %wolf.color.nick ] %wolf.color.text
  267. }
  268. }
  269.  
  270. ;Processing for own lines and emotes
  271. on *:input:#wolf:{
  272. if ( ( %wolf.game == 1 ) && ( %wolf.color_own_messages == 1) ) {
  273. set %wolf.first_char $left($1,1)
  274. if ( ( %wolf.first_char != / ) || ( $1 == /me ) ) {
  275. haltdef
  276. if ( %wolf.first_char != / ) {
  277. set %wolf.color.nick $color_nick($nick)
  278. set %wolf.color.text $color_line($1-)
  279. echo -tm #wolf < $+ [ %wolf.color.nick ] $+ > %wolf.color.text
  280. .msg #wolf $1-
  281. }
  282. else {
  283. set %wolf.color.nick $color_nick($nick)
  284. set %wolf.color.text $color_line($2-)
  285. echo -tm #wolf * [ %wolf.color.nick ] %wolf.color.text
  286. .me $2-
  287. }
  288. }
  289. }
  290. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement