Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- unRealIRC
- Acronym Replace / Color Text Configuration
- Scripted By: DarkWarrior
- Version 3.0
- */
- alias acro {
- if ($dialog(acro)) { dialog -v acro acro }
- else { dialog -vmd acro acro }
- }
- alias facro dialog -m facro facro
- on *:START: {
- hmake acronyms 10 | hload acronyms acronyms.hsh
- hmake facronyms 10 | hload facronyms facronyms.hsh
- }
- on *:EXIT: { hsave acronyms acronyms.hsh | hsave facronyms facronyms.hsh }
- alias refresh.acronyms {
- did -ra $dname 19 Total Acronyms: $hget(acronyms,0).item
- did -r $dname 7
- var %a = 1
- while (%a <= $hget(acronyms,0).item) {
- did -a $dname 7 $gettok($hget(acronyms,%a).item,1,32)
- inc %a
- }
- }
- alias -l preview.acro {
- if ($dialog(acro)) {
- window -hp +f @Preview.Acro 0 0 150 25
- if ($isfile($scriptdirapreview.bmp)) { .remove $scriptdirapreview.bmp }
- 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) ] ] ]
- drawsave @Preview.Acro $scriptdirapreview.bmp
- window -c @Preview.Acro
- did -gv $dname 18 $scriptdirapreview.bmp
- }
- }
- dialog acro {
- title "Acronym Configuration"
- size -1 -1 282 106
- option dbu
- edit "", 1, 7 19 60 10, disable
- text "Acronym: (ie. lol)", 2, 7 11 70 8, disable
- edit "", 3, 7 40 60 10, disable autohs
- text "Meaning: (ie. Laughing Out Loud)", 4, 7 32 84 8, disable
- button "Add", 5, 7 55 50 10
- button "Delete", 6, 7 68 50 10
- list 7, 95 20 60 75, sort size
- button "", 8, 7 81 50 10
- box "Settings", 9, 165 5 114 87
- check "Enable Acronyms", 10, 170 14 54 10
- text "Color Options:", 11, 170 27 42 8, disable
- radio "Normal", 12, 170 37 29 10
- radio "No Brackets", 13, 211 37 50 10
- radio "Secondary", 14, 170 47 36 10
- radio "Second \ No Brackets", 15, 211 48 61 10
- radio "No Color", 16, 170 57 35 10
- radio "No Color \ No Brackets", 17, 211 57 63 10
- icon 18, 183 72 70 10, $scriptdirapreview.bmp, 0
- edit "", 19, 95 9 60 10, read
- button "Exit", 20, 7 94 50 10, ok
- }
- on *:dialog:acro:init:*: {
- refresh.acronyms
- preview.acro
- did -a $dname 8 Edit
- if (%acro.on) did -c $dname 10
- did -c $dname $gettok(%acro.color,1,32)
- }
- on *:dialog:acro:sclick:*: {
- if ($did == 5) {
- if ($did(8) != Cancel Edit) {
- if ($did(8) != Cancel Add) {
- did -er $dname 1,3
- did -b $dname 6
- did -ra $dname 8 Cancel Add
- }
- else {
- if ($did(1)) && ($did(3)) {
- if (!$hget(acronyms,$gettok($did(1),1,32))) {
- hadd acronyms $gettok($did(1),1,32) $did(3)
- refresh.acronyms
- did -r $dname 1,3
- }
- }
- }
- }
- elseif ($did(8) == Cancel Edit) {
- if ($did(1)) && ($did(3)) {
- hdel acronyms $did(7).seltext
- hadd acronyms $did(1) $did(3)
- did -r $dname 1,3
- refresh.acronyms
- }
- }
- }
- if ($did == 6) {
- hdel acronyms $did(7).seltext
- did -r $dname 1,3
- refresh.acronyms
- }
- if ($did == 7) {
- did -ra $dname 1 $did(7).seltext
- did -ra $dname 3 $hget(acronyms,$did(7).seltext)
- }
- if ($did == 8) {
- if ($did(8) == Cancel Add) {
- did -rb $dname 1,3
- did -e $dname 6
- did -ra $dname 8 Edit
- }
- elseif ($did(8) == Edit) {
- did -e $dname 1,3
- did -b $dname 6
- did -ra $dname 8 Cancel Edit
- }
- elseif ($did(8) == Cancel Edit) {
- did -br $dname 1,3
- did -e $dname 6
- did -ra $dname 8 Edit
- }
- }
- if ($did == 10) {
- if ($did(10).state == 0) { unset %acro.on }
- elseif ($did(10).state == 1) { set %acro.on on }
- }
- if ($did isin 12 13 14 15 16 17) { set %acro.color $did $aprop($did) | preview.acro }
- }
- alias -l aprop {
- if ($1 == 12) { return $null }
- if ($1 == 13) { return .bn }
- if ($1 == 14) { return .s }
- if ($1 == 15) { return .bs }
- if ($1 == 16) { return .b }
- if ($1 == 17) { return .n }
- }
- dialog facro {
- title "Color Text Configuration"
- size -1 -1 119 49
- option dbu
- text "Text:", 1, 4 6 25 8, disable
- edit "", 2, 4 16 50 10, disable read autohs
- button "Add", 3, 8 27 37 10
- button "Delete", 4, 8 37 37 10
- list 5, 64 6 50 37, size
- }
- on *:dialog:facro:*:*: { if ($devent == init) { did -r $dname 5
- var %a = 1
- while (%a <= $hget(facronyms,0).item) { did -a $dname 5 $gettok($hget(facronyms,%a).item,1,32)
- inc %a }
- }
- if ($devent == sclick) {
- if ($did == 3) { var %face = $$?="New Text: (ie. Lulz, =])"
- if ($hget(facronyms,$gettok(%face,1,32))) {
- echo -a ERROR: Face already exists.
- halt }
- hadd facronyms $gettok(%face,1,32) $gettok(%face,1,32)
- did -r $dname 5
- var %a = 1
- while (%a <= $hget(facronyms,0).item) { did -a $dname 5 $gettok($hget(facronyms,%a).item,1,32)
- inc %a }
- }
- if ($did == 4) {
- hdel facronyms $did(5).seltext
- did -r $dname 5
- did -r $dname 2
- var %a = 1
- while (%a <= $hget(facronyms,0).item) { did -a $dname 5 $gettok($hget(facronyms,%a).item,1,32)
- inc %a }
- }
- if ($did == 5) {
- if ($did(5).sel != $null) { did -ra $dname 2 $hget(facronyms,$did(5).sel).item }
- }
- }
- }
- /*
- on *:dialog:acro:*:*: { if ($devent == init) { did -r $dname 9
- var %a = 1
- while (%a <= $hget(acronyms,0).item) { did -a $dname 9 $gettok($hget(acronyms,%a).item,1,32)
- inc %a }
- }
- if ($devent == sclick) {
- if ($did == 6) { var %acro = $$?="Acronym: (ie. lol)"
- if ($hget(acronyms,$gettok(%acro,1,32))) {
- echo -a ERROR: Acronym already exists.
- halt }
- else var %meaning = $$?="Meaning: (ie. Laughing Out Loud)"
- hadd acronyms $gettok(%acro,1,32) %meaning
- did -r $dname 9
- var %a = 1
- while (%a <= $hget(acronyms,0).item) { did -a $dname 9 $gettok($hget(acronyms,%a).item,1,32)
- inc %a }
- }
- if ($did == 7) {
- hdel acronyms $did(9).seltext
- did -r $dname 9
- did -r $dname 1
- did -r $dname 3
- var %a = 1
- while (%a <= $hget(acronyms,0).item) { did -a $dname 9 $gettok($hget(acronyms,%a).item,1,32)
- inc %a }
- }
- if ($did == 9) {
- if ($did(9).sel != $null) { did -ra $dname 1 $hget(acronyms,$did(9).sel).item
- did -ra $dname 3 $hget(acronyms,$did(9).sel).data }
- }
- }
- }
- */
- on *:INPUT:*: {
- if (%acro.on) {
- if ($left($1-,1) != $readini(mirc.ini,text,commandchar)) && (!$ctrlenter) {
- var %text = $1-, %msg = $1-, %acronum = $numtok(%text,32), %num = 1
- while (%num <= %acronum) {
- if ($hget(acronyms,$gettok(%text,%num,32))) {
- var %1 = $gettok(%text,%num,32)), %2 = [ $skin($hget(acronyms,$gettok(%text,%num,32))) [ $+ [ $gettok(%acro.color,2,32) ] ] ]
- var %2 = $eval(%2,2)
- var %msg = $reptok(%msg,%1,%2,1,32)
- }
- elseif ($hget(facronyms,$gettok(%text,%num,32))) {
- var %1 = $gettok(%text,%num,32), %2 = $acro.f($hget(facronyms,$gettok(%text,%num,32)))
- var %msg = $reptok(%msg,%1,%2,1,32)
- }
- inc %num
- }
- msg $active %msg
- halt
- }
- }
- }
- alias acro.f {
- if ($1) {
- var %num = 1
- while (%num <= $numtok($1-,32)) {
- if ($len($gettok($1-,%num,32)) < 2) { inc %num }
- elseif ($len($gettok($1-,%num,32)) == 2) {
- var %1 = $+($c(1),$left($gettok($1-,%num,32),1)), %2 = $+($c(2),$right($gettok($1-,%num,32),1))
- var %r = %r $+(%1,%2)
- inc %num
- }
- elseif ($len($gettok($1-,%num,32)) > 2) {
- 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)))
- var %r = %r $+(%1,%3,%2,)
- inc %num
- }
- }
- return %r
- }
- }
- menu * {
- Acronym Configuration:acro
- Color Text Dialog:facro
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement