Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.05 KB | None | 0 0
  1.  
  2. menu * {
  3. Text Colors $chr(9) /colors:colors
  4. }
  5. menu channel {
  6. $ChannelCheck($chan):ChannelCheck
  7. }
  8. alias ChannelCheck {
  9. if $isid {
  10. if !%colors.chans { return }
  11. elseif %colors.chans == 1 {
  12. if $findtok(%colors.chans.list,$+($network,?,#),44) { set %colors.cmd remove $+($network,?,#) | return Blacklist # colors on $network }
  13. else { set %colors.cmd add $+($network,?,#) | return Whitelist # colors on $network }
  14. }
  15. elseif %colors.chans == 2 {
  16. if $findtok(%colors.chans.list,$+($network,?,#),44) { set %colors.cmd remove $+($network,?,#) | return Allow # colors on $network }
  17. else { set %colors.cmd add $+($network,?,#) | return Disallow # colors on $network }
  18. }
  19. }
  20. else {
  21. echo -a %colors.cmd
  22. tokenize 32 %colors.cmd
  23. if $$1 == add { set %colors.chans.list $+(%colors.chans.list,$chr(44),$$2) }
  24. elseif $$1 == remove { set %colors.chans.list $remtok(%colors.chans.list,$$2,0,44) }
  25. if $left(%colors.chans.list,1) == $chr(44) { set %colors.chans.list $right(%colors.chans.list,-1) }
  26. unset %colors.cmd
  27. }
  28. }
  29. alias Colors {
  30. if $MDX == -1 {
  31. if $input(To use this script you need MDX.dll - Do you want to download it now?,yq,Download MDX?) == $true { GetMDX }
  32. }
  33. else { dialog $iif($dialog(colors),-v,-m) Colors Colors }
  34. }
  35. alias MDX { return $iif($isfile($qt(MDX.dll)),$shortfn($qt(MDX.dll)),-1) }
  36. alias ColorsSecondary return $gettok(%colors.sel,2,44)
  37. dialog Colors {
  38. title "Color Selector [©J44]"
  39. size -1 -1 100 70
  40. option dbu
  41. radio "All text colored", 100, 3 2 54 10
  42. radio "First letters", 101, 3 12 54 10
  43. radio "None", 102, 3 22 54 10
  44. box "", 103, 60 -10 2 45
  45. box "", 104, 0 31 100 5
  46. check "Bold", 105, 3 36 54 9
  47. check "Underline", 106, 3 44 54 9
  48. box "", 107, 0 50 100 5
  49. text "Color Code", 200, 65 2 30 9, center
  50. edit %colors.sel, 201, 65 11 30 10
  51. text "", 202, 65 23 30 7, center
  52. button "Set", 300, 2 56 58 13
  53. button "Cancel", 301, 62 56 36 13
  54. button "Options", 302, 62 38 36 13
  55. }
  56. on *:Dialog:Colors:*:*: {
  57. if $devent == init {
  58. dll $MDX SetMircVersion $version
  59. dll $MDX MarkDialog $dname
  60. did -cf colors $iif(!%colors.setting,102,$iif(%colors.setting = 1,100,101))
  61. did $iif(%colors.bold,-c,-u) Colors 105
  62. did $iif(%colors.underline,-c,-u) Colors 106
  63. var %colors = WHITE BLACK D.BLUE D.GREEN RED BROWN PURPLE ORANGE YELLOW L.GREEN S.BLUE L.BLUE D.BLUE PINK D.GREY L.GREY
  64. did -rae colors 202 $gettok(%colors,$calc($gettok($did(201).text,1,44) +1),32)
  65. if !$gettok(%colors.sel,2,44) { dll $MDX SetColor 202 text $color($did(201).text) }
  66. else {
  67. dll $MDX SetColor 202 text $color($gettok($did(201).text,1,44))
  68. dll $MDX SetColor 202 background $color($gettok($did(201).text,2,44))
  69. dll $MDX SetColor 202 textbg $color($gettok($did(201).text,2,44))
  70. }
  71. if (!%colors.setting) did -b colors 201,202
  72. }
  73. elseif $devent == sclick {
  74. if $did == 100 {
  75. did -e colors 201,202,105,106,302
  76. did $iif($did(201).text isnum 0-15 || ($gettok($did(201).text,1,44) isnum 0-15 && $gettok($did(201).text,2,44) isnum 0-15),-e,-b) colors 300
  77. }
  78. elseif $did == 101 {
  79. did -e colors 201,202,105,106,302
  80. did $iif($did(201).text isnum 0-15 || ($gettok($did(201).text,1,44) isnum 0-15 && $gettok($did(201).text,2,44) isnum 0-15),-e,-b) colors 300
  81. }
  82. elseif $did == 102 {
  83. did -b colors 201,202,105,106,302
  84. did -e colors 300
  85. }
  86. elseif $did == 105 { set %colors.bold $iif($did(105).state,1,0) }
  87. elseif $did == 106 { set %colors.underline $iif($did(106).state,1,0) }
  88. elseif $did == 300 {
  89. $iif($did(102).state,unset,set) %colors.setting $iif($did(100).state,1,2)
  90. if $did(100).state || $did(101).state { set %colors.sel $did(201).text }
  91. dialog -x colors
  92. }
  93. elseif $did == 301 { dialog -x colors }
  94. elseif $did == 302 { dialog $iif($dialog(ColorsOptions),-v,-m ColorsOptions) ColorsOptions }
  95. }
  96. elseif $devent == edit {
  97. if $did == 201 {
  98. var %colors = WHITE BLACK D.BLUE D.GREEN RED BROWN PURPLE ORANGE YELLOW L.GREEN S.BLUE L.BLUE D.BLUE PINK D.GREY L.GREY
  99. if !$regex($did(201).text,$chr(44)) {
  100. did $iif($did(201).text isnum 0-15,-e,-b) colors 300
  101. did $iif($did(201).text isnum 0-15,-rae,-rb) colors 202 $gettok(%colors,$calc($did(201).text +1),32)
  102. dll $MDX SetColor 202 text $color($did(201).text)
  103. dll $MDX SetColor 202 background reset
  104. dll $MDX SetColor 202 textbg reset
  105. }
  106. else {
  107. if $gettok($did(201).text,1,44) isnum 0-15 && $gettok($did(201).text,2,44) isnum 0-15 {
  108. did -e colors 300
  109. did -rae colors 202 $gettok(%colors,$calc($gettok($did(201).text,1,44) +1),32)
  110. dll $MDX SetColor 202 text $color($gettok($did(201).text,1,44))
  111. dll $MDX SetColor 202 background $color($gettok($did(201).text,2,44))
  112. dll $MDX SetColor 202 textbg $color($gettok($did(201).text,2,44))
  113. }
  114. else {
  115. did -b colors 300
  116. did -rb colors 202
  117. }
  118. }
  119. }
  120. }
  121. }
  122. dialog ColorsOptions {
  123. title "Colors Options [©J44]"
  124. size -1 -1 100 60
  125. option dbu
  126. radio "Allow these channels", 101, 3 2 70 10
  127. radio "Disallow these channels", 102, 3 12 70 10
  128. radio "Allow all channels", 103, 3 22 70 10
  129. edit "", 201, 3 33 94 10
  130. button "Done", 301, 2 45 58 13
  131. button "?", 302, 62 45 36 13
  132. }
  133. on *:Dialog:ColorsOptions:*:*: {
  134. if $devent = init {
  135. did -ra ColorsOptions 201 %colors.chans.list
  136. if !%colors.chans { did -c ColorsOptions 103 | did -b ColorsOptions 201 }
  137. elseif %colors.chans == 1 { did -c ColorsOptions 101 }
  138. elseif %colors.chans == 2 { did -c ColorsOptions 102 }
  139. }
  140. elseif $devent = sclick {
  141. if $did isnum 101-103 {
  142. if $did == 101 { set %colors.chans 1 | did -e ColorsOptions 201 }
  143. elseif $did == 102 { set %colors.chans 2 | did -e ColorsOptions 201 }
  144. else { set %colors.chans 0 | did -b ColorsOptions 201 }
  145. }
  146. elseif $did == 301 {
  147. if $calc($count($did(201).text,$chr(35)) -1) > $count($did(201).text,$chr(44)) {
  148. if $input(You have specified more channels than comma spaces. If you're sure it's correct press "Yes'". Else you can edit by pressing "No" $crlf $crlf $+ $&
  149. Each channel must be seperated by a comma. Eg. $+(#123,$chr(44),#xyz,$chr(44),#nmo),yq) == $false {
  150. halt
  151. }
  152. }
  153. else {
  154. %colors.chans.list = $did(201).text
  155. dialog -x ColorsOptions
  156. }
  157. }
  158. elseif $did == 302 {
  159. var %msg = Some channels have more strict rules for the text formatting that is used. $&
  160. Some don't allow colors / bold / underline / backgrounds or a mixture of all of those. $crlf $crlf $+ $&
  161. In this case select either only the channels you want to use the colored text on or the channels you don't want the colored text to appear on. $crlf $crlf $+ $&
  162. For the channels use a COMMA to seperate values. 'EzzyChat?#lobby' for server specific or '#lobby' for non-specific $crlf $crlf $+ $&
  163. Current network is: $network
  164. noop $input(%msg,io,Information)
  165. }
  166. }
  167. }
  168. on *:INPUT:*: {
  169. if (!$regex($1,/^\//)) && (c !isincs $chan($chan).mode) {
  170. if %colors.setting {
  171. var %allow = 0
  172. if (!%colors.chans) { %allow = 1 }
  173. else {
  174. if $findtok(%colors.chans.list,$chan,44) { var %found = 1 }
  175. elseif $findtok(%colors.chans.list,$+($network,?,$chan),44) { var %found = 1 }
  176. if %colors.chans == 1 { var %allow = $iif(%found == 1,1,0) }
  177. elseif %colors.chans == 2 { var %allow = $iif(%found == 1,0,1) }
  178. }
  179. }
  180. if %colors.setting == 1 && %allow = 1 {
  181. msg $active $+($iif(%colors.bold,),$iif(%colors.underline,),,$base($gettok(%colors.sel,1,44),10,10,2),$iif($regex(%colors.sel,$chr(44)),$chr(44),),$base($gettok(%colors.sel,2,44),10,10,2),$$1-)
  182. ;enter a custom regex here if you like
  183. ;if you still want to use the allow/disallow functions
  184. ;but not only simple coloring.
  185. halt
  186. }
  187. elseif %colors.setting == 2 && %allow = 1 {
  188. ;first letter of words only msg
  189. var %txtColored = $regsubex($$1-,/\W(.)/giS,$+($chr(32),,$base($gettok(%colors.sel,1,44),10,10,2),\t,))
  190. msg $active $+($iif(%colors.bold,),$iif(%colors.underline,),%txtColored)
  191. halt
  192. }
  193. }
  194. }
  195. ; Download the MDX.dll file.
  196. alias GetMDX {
  197. noop $input(MDX.dll is now downloading. The color selector will open when the download completes. Please wait,io,MDX.dll)
  198. if ($isfile($qt(MDX.dll))) .remove $qt(MDX.dll)
  199. sockopen GetMDX wfs.myartsonline.com 80
  200. sockmark GetMDX $1-
  201. }
  202. on *:sockopen:GetMDX:{
  203. sockwrite -nt $sockname GET /downloads/mdx.dll HTTP/1.0
  204. sockwrite -n $sockname Host: wfs.myartsonline.com $+ $crlf $+ $crlf
  205. }
  206. on *:sockread:GetMDX:{
  207. sockread &GetMDX
  208. bwrite MDX.dll.tmp -1 -1 &GetMDX
  209. }
  210. on *:sockclose:GetMDX: {
  211. var %x 1
  212. bread MDX.dll.tmp 0 $file(MDX.dll.tmp).size &buff
  213. while ($bvar(&buff,%x,4) != 13 10 13 10) inc %x
  214. inc %x 4
  215. bcopy &buffer 1 &buff %x -1
  216. bwrite MDX.dll -1 -1 &buffer
  217. .remove MDX.dll.tmp
  218. Colors
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement