Gecko321 commented on a Page, Message Box  -  Apr 12, 2008

You could also use hash tables to make it keep more than just 3 messages. You can also combine all of your on Text events to make sure there are no errors.

on *:TEXT:*:#: { 
  var %Nick = $+($Nick,.Memo)
  CheckMessages $Nick
  if ($1 = !Read) {
    if ($Hget(%Nick,Total) > 0) {
      .msg $nick You have $v1 Messages.
      var %a = 0
      While (%a != $Hget(%Nick,Total)) {
        inc %a
        .msg $Nick $HGet(%Nick,%a)
      }
    }
  }
  elseif ($1 = !msg) { .notice $nick To send a message to someone,  type !send name message you want to send! }
  elseif ($1 = !Send) {
    if (!$HGet(%Nick)) { .hmake $Nick }
    if (!$Hget(%Nick,Total)) { .hadd -m %Nick Total 0 }
    .hinc %Nick Total 1
    .hadd %Nick $HGet(%Nick,Total) $3- -From $Nick @ $Time in $Chan
    .notice $nick Your message to $2 has been sent! When they get back, they will receive the message! 
  } 
  if ($1 = !Clear) { .hdel %Nick }
}

on *:JOIN:#:CheckMessages $Nick

alias CheckMessages { 
  if ($Hget($+($2,.Memo),Total)) > 0) { 
    .notice $2 You have unread messages! To read them type !read or you can type !msg to send a message! 
  } 
} 
 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.