Guest User

Untitled

a guest
Oct 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.30 KB | None | 0 0
  1.  
  2. ; --------------------------------------------------------------
  3. ; ----------Gummo's Colour Script v4.6.2-------------
  4. ;----------EDITED A little by Spanky(Spencer)-----
  5. ; -------------------------V2-------------------------------
  6. #gum.colour on
  7. on *:input:*: {
  8. ; Don't try to do anything if user typed a command or pasted a lot of text (or pressed ctrl+enter, see below)
  9. if (/* iswm $1) || ($inpaste) return
  10. elseif ($ctrlenter) {
  11. ; Allow easy setting of modes (if enabled). +/- modes with ctrl+enter will set them in a channel. Arguments allowed.
  12. if (%gum.colour.easymodes) && ($me ison $target) && ($regex($1-,/^(?:[+-][a-z]+)+/i)) {
  13. mode $target $1-
  14. haltdef
  15. }
  16. return
  17. }
  18. ; used so you can do !op !deop etc etc feel free to delete this line if you don't want/need it
  19. if (!* iswm $1) return
  20. ; Don't colour messages in certain rooms to avoid annoying people and/or to your preference. This line is optional.
  21. if ($istok(#Staff #Oper #Opers #Services #Services-Log #Log #Support #Appeals #Abuse,$target,32)) return
  22. ; Stop the script if the channel blocks coloured messages (channel mode +c)
  23. ; Note the $gettok since 'c' can exist in one of the arguments. I've had trouble with that previously.
  24. if (c isincs $gettok($chan($target).mode,1,32)) return
  25. ; Point of no return! We've stopped mIRC's default actions now, so we have to send the message.
  26. haltdef
  27. ; Don't edit the following four lines. They create temporary variables from the permanent ones for simplicity.
  28. var %bg %gum.colour.background, %txt  $+ %gum.colour.text, %punc  $+ %gum.colour.punctuation
  29. var %caps  $+ %gum.colour.capitals, %nick  $+ %gum.colour.nicknames
  30. var %punc2  $+ $base($right(%punc,-1),10,10,2), %punc3 $+(%punc,$chr(44),%bg)
  31. var %punc4  $+ %gum.colour.numbers
  32. var %gum.colour.channick  $+ %gum.colour.channick
  33. var %gum.colour.chanops  $+ %gum.colour.chanops
  34. var %gum.colour.chanbrac  $+ %gum.colour.chanbrac
  35. var %gum.colour.pmnick  $+ %gum.colour.pmnick
  36. var %gum.colour.pmbrac  $+ %gum.colour.pmbrac
  37. var %gum.colour.achannick  $+ %gum.colour.achannick
  38. var %gum.colour.achanops  $+ %gum.colour.achanops
  39. var %gum.colour.achanbrac  $+ %gum.colour.achanbrac
  40. var %gum.colour.apmnick  $+ %gum.colour.apmnick
  41. var %gum.colour.apmbrac  $+ %gum.colour.apmbrac
  42. var %gum.colour.brackets %gum.colour.brackets (
  43. var %gum.colour.brackets2 %gum.colour.brackets2 )
  44. ; Preparing various variables
  45. var %regex, %chanregex, %puncregex, %nicks, %chans, %chanlist, %i 1
  46. ; Tokenize the text instead of putting it in a variable, to avoid mIRC's variable evaluation for simple maths..
  47. tokenize 32 $remove($strip($1-,rc),)
  48. ; Create a list of channels to be matched in the text, escaped to prepare it for regex.
  49. while ($chan(%i)) {
  50. %chanlist = $+(%chanlist,|\Q,$v1,\E)
  51. inc %i
  52. }
  53. ; sorts out the emotions
  54. if (%gum.emoticon) tokenize 32 $regsubex($1-,/( $+ $c.ereg $+ |\?(?=[]})".?!:({[]| ['"]| |$))/gi,$replacecs(\1,x,×,X,×,s,§,S,§,D,Ð,d,Ð,p,Þ,P,þ,?,?,O,$c.rand.upper.o,o,$c.rand.lower.o,-,¬,>.<,[-.-]",$chr(41),$c.rand.hap,$chr(40),$c.rand.unhap,C,Ç,c,ç,U,Û,u,û,F,ƒ,f,ƒ))
  55. if (%gum.autoformat) && ($len($1-) > 1) && (!%me) tokenize 32 $regsubex($replacex($1-,dont,don't,w/ $+ $chr(32),$chr(32) $+ with,b/c,because),/(^[A-z]|(?<=[.?!:]\s)[A-z]|\bi\b)/g,$upper(\1)) $+ $iif($regex($1-,/^(?!['!?@.]).+(?<=[A-z0-9])(?<![]^_`\\[])$/),)
  56. ; All of the Acronyms
  57. if (%gum.acronym) tokenize 32 $replacexcs($1-,>.>,».»,<.<,«.«,<3,4♥♥,LOL,-Laughing Out Loud-,BRB,-Be Right Back-,HB,-Hurry Back-,WB,-Welcome Back-,ILY,-I <3 You-,ROFLMAO,-Rolling On Floor Laughing My Ass Off-,LMAO,-Laughing My Ass Off-,ROFL,-Rolling On Floor Laughing-,BBL,-Be Back Later-,BBIAB,-Be Back In A Bit-,BBS,-Be Back Soon-,PMSL,-Pissing Myself Laughing-,TBH,-To Be Honest-,TYVM,-Thank You Very Much-,TTYL,-Talk To You Later-,TY,-Thank You-,YW,-You're Welcome-,OMG,-Oh My God-,ASAP,-As Soon As Possible-,AFAIK,-As Far As I Know-,AFK,-Away From Keyboard-,BBN,-Bye Bye Now-,ASL,-Age/Sex/Location-,IMCO,-In My Considered Opinion-,IMHO,-In My Humble Opinion-,IMO,-In My Opinion-,JK,-Just Kidding-,LMSO,-Laughing My Socks Off-,NP,-No Problem-,WYSIWYG,-What You See Is What You Get-,WTH,-What The Hell?!-,TMI,-Too Much Information-)
  58. ; Set the channel regular expression (for finding channels, both in channel and PM)
  59. %chanregex = /(?<=\s|[(,+%@&~?!]|(?<!\w)[])(?=#[^\s,+%@&~]{3})( $+ $right(%chanlist,-1) $+ )(?=[[:punct:]]*[\s,]|[](?!\w))/gi
  60. ; Set a slightly different nickname regular expression for queries as opposed to channels
  61. ; Queries only match you and the nick you PM, while channels match any possible nickname (and channel) to avoid big loops
  62. if ($query($target)) %regex = /(?<=\s|\s[[{]|(?<!\w)[]|[.,'"<(+%@&~/\\])(\Q $+ $me $+ \E|\Q $+ $target $+ \E)(?=[[:punct:]]*\s|['"/\\=*@.,]|[](?!\w))/gi
  63. elseif ($chan) %regex = /(?<=\s|(?<!\w)[]|[.,'"<(+%@&~/\\])(?!\d)([^-,./:-@~ ×÷]{3,})(?=[[:punct:]]*[\s,]|[/\\=*@.,]|['"](?=\S{3,}\s|[\s,])|[](?!\w))/gi
  64. ; Prepare the symbols/capitals/smileys regular expression (for simplicity later)
  65. %puncregex = /((?i:\b[OVUX][_.]+[OVUX]\b|[:;=][A-Z]\b|\b[A-Z][:;=]\B|\b(?:X[DOP]|[DOP]X)\b|[^A-Z\s])+|[A-Z]+)/g
  66. ; If we're not sending text to a PM or channel, exit
  67. else return
  68. ; Now we'll move the channels (all known) into a variable and put ctrl+o in their place (to avoid confusion with ctrl+r)
  69. tokenize 32 $mid($regsubex(chans,/ $1- /,$iif(%gum.colour.highlightchan,%chanregex,),),3,-2)
  70. ; A simple loop to move the matched channels into the %chans variable
  71. %i = 1
  72. while ($regml(chans,%i)) {
  73. %chans = %chans $v1
  74. inc %i
  75. }
  76. ; Now we'll move the nicknames into a variable (known and potential alike) and put a ctrl+r in their place
  77. tokenize 32 $mid($regsubex(nicks,/ $1- /,$iif(%gum.colour.highlightnick,%regex,),),3,-2)
  78. ; Another simple loop to move the matched nicknames into the %nicks variable
  79. %i = 1
  80. while ($regml(nicks,%i)) {
  81. %nicks = %nicks $v1
  82. inc %i
  83. }
  84. ; If we were sending to a channel, remove potential nicknames which don't exist in the channel (and put them back into the text)
  85. ; Modified to also cater for channel matches
  86. if ($chan) {
  87. var %nn, %n $numtok(%nicks,32)
  88. while (%n) {
  89. %nn = $gettok(%nicks,%n,32)
  90. if (%nn !ison $chan) && ($me !ison %nn) {
  91. tokenize 32 $regsubex($1-,//g,$iif(\n == %n,%nn,))
  92. %nicks = $deltok(%nicks,%n,32)
  93. }
  94. dec %n
  95. }
  96. }
  97. ; Now remove those pesky extra ctrl+r characters in %nicks
  98. %nicks = $remtok(%nicks,,0,32)
  99. ; Colour capital letters, emoticons and punctuation in one line since this negates a need for workarounds of any kind.
  100. if (%betaon) tokenize 32 $regsubex($1-,%puncregex,$+($iif(\1 isalpha && !$istok(XD.DX.XO.OX.XP.PX,\1,46),%caps,$iif($left(\1,1) isnum,%punc4,$iif($left(\1,1) == $chr(44) && $mid(\1,2,1) isnum,%punc2,%punc))),\1,%txt))
  101. ; Colour capital letters, emoticons and punctuation in one line since this negates a need for workarounds of any kind.
  102. if (%betaoff) tokenize 32 $regsubex($1-,%puncregex,$+($iif(\1 isalpha && !$istok(XD.DX.XO.OX.XP.PX,\1,46),%caps,$iif($left(\1,1) isnum,%punc2,$iif($left(\1,1) == $chr(44) && $mid(\1,2,1) isnum,%punc3,%punc))),\1,%txt))
  103. ; Loop through each channel, colouring it and putting it back in its original place
  104. if (%chans) tokenize 32 $regsubex($1-,//g,$+(%nick,$gettok(%chans,\n,32),%txt))
  105. ; Loop through each nickname, colouring it and putting it back in its original place
  106. if (%nicks) tokenize 32 $regsubex($1-,//g,$+(%nick,$gettok(%nicks,\n,32),%txt))
  107. ; Finalise colouring and remove unnecessary colours
  108. tokenize 32 $regsubex($+(%txt,$1-,),/(?:\d\d?(?:\x2C\d\d?)?)+/g,)
  109. tokenize 32 $regsubex($1-,/\d\d?(?:\x2C\d\d?)? /g,$chr(32) )
  110. while ($1- != $regsubex($1-,/(\d\d?)(?:\x2C\d\d?)?([^]+)(\d\d?)(?:\x2C\d\d?)?/g,$iif(\1 == \3,\1\2,\1\2\3))) tokenize 32 $v2
  111. ; Put the background colour at the start (minimise character use as much as possible, even though it's a lot of code for that)
  112. ; This prevents requiring two colour codes at the start for no reason
  113. ; Also added check to add bold character to the start (if applicable)
  114. tokenize 32 $regsubex($1-,/^(\d\d?)(?!\x2C\d)(?=(.))/,$+($iif(%gum.colour.bold,),,$base(\1,10,10,1),$chr(44),$iif(\2 isnum,$base(%bg,10,10,2),%bg)))
  115. ; Message to target change .msg to msg if you take off the themes
  116. msg $target $1-
  117. }
  118. ; Theme stuff
  119. on ^*:TEXT:*:?: {
  120. echo $nick $theme.text($nick, $address, $nick, $1-)
  121. haltdef
  122. }
  123. alias theme.text {
  124. return $timestamp  $+ %gum.colour.pmbrac $+ %gum.colour.brackets $+  $+ %gum.colour.pmnick $+ $1 $+  $+ %gum.colour.pmbrac $+ %gum.colour.brackets2 $+  $4-
  125. }
  126. on ^*:action:*:?: {
  127. echo $nick $theme.act($nick, $address, $nick, $1-)
  128. haltdef
  129. }
  130. alias theme.act {
  131. return $timestamp  $+ %gum.colour.apmbrac $+ %gum.colour.brackets $+  $+ %gum.colour.apmnick $+ $1 $+  $+ %gum.colour.apmbrac $+ %gum.colour.brackets2 $+  $4-
  132. }
  133. ON ^*:action:*:#:{
  134. echo $chan $timestamp $+(,,%gum.colour.achanbrac,%gum.colour.brackets,,,%gum.colour.achannick,$regsubex($iif($chan,$nick(#,$nick).pnick,$nick),/^([~&@%+])([~&@%+]*)/,$+(,,%gum.colour.achanops,$replace(\1,$regml(2),$null),,,%gum.colour.achannick)),,,%gum.colour.achanbrac,%gum.colour.brackets2,) $+  $1-
  135. haltdef
  136. }
  137. ON ^*:TEXT:*:#:{
  138. echo $chan $timestamp $+(,,%gum.colour.chanbrac,%gum.colour.brackets,,,%gum.colour.channick,$regsubex($iif($chan,$nick(#,$nick).pnick,$nick),/^([~&@%+])([~&@%+]*)/,$+(,,%gum.colour.chanops,$replace(\1,$regml(2),$null),,,%gum.colour.channick)),,,%gum.colour.chanbrac,%gum.colour.brackets2,) $+  $1-
  139. haltdef
  140. }
  141. #gum.colour end
  142. ; Creating the menu for the Script
  143. menu channel,query {
  144. -
  145. Gummo Colour
  146. .$iif($group(#gum.colour).status == on,Disable,Enable) $+ : {
  147. $iif($group(#gum.colour).status == on,.disable,.enable) #gum.colour
  148. echo $color(info) -a Gummo's Colour Script is now $upper($group(#gum.colour).status) $+ .
  149. }
  150. .-
  151. .$iif(%gum.emoticon,$style(1)) Emoticons:$iif(%gum.emoticon,unset %gum.emoticon,set %gum.emoticon 1) | echo -a [Emotions turned $iif(%gum.emoticon,on,off) $+ .]
  152. .$iif(%betaon,$style(1)) Unstable Mode:$iif(%betaon,unset %betaon,set %betaon 1) | echo -a [Unstable Mode turned $iif(%betaon,on,off) $+ .]
  153. .$iif(%betaoff,$style(1)) Stable Mode:$iif(%betaoff,unset %betaoff,set %betaoff 1) | echo -a [Stable mode Turned $iif(%betaoff,on,off) $+ .]
  154. .$iif(%gum.autoformat,$style(1)) Automatic formatting:$iif(%gum.autoformat,unset %gum.autoformat,set %gum.autoformat 1) | echo -a [Automatic formatting turned $iif(%gum.autoformat,on,off) $+ .]
  155. .$iif(%gum.acronym,$style(1)) Acronyms:$iif(%gum.acronym,unset %gum.acronym,set %gum.acronym 1) | echo -a [Acronyms turned $iif(%gum.acronym,on,off) $+ .]
  156. .-
  157. ..$gum.colour.greyed Numbers
  158. ..$submenu($gum.colour.submenu(numbers,$1))
  159. .$gum.colour.greyed Background
  160. ..$submenu($gum.colour.submenu(background,$1))
  161. .$gum.colour.greyed Text
  162. ..$submenu($gum.colour.submenu(text,$1))
  163. .$gum.colour.greyed Punctuation
  164. ..$submenu($gum.colour.submenu(punctuation,$1))
  165. .$gum.colour.greyed Capitals
  166. ..$submenu($gum.colour.submenu(capitals,$1))
  167. .$gum.colour.greyed Nicknames
  168. ..$submenu($gum.colour.submenu(nicknames,$1))
  169. .-
  170. .$gum.colour.greyed Channel Brackets
  171. ..$submenu($gum.colour.submenu(chanbrac,$1))
  172. .$gum.colour.greyed Channel nick
  173. ..$submenu($gum.colour.submenu(channick,$1))
  174. .$gum.colour.greyed Channel Ops
  175. ..$submenu($gum.colour.submenu(chanops,$1))
  176. .$gum.colour.greyed PM bracket
  177. ..$submenu($gum.colour.submenu(pmbrac,$1))
  178. .$gum.colour.greyed pm nick
  179. ..$submenu($gum.colour.submenu(pmnick,$1))
  180. .$gum.colour.greyed action Channel Bracket
  181. ..$submenu($gum.colour.submenu(achanbrac,$1))
  182. .$gum.colour.greyed action Channel nick
  183. ..$submenu($gum.colour.submenu(achannick,$1))
  184. .$gum.colour.greyed action Channel Ops
  185. ..$submenu($gum.colour.submenu(achanops,$1))
  186. .$gum.colour.greyed action PM bracket
  187. ..$submenu($gum.colour.submenu(apmbrac,$1))
  188. .$gum.colour.greyed action pm nick
  189. ..$submenu($gum.colour.submenu(apmnick,$1))
  190. .-
  191. .First bracket:
  192. ....$iif($chr(40) iswm %gum.colour.brackets,$style(1)) (:set %gum.colour.brackets (
  193. ....$iif([ iswm %gum.colour.brackets,$style(1)) [:set %gum.colour.brackets [
  194. ....$iif(< iswm %gum.colour.brackets,$style(1)) <:set %gum.colour.brackets <
  195. .-
  196. .Second bracket:
  197. ....$iif($chr(41) iswm %gum.colour.brackets2,$style(1)) ):set %gum.colour.brackets2 )
  198. ....$iif(] iswm %gum.colour.brackets2,$style(1)) ]:set %gum.colour.brackets2 ]
  199. ....$iif(> iswm %gum.colour.brackets2,$style(1)) >:set %gum.colour.brackets2 >
  200. .-
  201. .$gum.colour.greyed(%gum.colour.easymodes) Easy Modes: {
  202. %gum.colour.easymodes = $iif(%gum.colour.easymodes,$false,$true)
  203. echo $color(info) -a Easy modes (typing a mode and then pressing ctrl+enter to set) are now $iif(%gum.colour.easymodes,enabled,disabled) $+ .
  204. }
  205. .$gum.colour.greyed(%gum.colour.highlightnick) Highlight Nicks: {
  206. %gum.colour.highlightnick = $iif(%gum.colour.highlightnick,$false,$true)
  207. echo $color(info) -a Nickname highlighting is now $iif(%gum.colour.highlightnick,enabled,disabled) $+ .
  208. }
  209. .$gum.colour.greyed(%gum.colour.highlightchan) Highlight Chans: {
  210. %gum.colour.highlightchan = $iif(%gum.colour.highlightchan,$false,$true)
  211. echo $color(info) -a Channel highlighting (as opposed to nickname highlighting) is now $iif(%gum.colour.highlightchan,enabled,disabled) $+ .
  212. }
  213. .$gum.colour.greyed(%gum.colour.bold) Bold Text: {
  214. %gum.colour.bold = $iif(%gum.colour.bold,$false,$true)
  215. echo $color(info) -a Bold text is now $iif(%gum.colour.bold,enabled,disabled) $+ .
  216. }
  217. .-
  218. .$gum.colour.greyed Presets
  219. ..$submenu($gum.colour.presetmenu($1))
  220. ..Delete preset:gum.colour.deletepreset
  221. .-
  222. .$gum.colour.greyed Reset to Defaults:if ($input(Are you really sure you want to reset to defaults? All of your current settings (other than presets) will be lost!,y,Reset to Defaults?)) gum.colour.reset -hard
  223. }
  224.  
  225. ; Special submenu for selecting a colour to save time coding
  226. alias -l gum.colour.submenu {
  227. ; The alias will never call 0, so we make a workaround
  228. var %n $2 - 1
  229. var %cmd :set % $+ gum.colour. $+ $$1
  230. if (%n isnum 0-15) return $iif($(% $+ gum.colour. $+ $1,2) == %n,$style(1)) $colourname(%n) $+ %cmd %n
  231. ; We can't put 99 here or it wouldn't work, so we'll just pretend it's 16 :)
  232. if ($1 == background) && (%n == 16) return $iif(%gum.colour.background == 99,$style(1)) $colourname(99) $+ %cmd 99
  233. }
  234.  
  235. ; Special submenu for sorted presets (from temporary list, created elsewhere
  236. alias gum.colour.presetmenu {
  237. if ($1 == 1) return Save As...:gum.colour.presetsave
  238. if ($1 == 2) return Refresh List:gum.colour.presetrefresh
  239. if ($1 == 3) return -
  240. if ($1 isnum) && ($gettok(%gum.colour.presetlist,$calc($1 - 3),44)) return $replace($v1,$chr(151),$chr(32)) $+ :gum.colour.presetload $v1
  241. }
  242. ; Simplify the menu a little by checking whether to grey-out and/or tick the options via simple maths
  243. alias -l gum.colour.greyed {
  244. var %x 0
  245. if ($group(#gum.colour).status != on) %x = %x + 2
  246. ; Allow for a tick when a variable was speficied and evaluated to $true
  247. if ($1 == $true) %x = %x + 1
  248. return $style(%x)
  249. }
  250.  
  251. ; Alias to reset variables to defaults (hard setting replaces ALL variables, soft or unspecified only fixes variables)
  252. alias -l gum.colour.reset {
  253. var %forced $false
  254. if ($1 == -hard) %forced = $true
  255. if ((%gum.colour.background !isnum 0-15) && (%gum.colour.background != 99)) || (%forced) set %gum.colour.background 1
  256. if (%gum.colour.text !isnum 0-15) || (%forced) set %gum.colour.text 3
  257. if (%gum.colour.punctuation !isnum 0-15) || (%forced) set %gum.colour.punctuation 0
  258. if (%gum.colour.capitals !isnum 0-15) || (%forced) set %gum.colour.capitals 9
  259. if (%gum.colour.nicknames !isnum 0-15) || (%forced) set %gum.colour.nicknames 11
  260. if (%gum.colour.numbers !isnum 0-15) || (%forced) set %gum.colour.numbers 6
  261. if (%gum.colour.easymodes == $null) || (%forced) set %gum.colour.easymodes $true
  262. if (%gum.colour.highlightnick == $null) || (%forced) set %gum.colour.highlightnick $true
  263. if (%gum.colour.highlightchan == $null) || (%forced) set %gum.colour.highlightchan $true
  264. if (%gum.colour.bold == $null) || (%forced) set %gum.colour.bold $false
  265. if (%gum.colour.channick == $null) || (%forced) set %gum.colour.channick 7
  266. if (%gum.colour.chanops == $null) || (%forced) set %gum.colour.chanops 8
  267. if (%gum.colour.chanbrac == $null) || (%forced) set %gum.colour.chanbrac 4
  268. if (%gum.colour.pmnick == $null) || (%forced) set %gum.colour.pmnick 7
  269. if (%gum.colour.pmbrac == $null) || (%forced) set %gum.colour.pmbrac 4
  270. if (%gum.colour.achannick == $null) || (%forced) set %gum.colour.achannick 13
  271. if (%gum.colour.achanops == $null) || (%forced) set %gum.colour.achanops 4
  272. if (%gum.colour.achanbrac == $null) || (%forced) set %gum.colour.achanbrac 6
  273. if (%gum.colour.apmnick == $null) || (%forced) set %gum.colour.apmnick 13
  274. if (%gum.colour.apmbrac == $null) || (%forced) set %gum.colour.apmbrac 6
  275. if (%gum.colour.brackets == $null) || (%forced) set %gum.colour.brackets (
  276. if (%gum.colour.brackets2 == $null) || (%forced) set %gum.colour.brackets2 )
  277. ; Refresh the preset colours list while we're at it
  278. gum.colour.presetrefresh
  279. ; If forced (hard reset), the user will expect to know
  280. if (%forced) echo $color(info) -a Gummo's Colour Script settings reset to defaults.
  281. }
  282.  
  283. ; This alias will load the specified preset colours
  284. alias -l gum.colour.presetload {
  285. var %settings $readini(gum.colour.ini,Presets,$$1)
  286. var %names background,text,punctuation,capitals,nicknames,numbers,brackets2,brackets,apmbrac,apmnick,achanbrac,achanops,achannick,pmnick,pmbrac,chanbrac,chanops,channick
  287. var %i 1
  288. while ($gettok(%names,%i,44)) {
  289. set $+(%,gum.colour.,$v1) $gettok(%settings,%i,44)
  290. inc %i
  291. }
  292. ; Let the user know we just loaded a preset
  293. echo $color(info) -a Preset colour configuration $qt($replace($1,$chr(151),$chr(32))) loaded.
  294. }
  295.  
  296. ; This alias will save the current colour configuration as a preset (with confirmation for over-write)
  297. alias -l gum.colour.presetsave {
  298. var %settings, %i 1
  299. var %names background,text,punctuation,capitals,nicknames,numbers,brackets2,brackets,apmbrac,apmnick,achanbrac,achanops,achannick,pmnick,pmbrac,chanbrac,chanops,channick
  300. var %name $input(Please enter a name to save for this colour preset:,e,Enter Preset Name)
  301. ; Replace spaces with a special dash (ASCII 151) to enable spaces in names and remove any commas for compatibility
  302. %name = $replace(%name,$chr(32),$chr(151),$chr(44),$null)
  303. if (%name) {
  304. ; Check for identical named colour preset
  305. if (!$readini(gum.colour.ini,Presets,%name)) || ($input(There is already a preset called $qt(%name) $+ . Do you want to over-write this preset?,y,Preset Already Exists)) {
  306. while ($gettok(%names,%i,44)) {
  307. %settings = $addtok(%settings,$($+(%,gum.colour.,$v1),2),44)
  308. inc %i
  309. }
  310. ; Write the data and let the user know (delete any existing entry first to enable case-sensitive renaming)
  311. remini gum.colour.ini Presets %name
  312. writeini gum.colour.ini Presets %name %settings
  313. echo $color(info) -a Preset colour configuration $qt(%name) saved.
  314. ; Refresh the presets list of it won't appear in there
  315. gum.colour.presetrefresh
  316. }
  317. }
  318. }
  319. ; This alias refreshes the list of presets (doing it as the menu opens is too intensive)
  320. alias -l gum.colour.presetrefresh {
  321. var %presets, %i
  322. %i = $ini(gum.colour.ini,Presets,0)
  323. while (%i) {
  324. %presets = $addtok(%presets,$ini(gum.colour.ini,Presets,%i),44)
  325. dec %i
  326. }
  327. ; Sort the list of presets for purely aesthetic purposes
  328. %presets = $sorttok(%presets,44,a)
  329. set %gum.colour.presetlist %presets
  330. }
  331.  
  332. ; Use this $colourname alias as you wish; customise it such that it matches your colours 0-15.
  333. alias colourname {
  334. ; I know this could be done with a $gettok but then it would be harder to understand (and change, for that matter)
  335. var %ret
  336. if ($1 == 00) %ret = White
  337. if ($1 == 01) %ret = Black
  338. if ($1 == 02) %ret = Dark Blue
  339. if ($1 == 03) %ret = Dark Green
  340. if ($1 == 04) %ret = Red
  341. if ($1 == 05) %ret = Maroon
  342. if ($1 == 06) %ret = Purple
  343. if ($1 == 07) %ret = Orange
  344. if ($1 == 08) %ret = Yellow
  345. if ($1 == 09) %ret = Light Green
  346. if ($1 == 10) %ret = Teal
  347. if ($1 == 11) %ret = Light Blue
  348. if ($1 == 12) %ret = Blue
  349. if ($1 == 13) %ret = Pink
  350. if ($1 == 14) %ret = Dark Grey
  351. if ($1 == 15) %ret = Light Grey
  352. if ($1 == 99) %ret = No Background
  353. return %ret
  354. }
  355. ; This just says thanks when they load the script, obviously
  356. on *:load: {
  357. echo $color(info) -a ---
  358. echo $color(info) -a Thanks for using Gummo's Colour Script. :D
  359. echo $color(info) -a Right-click in a channel or PM to customise.
  360. echo $color(info) -a ---
  361. }
  362.  
  363. ; Reset any missing variables upon startup ('soft' settings)
  364. on *:start: {
  365. gum.colour.reset -soft
  366. }
  367.  
  368. on *:unload: {
  369. unset %gum.colour.*
  370. echo $color(info) -a ---
  371. echo $color(info) -a Thanks for using Gummo's Colour Script, sorry you want to remove it. :P
  372. echo $color(info) -a All variables related to this script have been removed.
  373. if ($isfile(gum.colour.ini)) {
  374. if ($input(The presets configuration file $chr(40) $+ gum.colour.ini $+ $chr(41) has not been deleted. Would you like to delete it?,y,Delete Presets?)) {
  375. .remove gum.colour.ini
  376. echo $color(info) -a Presets configuration file deleted.
  377. }
  378. else echo $color(info) -a Presets configuration file remains.
  379. }
  380. echo $color(info) -a ---
  381. }
  382. ; Emotion Aliases
  383. alias c.ereg return (?<=[]})"'.?!:({[]| ['"]| ||^)(?:[DX'O:;x=>][])<ZOPFSGDVX3:;\|=([](?<![ods][fosbvp])|[\Q0xcvuo-><\E][_,.']+[\Q0xcvuo-><\E]|\.o\.)(?=[]})"'.?!:({[]| ['"]| |$)
  384. alias c.rand.upper.o return $replace($rand(1,7),1,Ø,2,Ò,3,Ó,4,Ô,5,Õ,6,Ö,7,©)
  385. alias c.rand.lower.o return $replace($rand(1,9),1,ø,2,ò,3,ó,4,ô,5,õ,6,ö,7,ð,8,¤,9,º)
  386. alias c.rand.hap return $replace($rand(1,6),1,$chr(41),2,›,3,»,4,>,5,$chr(125),6,])
  387. alias c.rand.unhap return $replace($rand(1,7),1,$chr(40),2,‹,3,«,4,¢,5,<,6,$chr(123),7,[)
  388. ; Alias for the preset Deleter
  389. alias -l gum.colour.deletepreset {
  390. $input(Please enter a name to Delete this colour preset:,e,Enter Preset Name)
  391. remini gum.colour.ini Presets %name
  392. echo -a Done Deleted preset %name
  393. gum.colour.presetrefresh
  394. }
Add Comment
Please, Sign In to add comment