Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dialog acronyms {
- title "Acronyms Editor"
- size -1 -1 220 165
- option dbu
- list 1, 1 9 152 141, size
- button "Add Acronym", 2, 1 151 50 12
- button "Delete Acronym", 3, 52 151 50 12
- text "flupScript Acronyms", 4, 2 1 52 8
- check "Acronyms Enabled", 6, 103 151 55 12,
- text "Edit", 7, 156 10 25 8
- edit "", 8, 155 26 63 10
- text "Short Acro", 9, 156 18 27 8
- text "Long Acro", 10, 156 37 25 8
- edit "", 11, 155 46 63 10, autohs
- button "Make Changes", 12, 155 58 37 12
- }
- on *:dialog:acronyms:init:0:{
- did -m acronyms 8
- did -r acronyms 1
- var %x 1
- while (%x <= $hget(acronyms,0).item) {
- did -a acronyms 1 $gettok($hget(acronyms,%x).item,1,32)
- inc %x
- }
- if (%acronyms.on == $true) {
- did -c acronyms 6
- }
- if (%acronyms.on != $true) {
- did -u acronyms 6
- }
- }
- on *:dialog:acronyms:sclick:1:{
- if ($did(1).sel != $null) {
- did -ra acronyms 8 $hget(acronyms,$did(1).sel).item
- did -ra acronyms 11 $hget(acronyms,$did(1).sel).data
- }
- }
- on *:dialog:acronyms:sclick:2:{
- var %acroshort $$?="Short Acronym. (Eg: lol)"
- if ($hget(acronyms,$gettok(%acroshort,1,32)) != $null) {
- echo -a You already have an acronym for that. Edit it instead.
- }
- else {
- var %acrolong $$?="Long Acronym. (Eg: Laughing out Loud)"
- hadd acronyms $gettok(%acroshort,1,32) %acrolong
- did -r acronyms 1
- var %x 1
- while (%x <= $hget(acronyms,0).item) {
- did -a acronyms 1 $gettok($hget(acronyms,%x).item,1,32)
- inc %x
- }
- }
- }
- on *:dialog:acronyms:sclick:3:{
- hdel acronyms $did(1).seltext
- did -r acronyms 1
- did -r acronyms 8
- did -r acronyms 11
- var %x 1
- while (%x <= $hget(acronyms,0).item) {
- did -a acronyms 1 $gettok($hget(acronyms,%x).item,1,32)
- inc %x
- }
- }
- on *:dialog:acronyms:sclick:6:{
- if ($did(6).state == 1) {
- set %acronyms.on $true
- }
- if ($did(6).state == 0) {
- set %acronyms.on $false
- }
- }
- on *:dialog:acronyms:sclick:12:{
- hadd acronyms $did(1).seltext $did(11).text
- }
- on *:input:*:{
- if (%acronyms.on == $true) {
- if ($left($1,1) != /) && (!$ctrlenter) {
- var %acrotext = $1-
- var %acrotext.send = $1-
- var %acronum2 = 1
- while (%acronum2 <= $numtok(%acrotext,32)) {
- if ($hget(acronyms,$gettok(%acrotext,%acronum2,32))) {
- var %1 = $gettok(%acrotext,%acronum2,32))
- var %2 = $hget(acronyms,$gettok(%acrotext,%acronum2,32))
- var %acrotext.send = $reptok(%acrotext.send,%1,%2,1,32)
- inc %acronum2
- }
- if (!$hget(acronyms,$gettok(%acrotext,%acronum2,32)) {
- inc %acronum2
- }
- }
- msg $active %acrotext.send
- halt
- }
- }
- }
- on *:disconnect:{ hsave acronyms acronyms.txt }
- on *:START:{
- if (!$hget(acronyms)) { hmake acronyms 10 }
- if ($isfile(acronyms.txt)) { hload acronyms acronyms.txt }
- }
- alias acro dialog -m acronyms acronyms
- menu channel,menubar {
- ..Acronyms:acro
- }
Add Comment
Please, Sign In to add comment