Updated Ping list with my first dialog

By [Plornt] on Dec 24, 2009

Well the other day I was faced with a user asking:

[12:12:12] <~Santa> Dear [Plornt], Please could you build me a script so i can have a message displayed on my screen when someone pings me whilst also only activated when they type my name Exactly. I also need a way of adding and deleting my other nicks from the list with a simple command. Oh thank you ever so much I love you!

* [Plornt] is not liable for adding false information into quotes

So I took up the challenge thinking how would I do this easilly so even a retard could use it.
And here's what I come up with!

[size=20]Commands[/size]
Old version and new version
/addnick - Add's a nick to the ping list.
/delnick - Delete's a nick from the ping list.
/lnick - List's the ping list.
/ping - Toggles the actual ping sound on and off.

New version only
Right click >> Ping list >> Open dialog - Opens the ping dialog.
Right click nicklist >> Ping list >> Add/Del nick - Auto adds a selected nick to the ping list

[size=20]Archive (Old versions)[/size]
Old script

[size=20]Credit's[/size]
Santa - Original idea
Invision - The colours they used that i liked.
mIRC - No one ever thanks them now do they

I'd like to thank all of the above that made this release possible

dialog ping {
  title "Ping"
  size -1 -1 287 300
  box "Ping Control", 1, 10 11 266 279
  list 2, 22 35 100 223
  button "Add", 3, 131 35 131 25
  button "Delete", 4, 132 68 131 25
  button "Confirm", 5, 186 261 82 25
  check "Enable sounds.", 6, 22 268 100 17
  text "Add or delete nicks from the ping list by clicking a      name in the box to the left.                                                                                                                                         Thanks for using [Plornt]'s Ping list, please look on hawkee for the latest version. ", 7, 132 111 132 130

}
menu channel,query {
  .Ping list
  ..Open dialog:openping

}
menu nicklist {
  .Ping list
  ..Open dialog:openping
  ..Add/Del nick:togglep $1
}
alias togglep {
  if ($read(nicks.txt, s, $1)) {
    delnick $1
  }
  else {
    addnick $1
  }
}
ON *:DIALOG:Ping:SCLICK:2:did -e ping 4
ON *:DIALOG:Ping:SCLICK:3:/addnick $?="Add a nick:" | did -r Ping 2 | updatep | if ($lines(nicks.txt)) { did -e ping 2 | did -b ping 4 } | else { did -b ping 4,2 } 
ON *:DIALOG:Ping:SCLICK:4:/delnick $did(2,$did(2).sel) | did -r Ping 2 | updatep | if ($lines(nicks.txt)) { did -e ping 4,2 } | else { did -b ping 4,2 | did -f ping 2 1 }
ON *:DIALOG:Ping:SCLICK:5:/dialog -x Ping | if (%d.on = 1) { echo -at 3Settings: Sound on } | elseif (%d.on == 0) { echo -at 3Settings: Sound off } | unset %d*
ON *:DIALOG:Ping:SCLICK:6:if ($did(6).state) { set %ping on | set %d.on 1 } | else { set %ping off | set %d.on 0 }
alias openping {
  dialog -m ping ping
  set %d.on not changed
  updatep
  if (%ping == on) { did -c ping 6 }
  if (!$lines(nicks.txt)) { did -b ping 4,2 }
}
alias updatep {

  var %nicks 1
  while (%nicks <= $lines(nicks.txt)) {
    Did -a Ping 2 $remove($read(nicks.txt,%nicks),filler)

    inc %nicks
  }

}

