Acronyms Replacer

By fluppy on Jul 01, 2006

Basically just an acroynm replacing thingy, yea. Once you've loaded this into your remotes, right click in a channel or click the menubar then click Acronyms. Or type /acro. Click add acronym to add one, delete acronym to delete one. You can edit the completed acronym on the right. Tick the box to enable/disable them. The short acronym will be replaced by the long acronym when you type it in a channel or query. Hold ctrl when you press enter or use /say or /me to cancel the replacing.

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
}

Comments

Sign in to comment.
err2   -  Jul 20, 2006

Zomg flup, kewl acronym thingie
why don\'tyou just pos yer entirescript while yer at T_T
Good job tho
-UltriX

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.