Top

Message Box

Please Register to submit score.
Average Score  3.7
Scores Submitted  3
Date Added  Apr 12, 2008
Last Updated  Apr 12, 2008
Tags  box  get  inbox  input  message  messages  msg  msgs  new  output  read  receive  send 

Introduction

I haven't submitted a script in AWHILE here, but now here's one! This is how it works:
Someone types !msg
It gives them instructions on what do do next, so they type
!send person's_name The message they want to send to them.
Once the person they sent it to joins any channel the bot is on, or says anything (it does this so they won't be idle when it's sent), it'll send them a message saying they have unread messages. After that, it tells them they can type !read, and it'll give them their past 3 messages. If they only have 1, it'll have 2 blanks, and the 1 message.

When you receive a message it tells you the message, who sent it, when it was sent, and in what channel it was sent!

Grab the Code

Comments

  (3)  RSS
Jamiie
Comments: 97
 
mIRC Snippet:  Message Box
Posted on Apr 12, 2008 10:07 am
I don't really see the point of this snippet, why not use memo's?


2/10
Jamiie
Comments: 97
 
mIRC Snippet:  Message Box
Posted on Apr 12, 2008 10:08 am
Sorry for the double post, meant 3/10
Gecko321
Comments: 11
 
mIRC Snippet:  Message Box
Posted on Apr 12, 2008 2:00 pm
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.

Code:


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!
  }
}

Please Register or Login to start posting comments.
Bottom