on *:TEXT:*:# {
  if ($lines(nicks.txt)) { 
    var %nicks 1
    if ( !$window(@Pings) ) { window -e @Pings }
    while (%nicks <= $lines(nicks.txt)) {
      var %i 1
      while (%i <= $0) {

        if ( $remove($read(nicks.txt,%nicks),filler) == $remove($($+($,%i),2),$chr(45),$chr(44),$chr(58),$chr(46))) {

          if ( %ping == on ) {
            beep 1 1
          }
          echo @Pings 12«11 $+ $nick 12in11 $chan 12said at11 $timestamp $+ 12» $1- $+ 
          if ( $chan != $active ) {
            echo -a 12«11 $+ $nick 12in11 $chan 12said at11 $timestamp $+ 12» $1- $+ 
          }

        }
        inc %i
      }
      inc %nicks
    }
  }
}
on *:Action:*:# {
  if ($lines(nicks.txt)) { 
    var %nicks 1
    if ( !$window(@Pings) ) { window -e @Pings }
    while (%nicks <= $lines(nicks.txt)) {
      var %i 1
      while (%i <= $0) {
        if ($remove($read(nicks.txt,%nicks),filler) == $remove($($+($,%i),2),$chr(45),$chr(44),$chr(58),$chr(46))) {
          if ( %ping == on ) {
            beep 1 1
          }
          echo @Pings 12«11 $+ $nick 12in11 $chan 12said at11 $timestamp $+ 12» $1- $+ 
          if ( $chan != $active ) {
            echo -a 12«11 $+ $nick 12in11 $chan 12said at11 $timestamp $+ 12» $1- $+ 
          }

        }
        inc %i
      }
      inc %nicks
    }
  }
}
on 1:LOAD:/addnick $me | /echo -at 4Thanks for loading [Plornts] ping script V2 dialoged Beta | /echo -at 3Add other nicks or delete them using: /addnick /delnick Or list them using /lnick toggle ping on and off with /ping
alias addnick {
  if ($1) {
    if ($read(nicks.txt, s, $1)) { 
      echo -at 3 $+ $nick is already on the ping list.
    }
    else {
      if ($2) { echo -at 3Please add 1 nickname at a time. }
      ;The 2nd word "filler" is just there so the $read(nicks.txt, s, $1) works, it doesnt do much but its needed.
      write nicks.txt $1 filler
      echo -at 3Added $1 to the pings list.
    }
  }
  else { echo -at 3Please use /addnick Nick For this command to work }
}

alias lnick {
  var %nicks 1
  echo -at $iif($lines(nicks.txt),3Listing nicks on ping list:,3There are no nicks on the ping list.)

  while (%nicks <= $lines(nicks.txt)) {
    echo -at 3 $+ $chr(91) $+ %nicks $+ / $+ $lines(nicks.txt) $+ $chr(93)  $+ $remove($read(nicks.txt,%nicks),filler)
    inc %nicks
  }

}

alias ping {
  if ( !%ping ) {
    echo -at 3Pings have been turned on.
    set %ping on
  }
  else if ( %ping == on ) {
    echo -at 3Pings are now off.
    set %ping off
  }
  else if ( %ping == off ) {
    echo -at 3Pings are now on.
    set %ping on
  }
}
alias delnick {
  if ($1) {
    if ($read(nicks.txt, s, $1)) { 
      if ($2) { echo -at 3Please delete 1 nickname at a time. }
      write -ds $+ $1 nicks.txt
      echo -at 3Deleted $1 from the pings list.
    }
    else {
      echo -at 3The nick $1 is not on the ping list.
    }
  }
  else { echo -at 3Please use /delnick Nick For this command to work }
}

Comments

Sign in to comment.
Atr   -  Dec 27, 2009

Lol @ the use of aliases for the dialog XD

Just use:

ON *:dialog:Ping:init:*:

Edit; you may also want to NOT use /ping as an alias (it already has a ctcp function)

 Respond  
[Plornt]   -  Dec 26, 2009

Added a new dialog to make things easier and look nicer. The dialog is my first one so it was a bitch to make. The way i did this isnt the conventional way so please explain to me if there is a way of doing somthing that i have do stupidly.

Thanks, Suggestions are welcome

 Respond  
[Plornt]   -  Dec 25, 2009

Thanks , aww nope, no dialog, i was going to add one in but you know i got bored...

Ima add one in tommorow after xmas :)!

Merry Christmas everyone

 Respond  
KevKev   -  Dec 24, 2009

This Is Pretty Good :)
Can't wait to see if in a Dialog.

 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.