Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.80 KB | None | 0 0
  1. /*
  2. unRealIRC
  3. Acronym Replace / Color Text Configuration
  4. Scripted By: DarkWarrior
  5. Version 3.0
  6. */
  7.  
  8. alias acro {
  9. if ($dialog(acro)) { dialog -v acro acro }
  10. else { dialog -vmd acro acro }
  11. }
  12.  
  13. alias facro dialog -m facro facro
  14.  
  15. on *:START: {
  16. hmake acronyms 10 | hload acronyms acronyms.hsh
  17. hmake facronyms 10 | hload facronyms facronyms.hsh
  18. }
  19.  
  20. on *:EXIT: { hsave acronyms acronyms.hsh | hsave facronyms facronyms.hsh }
  21.  
  22. alias refresh.acronyms {
  23. did -ra $dname 19 Total Acronyms: $hget(acronyms,0).item
  24. did -r $dname 7
  25. var %a = 1
  26. while (%a <= $hget(acronyms,0).item) {
  27. did -a $dname 7 $gettok($hget(acronyms,%a).item,1,32)
  28. inc %a
  29. }
  30. }
  31.  
  32. alias -l preview.acro {
  33. if ($dialog(acro)) {
  34. window -hp +f @Preview.Acro 0 0 150 25
  35. if ($isfile($scriptdirapreview.bmp)) { .remove $scriptdirapreview.bmp }
  36. drawtext -p @Preview.Acro $color(own) $qt($gettok($ttok(Font),2,32)) $gettok($ttok(Font),1,32) 1 1 [ $skin(Laughing Out Load) [ $+ [ $gettok(%acro.color,2,32) ] ] ]
  37. drawsave @Preview.Acro $scriptdirapreview.bmp
  38. window -c @Preview.Acro
  39. did -gv $dname 18 $scriptdirapreview.bmp
  40. }
  41. }
  42.  
  43. dialog acro {
  44. title "Acronym Configuration"
  45. size -1 -1 282 106
  46. option dbu
  47. edit "", 1, 7 19 60 10, disable
  48. text "Acronym: (ie. lol)", 2, 7 11 70 8, disable
  49. edit "", 3, 7 40 60 10, disable autohs
  50. text "Meaning: (ie. Laughing Out Loud)", 4, 7 32 84 8, disable
  51. button "Add", 5, 7 55 50 10
  52. button "Delete", 6, 7 68 50 10
  53. list 7, 95 20 60 75, sort size
  54. button "", 8, 7 81 50 10
  55. box "Settings", 9, 165 5 114 87
  56. check "Enable Acronyms", 10, 170 14 54 10
  57. text "Color Options:", 11, 170 27 42 8, disable
  58. radio "Normal", 12, 170 37 29 10
  59. radio "No Brackets", 13, 211 37 50 10
  60. radio "Secondary", 14, 170 47 36 10
  61. radio "Second \ No Brackets", 15, 211 48 61 10
  62. radio "No Color", 16, 170 57 35 10
  63. radio "No Color \ No Brackets", 17, 211 57 63 10
  64. icon 18, 183 72 70 10, $scriptdirapreview.bmp, 0
  65. edit "", 19, 95 9 60 10, read
  66. button "Exit", 20, 7 94 50 10, ok
  67. }
  68.  
  69. on *:dialog:acro:init:*: {
  70. refresh.acronyms
  71. preview.acro
  72. did -a $dname 8 Edit
  73. if (%acro.on) did -c $dname 10
  74. did -c $dname $gettok(%acro.color,1,32)
  75. }
  76.  
  77. on *:dialog:acro:sclick:*: {
  78. if ($did == 5) {
  79. if ($did(8) != Cancel Edit) {
  80. if ($did(8) != Cancel Add) {
  81. did -er $dname 1,3
  82. did -b $dname 6
  83. did -ra $dname 8 Cancel Add
  84. }
  85. else {
  86. if ($did(1)) && ($did(3)) {
  87. if (!$hget(acronyms,$gettok($did(1),1,32))) {
  88. hadd acronyms $gettok($did(1),1,32) $did(3)
  89. refresh.acronyms
  90. did -r $dname 1,3
  91. }
  92. }
  93. }
  94. }
  95. elseif ($did(8) == Cancel Edit) {
  96. if ($did(1)) && ($did(3)) {
  97. hdel acronyms $did(7).seltext
  98. hadd acronyms $did(1) $did(3)
  99. did -r $dname 1,3
  100. refresh.acronyms
  101. }
  102. }
  103. }
  104. if ($did == 6) {
  105. hdel acronyms $did(7).seltext
  106. did -r $dname 1,3
  107. refresh.acronyms
  108. }
  109. if ($did == 7) {
  110. did -ra $dname 1 $did(7).seltext
  111. did -ra $dname 3 $hget(acronyms,$did(7).seltext)
  112. }
  113. if ($did == 8) {
  114. if ($did(8) == Cancel Add) {
  115. did -rb $dname 1,3
  116. did -e $dname 6
  117. did -ra $dname 8 Edit
  118. }
  119. elseif ($did(8) == Edit) {
  120. did -e $dname 1,3
  121. did -b $dname 6
  122. did -ra $dname 8 Cancel Edit
  123. }
  124. elseif ($did(8) == Cancel Edit) {
  125. did -br $dname 1,3
  126. did -e $dname 6
  127. did -ra $dname 8 Edit
  128. }
  129. }
  130. if ($did == 10) {
  131. if ($did(10).state == 0) { unset %acro.on }
  132. elseif ($did(10).state == 1) { set %acro.on on }
  133. }
  134. if ($did isin 12 13 14 15 16 17) { set %acro.color $did $aprop($did) | preview.acro }
  135. }
  136.  
  137. alias -l aprop {
  138. if ($1 == 12) { return $null }
  139. if ($1 == 13) { return .bn }
  140. if ($1 == 14) { return .s }
  141. if ($1 == 15) { return .bs }
  142. if ($1 == 16) { return .b }
  143. if ($1 == 17) { return .n }
  144. }
  145.  
  146. dialog facro {
  147. title "Color Text Configuration"
  148. size -1 -1 119 49
  149. option dbu
  150. text "Text:", 1, 4 6 25 8, disable
  151. edit "", 2, 4 16 50 10, disable read autohs
  152. button "Add", 3, 8 27 37 10
  153. button "Delete", 4, 8 37 37 10
  154. list 5, 64 6 50 37, size
  155. }
  156.  
  157. on *:dialog:facro:*:*: { if ($devent == init) { did -r $dname 5
  158. var %a = 1
  159. while (%a <= $hget(facronyms,0).item) { did -a $dname 5 $gettok($hget(facronyms,%a).item,1,32)
  160. inc %a }
  161. }
  162. if ($devent == sclick) {
  163. if ($did == 3) { var %face = $$?="New Text: (ie. Lulz, =])"
  164. if ($hget(facronyms,$gettok(%face,1,32))) {
  165. echo -a ERROR: Face already exists.
  166. halt }
  167. hadd facronyms $gettok(%face,1,32) $gettok(%face,1,32)
  168. did -r $dname 5
  169. var %a = 1
  170. while (%a <= $hget(facronyms,0).item) { did -a $dname 5 $gettok($hget(facronyms,%a).item,1,32)
  171. inc %a }
  172. }
  173. if ($did == 4) {
  174. hdel facronyms $did(5).seltext
  175. did -r $dname 5
  176. did -r $dname 2
  177. var %a = 1
  178. while (%a <= $hget(facronyms,0).item) { did -a $dname 5 $gettok($hget(facronyms,%a).item,1,32)
  179. inc %a }
  180. }
  181. if ($did == 5) {
  182. if ($did(5).sel != $null) { did -ra $dname 2 $hget(facronyms,$did(5).sel).item }
  183. }
  184. }
  185. }
  186. /*
  187. on *:dialog:acro:*:*: { if ($devent == init) { did -r $dname 9
  188. var %a = 1
  189. while (%a <= $hget(acronyms,0).item) { did -a $dname 9 $gettok($hget(acronyms,%a).item,1,32)
  190. inc %a }
  191. }
  192. if ($devent == sclick) {
  193. if ($did == 6) { var %acro = $$?="Acronym: (ie. lol)"
  194. if ($hget(acronyms,$gettok(%acro,1,32))) {
  195. echo -a ERROR: Acronym already exists.
  196. halt }
  197. else var %meaning = $$?="Meaning: (ie. Laughing Out Loud)"
  198. hadd acronyms $gettok(%acro,1,32) %meaning
  199. did -r $dname 9
  200. var %a = 1
  201. while (%a <= $hget(acronyms,0).item) { did -a $dname 9 $gettok($hget(acronyms,%a).item,1,32)
  202. inc %a }
  203. }
  204. if ($did == 7) {
  205. hdel acronyms $did(9).seltext
  206. did -r $dname 9
  207. did -r $dname 1
  208. did -r $dname 3
  209. var %a = 1
  210. while (%a <= $hget(acronyms,0).item) { did -a $dname 9 $gettok($hget(acronyms,%a).item,1,32)
  211. inc %a }
  212. }
  213. if ($did == 9) {
  214. if ($did(9).sel != $null) { did -ra $dname 1 $hget(acronyms,$did(9).sel).item
  215. did -ra $dname 3 $hget(acronyms,$did(9).sel).data }
  216. }
  217. }
  218. }
  219. */
  220. on *:INPUT:*: {
  221. if (%acro.on) {
  222. if ($left($1-,1) != $readini(mirc.ini,text,commandchar)) && (!$ctrlenter) {
  223. var %text = $1-, %msg = $1-, %acronum = $numtok(%text,32), %num = 1
  224. while (%num <= %acronum) {
  225. if ($hget(acronyms,$gettok(%text,%num,32))) {
  226. var %1 = $gettok(%text,%num,32)), %2 = [ $skin($hget(acronyms,$gettok(%text,%num,32))) [ $+ [ $gettok(%acro.color,2,32) ] ] ]
  227. var %2 = $eval(%2,2)
  228. var %msg = $reptok(%msg,%1,%2,1,32)
  229. }
  230. elseif ($hget(facronyms,$gettok(%text,%num,32))) {
  231. var %1 = $gettok(%text,%num,32), %2 = $acro.f($hget(facronyms,$gettok(%text,%num,32)))
  232. var %msg = $reptok(%msg,%1,%2,1,32)
  233. }
  234. inc %num
  235. }
  236. msg $active %msg
  237. halt
  238. }
  239. }
  240. }
  241.  
  242. alias acro.f {
  243. if ($1) {
  244. var %num = 1
  245. while (%num <= $numtok($1-,32)) {
  246. if ($len($gettok($1-,%num,32)) < 2) { inc %num }
  247. elseif ($len($gettok($1-,%num,32)) == 2) {
  248. var %1 = $+($c(1),$left($gettok($1-,%num,32),1)), %2 = $+($c(2),$right($gettok($1-,%num,32),1))
  249. var %r = %r $+(%1,%2)
  250. inc %num
  251. }
  252. elseif ($len($gettok($1-,%num,32)) > 2) {
  253. var %1 = $+($c(1),$left($gettok($1-,%num,32),1)), %2 = $+($c(1),$right($gettok($1-,%num,32),1)), %3 = $+($c(2),$mid($gettok($1-,%num,32),2,$calc($len($gettok($1-,%num,32)) - 2)))
  254. var %r = %r $+(%1,%3,%2,)
  255. inc %num
  256. }
  257. }
  258. return %r
  259. }
  260. }
  261.  
  262. menu * {
  263. Acronym Configuration:acro
  264. Color Text Dialog:facro
  265. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement