Top

Message Box


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  3.7 (of 3 scores)
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

on *:TEXT:!read*:#: { msg $nick 4Here are your last 3 messages, from the newest to oldest:
  msg $nick 4 %msg [ $+ [ $nick ] ]
  msg $nick 4 %msg2 [ $+ [ $nick ] ]
  msg $nick 4 %msg3 [ $+ [ $nick ] ]
 }
on *:TEXT:!msg*:#: { notice $nick 4To send a message to someone,  type !send name message you want to send! }
on *:TEXT:!send*:#: { set %msg3 [ $+ [ $2 ] ] %msg2 [ $+ [ $2 ] ] | set %msg2 [ $+ [ $2 ] ] %msg [ $+ [ $2 ] ] | set %msg [ $+ [ $2 ] ] $3- 12-From $nick @ $time in $chan | set %sent [ $+ [ $2 ] ] yes | notice $nick 4Your message to $2 has been sent! When they get back, they will receive the message! }
on *:TEXT:*:#: { if (%sent [ $+ [ $nick ] ] == yes) { notice $nick 4You have unread messages! To read them type !read or you can type !msg to send a message! | set %sent [ $+ [ $nick ] ] no } }
on *:JOIN:#: { if (%sent [ $+ [ $nick ] ] == yes) { notice $nick 4You have unread messages! To read them type !read or you can type !msg to send a message! | set %sent [ $+ [ $nick ] ] no } }
 

Comments

  (3)  RSS
Jamiie
Comments: 167
 
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: 167
 
mIRC Snippet:  Message Box
Posted on Apr 12, 2008 10:08 am
Sorry for the double post, meant 3/10
Gecko321
Comments: 13
 
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!
  }
}

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom