Guest User

Untitled

a guest
Jan 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.91 KB | None | 0 0
  1. ; --------------------------------------------------------------
  2. ; ----------Gummo's Colour Script v4.6.2-------------
  3. ;----------EDITED A little by Spanky(Spencer)-----
  4. ; -------------------------V2-------------------------------
  5. #gum.colour on
  6. on *:input:*: {
  7. ; Don't try to do anything if user typed a command or pasted a lot of text (or pressed ctrl+enter, see below)
  8. if (/* iswm $1) || ($inpaste) return
  9. elseif ($ctrlenter) {
  10. ; Allow easy setting of modes (if enabled). +/- modes with ctrl+enter will set them in a channel. Arguments allowed.
  11. if (%gum.colour.easymodes) && ($me ison $target) && ($regex($1-,/^(?:[+-][a-z]+)+/i)) {
  12. mode $target $1-
  13. haltdef
  14. }
  15. return
  16. }
  17. ; used so you can do !op !deop etc etc feel free to delete this line if you don't want/need it
  18. if (!* iswm $1) return
  19. ; Don't colour messages in certain rooms to avoid annoying people and/or to your preference. This line is optional.
  20. if ($istok(#Staff #Oper #Opers #Services #Services-Log #Log #Support #Appeals #Abuse,$target,32)) return
  21. ; Stop the script if the channel blocks coloured messages (channel mode +c)
  22. ; Note the $gettok since 'c' can exist in one of the arguments. I've had trouble with that previously.
  23. if (c isincs $gettok($chan($target).mode,1,32)) return
  24. ; Point of no return! We've stopped mIRC's default actions now, so we have to send the message.
  25. haltdef
  26. ; Don't edit the following four lines. They create temporary variables from the permanent ones for simplicity.
  27. var %bg %gum.colour.background, %txt  $+ %gum.colour.text, %punc  $+ %gum.colour.punctuation
  28. var %caps  $+ %gum.colour.capitals, %nick  $+ %gum.colour.nicknames
  29. var %punc2  $+ $base($right(%punc,-1),10,10,2), %punc3 $+(%punc,$chr(44),%bg)
  30. var %punc4  $+ %gum.colour.numbers
  31. var %gum.colour.channick  $+ %gum.colour.channick
  32. var %gum.colour.chanops  $+ %gum.colour.chanops
  33. var %gum.colour.chanbrac  $+ %gum.colour.chanbrac
  34. var %gum.colour.pmnick  $+ %gum.colour.pmnick
  35. var %gum.colour.pmbrac  $+ %gum.colour.pmbrac
  36. var %gum.colour.achannick  $+ %gum.colour.achannick
  37. var %gum.colour.achanops  $+ %gum.colour.achanops
  38. var %gum.colour.achanbrac  $+ %gum.colour.achanbrac
  39. var %gum.colour.apmnick  $+ %gum.colour.apmnick
  40. var %gum.colour.apmbrac  $+ %gum.colour.apmbrac
  41. var %gum.colour.brackets %gum.colour.brackets (
  42. var %gum.colour.brackets2 %gum.colour.brackets2 )
  43. ; Preparing various variables
  44. var %regex, %chanregex, %puncregex, %nicks, %chans, %chanlist, %i 1
  45. ; Tokenize the text instead of putting it in a variable, to avoid mIRC's variable evaluation for simple maths..
  46. tokenize 32 $remove($strip($1-,rc),)
  47. ; Create a list of channels to be matched in the text, escaped to prepare it for regex.
  48. while ($chan(%i)) {
  49. %chanlist = $+(%chanlist,|\Q,$v1,\E)
  50. inc %i
  51. }
  52. ; sorts out the emotions
  53. 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,ƒ))
  54. 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])(?<![]^_`\\[])$/),)
  55. ; All of the Acronyms
  56. if (%gum.acronym) tokenize 32 $replacexcs($1-,>.>,».»,<.<,«.«,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-)
  57. ; Set the channel regular expression (for finding channels, both in channel and PM)
  58. %chanregex = /(?<=\s|[(,+%@&~?!]|(?<!\w)[])(?=#[^\s,+%@&~]{3})( $+ $right(%chanlist,-1) $+ )(?=[[:punct:]]*[\s,]|[](?!\w))/gi
  59. ; Set a slightly different nickname regular expression for queries as opposed to channels
  60. ; Queries only match you and the nick you PM, while channels match any possible nickname (and channel) to avoid big loops
  61. if ($query($target)) %regex = /(?<=\s|\s[[{]|(?<!\w)[]|[.,'"<(+%@&~/\\])(\Q $+ $me $+ \E|\Q $+ $target $+ \E)(?=[[:punct:]]*\s|['"/\\=*@.,]|[](?!\w))/gi
  62. elseif ($chan) %regex = /(?<=\s|(?<!\w)[]|[.,'"<(+%@&~/\\])(?!\d)([^-,./:-@~ ×÷]{3,})(?=[[:punct:]]*[\s,]|[/\\=*@.,]|['"](?=\S{3,}\s|[\s,])|[](?!\w))/gi
  63. ; Prepare the symbols/capitals/smileys regular expression (for simplicity later)
  64. %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
  65. ; If we're not sending text to a PM or channel, exit
  66. else return
  67. ; Now we'll move the channels (all known) into a variable and put ctrl+o in their place (to avoid confusion with ctrl+r)
  68. tokenize 32 $mid($regsubex(chans,/ $1- /,$iif(%gum.colour.highlightchan,%chanregex,),),3,-2)
  69. ; A simple loop to move the matched channels into the %chans variable
  70. %i = 1
  71. while ($regml(chans,%i)) {
  72. %chans = %chans $v1
  73. inc %i
  74. }
  75. ; Now we'll move the nicknames into a variable (known and potential alike) and put a ctrl+r in their place
  76. tokenize 32 $mid($regsubex(nicks,/ $1- /,$iif(%gum.colour.highlightnick,%regex,),),3,-2)
  77. ; Another simple loop to move the matched nicknames into the %nicks variable
  78. %i = 1
  79. while ($regml(nicks,%i)) {
  80. %nicks = %nicks $v1
  81. inc %i
  82. }
  83. ; If we were sending to a channel, remove potential nicknames which don't exist in the channel (and put them back into the text)
  84. ; Modified to also cater for channel matches
  85. if ($chan) {
  86. var %nn, %n $numtok(%nicks,32)
  87. while (%n) {
  88. %nn = $gettok(%nicks,%n,32)
  89. if (%nn !ison $chan) && ($me !ison %nn) {
  90. tokenize 32 $regsubex($1-,//g,$iif(\n == %n,%nn,))
  91. %nicks = $deltok(%nicks,%n,32)
  92. }
  93. dec %n
  94. }
  95. }
  96. ; Now remove those pesky extra ctrl+r characters in %nicks
  97. %nicks = $remtok(%nicks,,0,32)
  98. ; Colour capital letters, emoticons and punctuation in one line since this negates a need for workarounds of any kind.
  99. 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))
  100. ; Colour capital letters, emoticons and punctuation in one line since this negates a need for workarounds of any kind.
  101. 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))
  102. ; Loop through each channel, colouring it and putting it back in its original place
  103. if (%chans) tokenize 32 $regsubex($1-,//g,$+(%nick,$gettok(%chans,\n,32),%txt))
  104. ; Loop through each nickname, colouring it and putting it back in its original place
  105. if (%nicks) tokenize 32 $regsubex($1-,//g,$+(%nick,$gettok(%nicks,\n,32),%txt))
  106. ; Finalise colouring and remove unnecessary colours
  107. tokenize 32 $regsubex($+(%txt,$1-,),/(?:\d\d?(?:\x2C\d\d?)?)+/g,)
  108. tokenize 32 $regsubex($1-,/\d\d?(?:\x2C\d\d?)? /g,$chr(32) )
  109. 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
  110. ; Put the background colour at the start (minimise character use as much as possible, even though it's a lot of code for that)
  111. ; This prevents requiring two colour codes at the start for no reason
  112. ; Also added check to add bold character to the start (if applicable)
  113. 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)))
  114. ; Message to target change .msg to msg if you take off the themes
  115. echo $chan $timestamp $+(,,,%gum.colour.mechanbrac,,%gum.colour.mebrackets,,,%gum.colour.mechannick,$regsubex($iif($chan,$nick(#,$nick).pnick,$nick),/^([~&@%+])([~&@%+]*)/,$+(,,%gum.colour.mechanops,$replace(\1,$regml(2),$null),,,%gum.colour.mechannick)),,,%gum.colour.mechanbrac,%gum.colour.mebrackets2,) $+  $1-
  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 * {
  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 Channel Brackets for you
  177. ..$submenu($gum.colour.submenu(mechanbrac,$1))
  178. .$gum.colour.greyed Channel nick for you
  179. ..$submenu($gum.colour.submenu(mechannick,$1))
  180. .$gum.colour.greyed Channel Ops for you
  181. ..$submenu($gum.colour.submenu(mechanops,$1))
  182. .$gum.colour.greyed PM bracket
  183. ..$submenu($gum.colour.submenu(pmbrac,$1))
  184. .$gum.colour.greyed pm nick
  185. ..$submenu($gum.colour.submenu(pmnick,$1))
  186. .$gum.colour.greyed action Channel Bracket
  187. ..$submenu($gum.colour.submenu(achanbrac,$1))
  188. .$gum.colour.greyed action Channel nick
  189. ..$submenu($gum.colour.submenu(achannick,$1))
  190.  
  191. ..$submenu($gum.colour.submenu(achanops,$1))
  192. .$gum.colour.greyed action PM bracket
  193. ..$submenu($gum.colour.submenu(apmbrac,$1))
  194. .$gum.colour.greyed action pm nick
  195. ..$submenu($gum.colour.submenu(apmnick,$1))
  196. .-
  197. .First bracket:
  198. ....$iif($chr(40) iswm %gum.colour.brackets,$style(1)) (:set %gum.colour.brackets (
  199. ....$iif([ iswm %gum.colour.brackets,$style(1)) [:set %gum.colour.brackets [
  200. ....$iif(< iswm %gum.colour.brackets,$style(1)) <:set %gum.colour.brackets <
  201. .-
  202. .Second bracket:
  203. ....$iif($chr(41) iswm %gum.colour.brackets2,$style(1)) ):set %gum.colour.brackets2 )
  204. ....$iif(] iswm %gum.colour.brackets2,$style(1)) ]:set %gum.colour.brackets2 ]
  205. ....$iif(> iswm %gum.colour.brackets2,$style(1)) >:set %gum.colour.brackets2 >
  206. .-
  207. .First bracket for you:
  208. ....$iif($chr(40) iswm %gum.colour.brackets,$style(1)) (:set %gum.colour.brackets (
  209. ....$iif([ iswm %gum.colour.mebrackets,$style(1)) [:set %gum.colour.mebrackets [
  210. ....$iif(< iswm %gum.colour.mebrackets,$style(1)) <:set %gum.colour.mebrackets <
  211. .-
  212. .Second bracket for you:
  213. ....$iif($chr(41) iswm %gum.colour.mebrackets2,$style(1)) ):set %gum.colour.mebrackets2 )
  214. ....$iif(] iswm %gum.colour.mebrackets2,$style(1)) ]:set %gum.colour.mebrackets2 ]
  215. ....$iif(> iswm %gum.colour.mebrackets2,$style(1)) >:set %gum.colour.mebrackets2 >
  216. .-
  217. .$gum.colour.greyed(%gum.colour.easymodes) Easy Modes: {
  218. %gum.colour.easymodes = $iif(%gum.colour.easymodes,$false,$true)
  219. echo $color(info) -a Easy modes (typing a mode and then pressing ctrl+enter to set) are now $iif(%gum.colour.easymodes,enabled,disabled) $+ .
  220. }
  221. .$gum.colour.greyed(%gum.colour.highlightnick) Highlight Nicks: {
  222. %gum.colour.highlightnick = $iif(%gum.colour.highlightnick,$false,$true)
  223. echo $color(info) -a Nickname highlighting is now $iif(%gum.colour.highlightnick,enabled,disabled) $+ .
  224. }
  225. .$gum.colour.greyed(%gum.colour.highlightchan) Highlight Chans: {
  226. %gum.colour.highlightchan = $iif(%gum.colour.highlightchan,$false,$true)
  227. echo $color(info) -a Channel highlighting (as opposed to nickname highlighting) is now $iif(%gum.colour.highlightchan,enabled,disabled) $+ .
  228. }
  229. .$gum.colour.greyed(%gum.colour.bold) Bold Text: {
  230. %gum.colour.bold = $iif(%gum.colour.bold,$false,$true)
  231. echo $color(info) -a Bold text is now $iif(%gum.colour.bold,enabled,disabled) $+ .
  232. }
  233. .-
  234. .$gum.colour.greyed Presets
  235. ..$submenu($gum.colour.presetmenu($1))
  236. ..Delete preset:gum.colour.deletepreset
  237. .-
  238. .$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
  239. }
  240.  
  241. ; Special submenu for selecting a colour to save time coding
  242. alias -l gum.colour.submenu {
  243. ; The alias will never call 0, so we make a workaround
  244. var %n $2 - 1
  245. var %cmd :set % $+ gum.colour. $+ $$1
  246. if (%n isnum 0-15) return $iif($(% $+ gum.colour. $+ $1,2) == %n,$style(1)) $colourname(%n) $+ %cmd %n
  247. ; We can't put 99 here or it wouldn't work, so we'll just pretend it's 16 :)
  248. if ($1 == background) && (%n == 16) return $iif(%gum.colour.background == 99,$style(1)) $colourname(99) $+ %cmd 99
  249. }
  250.  
  251. ; Special submenu for sorted presets (from temporary list, created elsewhere
  252. alias gum.colour.presetmenu {
  253. if ($1 == 1) return Save As...:gum.colour.presetsave
  254. if ($1 == 2) return Refresh List:gum.colour.presetrefresh
  255. if ($1 == 3) return -
  256. if ($1 isnum) && ($gettok(%gum.colour.presetlist,$calc($1 - 3),44)) return $replace($v1,$chr(151),$chr(32)) $+ :gum.colour.presetload $v1
  257. }
  258. ; Simplify the menu a little by checking whether to grey-out and/or tick the options via simple maths
  259. alias -l gum.colour.greyed {
  260. var %x 0
  261. if ($group(#gum.colour).status != on) %x = %x + 2
  262. ; Allow for a tick when a variable was speficied and evaluated to $true
  263. if ($1 == $true) %x = %x + 1
  264. return $style(%x)
  265. }
  266.  
  267. ; Alias to reset variables to defaults (hard setting replaces ALL variables, soft or unspecified only fixes variables)
  268. alias -l gum.colour.reset {
  269. var %forced $false
  270. if ($1 == -hard) %forced = $true
  271. if ((%gum.colour.background !isnum 0-15) && (%gum.colour.background != 99)) || (%forced) set %gum.colour.background 1
  272. if (%gum.colour.text !isnum 0-15) || (%forced) set %gum.colour.text 3
  273. if (%gum.colour.punctuation !isnum 0-15) || (%forced) set %gum.colour.punctuation 0
  274. if (%gum.colour.capitals !isnum 0-15) || (%forced) set %gum.colour.capitals 9
  275. if (%gum.colour.nicknames !isnum 0-15) || (%forced) set %gum.colour.nicknames 11
  276. if (%gum.colour.numbers !isnum 0-15) || (%forced) set %gum.colour.numbers 6
  277. if (%gum.colour.easymodes == $null) || (%forced) set %gum.colour.easymodes $true
  278. if (%gum.colour.highlightnick == $null) || (%forced) set %gum.colour.highlightnick $true
  279. if (%gum.colour.highlightchan == $null) || (%forced) set %gum.colour.highlightchan $true
  280. if (%gum.colour.bold == $null) || (%forced) set %gum.colour.bold $false
  281. if (%gum.colour.channick == $null) || (%forced) set %gum.colour.channick 7
  282. if (%gum.colour.chanops == $null) || (%forced) set %gum.colour.chanops 8
  283. if (%gum.colour.chanbrac == $null) || (%forced) set %gum.colour.chanbrac 4
  284. if (%gum.colour.mechannick == $null) || (%forced) set %gum.colour.mechannick 7
  285. if (%gum.colour.mechanops == $null) || (%forced) set %gum.colour.mechanops 8
  286. if (%gum.colour.mechanbrac == $null) || (%forced) set %gum.colour.mechanbrac 4
  287. if (%gum.colour.pmnick == $null) || (%forced) set %gum.colour.pmnick 7
  288. if (%gum.colour.pmbrac == $null) || (%forced) set %gum.colour.pmbrac 4
  289. if (%gum.colour.achannick == $null) || (%forced) set %gum.colour.achannick 13
  290. if (%gum.colour.achanops == $null) || (%forced) set %gum.colour.achanops 4
  291. if (%gum.colour.achanbrac == $null) || (%forced) set %gum.colour.achanbrac 6
  292. if (%gum.colour.apmnick == $null) || (%forced) set %gum.colour.apmnick 13
  293. if (%gum.colour.apmbrac == $null) || (%forced) set %gum.colour.apmbrac 6
  294. if (%gum.colour.brackets == $null) || (%forced) set %gum.colour.brackets (
  295. if (%gum.colour.brackets2 == $null) || (%forced) set %gum.colour.brackets2 )
  296. if (%gum.colour.mebrackets == $null) || (%forced) set %gum.colour.mebrackets (
  297. if (%gum.colour.mebrackets2 == $null) || (%forced) set %gum.colour.mebrackets2 )
  298. ; Refresh the preset colours list while we're at it
  299. gum.colour.presetrefresh
  300. ; If forced (hard reset), the user will expect to know
  301. if (%forced) echo $color(info) -a Gummo's Colour Script settings reset to defaults.
  302. }
  303.  
  304. ; This alias will load the specified preset colours
  305. alias -l gum.colour.presetload {
  306. var %settings $readini(gum.colour.ini,Presets,$$1)
  307. var %names background,text,punctuation,capitals,nicknames,numbers,mebrackets2,mebrackets,brackets2,brackets,apmbrac,apmnick,achanbrac,achanops,achannick,pmnick,pmbrac,mechanbrac,mechanops,mechannick,chanbrac,chanops,channick
  308. var %i 1
  309. while ($gettok(%names,%i,44)) {
  310. set $+(%,gum.colour.,$v1) $gettok(%settings,%i,44)
  311. inc %i
  312. }
  313. ; Let the user know we just loaded a preset
  314. echo $color(info) -a Preset colour configuration $qt($replace($1,$chr(151),$chr(32))) loaded.
  315. }
  316.  
  317. ; This alias will save the current colour configuration as a preset (with confirmation for over-write)
  318. alias -l gum.colour.presetsave {
  319. var %settings, %i 1
  320. var %names background,text,punctuation,capitals,nicknames,numbers,mechanbrac,mechanops,mechannick,mebrackets2,mebrackets,brackets2,brackets,apmbrac,apmnick,achanbrac,achanops,achannick,pmnick,pmbrac,chanbrac,chanops,channick
  321. var %name $input(Please enter a name to save for this colour preset:,e,Enter Preset Name)
  322. ; Replace spaces with a special dash (ASCII 151) to enable spaces in names and remove any commas for compatibility
  323. %name = $replace(%name,$chr(32),$chr(151),$chr(44),$null)
  324. if (%name) {
  325. ; Check for identical named colour preset
  326. 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)) {
  327. while ($gettok(%names,%i,44)) {
  328. %settings = $addtok(%settings,$($+(%,gum.colour.,$v1),2),44)
  329. inc %i
  330. }
  331. ; Write the data and let the user know (delete any existing entry first to enable case-sensitive renaming)
  332. remini gum.colour.ini Presets %name
  333. writeini gum.colour.ini Presets %name %settings
  334. echo $color(info) -a Preset colour configuration $qt(%name) saved.
  335. ; Refresh the presets list of it won't appear in there
  336. gum.colour.presetrefresh
  337. }
  338. }
  339. }
  340. ; This alias refreshes the list of presets (doing it as the menu opens is too intensive)
  341. alias -l gum.colour.presetrefresh {
  342. var %presets, %i
  343. %i = $ini(gum.colour.ini,Presets,0)
  344. while (%i) {
  345. %presets = $addtok(%presets,$ini(gum.colour.ini,Presets,%i),44)
  346. dec %i
  347. }
  348. ; Sort the list of presets for purely aesthetic purposes
  349. %presets = $sorttok(%presets,44,a)
  350. set %gum.colour.presetlist %presets
  351. }
  352.  
  353. ; Use this $colourname alias as you wish; customise it such that it matches your colours 0-15.
  354. alias colourname {
  355. ; I know this could be done with a $gettok but then it would be harder to understand (and change, for that matter)
  356. var %ret
  357. if ($1 == 00) %ret = White
  358. if ($1 == 01) %ret = Black
  359. if ($1 == 02) %ret = Dark Blue
  360. if ($1 == 03) %ret = Dark Green
  361. if ($1 == 04) %ret = Red
  362. if ($1 == 05) %ret = Maroon
  363. if ($1 == 06) %ret = Purple
  364. if ($1 == 07) %ret = Orange
  365. if ($1 == 08) %ret = Yellow
  366. if ($1 == 09) %ret = Light Green
  367. if ($1 == 10) %ret = Teal
  368. if ($1 == 11) %ret = Light Blue
  369. if ($1 == 12) %ret = Blue
  370. if ($1 == 13) %ret = Pink
  371. if ($1 == 14) %ret = Dark Grey
  372. if ($1 == 15) %ret = Light Grey
  373. if ($1 == 99) %ret = No Background
  374. return %ret
  375. }
  376. ; This just says thanks when they load the script, obviously
  377. on *:load: {
  378. echo $color(info) -a ---
  379. echo $color(info) -a Thanks for using Gummo's Colour Script. :D
  380. echo $color(info) -a Right-click in a channel or PM to customise.
  381. echo $color(info) -a ---
  382. }
  383.  
  384. ; Reset any missing variables upon startup ('soft' settings)
  385. on *:start: {
  386. gum.colour.reset -soft
  387. }
  388.  
  389. on *:unload: {
  390. unset %gum.colour.*
  391. echo $color(info) -a ---
  392. echo $color(info) -a Thanks for using Gummo's Colour Script, sorry you want to remove it. :P
  393. echo $color(info) -a All variables related to this script have been removed.
  394. if ($isfile(gum.colour.ini)) {
  395. 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?)) {
  396. .remove gum.colour.ini
  397. echo $color(info) -a Presets configuration file deleted.
  398. }
  399. else echo $color(info) -a Presets configuration file remains.
  400. }
  401. echo $color(info) -a ---
  402. }
  403. ; Emotion Aliases
  404. alias c.ereg return (?<=[]})"'.?!:({[]| ['"]| ||^)(?:[DX'O:;x=>][])<ZOPFSGDVX3:;\|=([](?<![ods][fosbvp])|[\Q0xcvuo-><\E][_,.']+[\Q0xcvuo-><\E]|\.o\.)(?=[]})"'.?!:({[]| ['"]| |$)
  405. alias c.rand.upper.o return $replace($rand(1,7),1,Ø,2,Ò,3,Ó,4,Ô,5,Õ,6,Ö,7,©)
  406. alias c.rand.lower.o return $replace($rand(1,9),1,ø,2,ò,3,ó,4,ô,5,õ,6,ö,7,ð,8,¤,9,º)
  407. alias c.rand.hap return $replace($rand(1,6),1,$chr(41),2,›,3,»,4,>,5,$chr(125),6,])
  408. alias c.rand.unhap return $replace($rand(1,7),1,$chr(40),2,‹,3,«,4,¢,5,<,6,$chr(123),7,[)
  409. ; Alias for the preset Deleter
  410. alias -l gum.colour.deletepreset {
  411. $input(Please enter a name to Delete this colour preset:,e,Enter Preset Name)
  412. remini gum.colour.ini Presets %name
  413. echo -a Done Deleted preset %name
  414. gum.colour.presetrefresh
Add Comment
Please, Sign In to add comment