Ok, so a friend in a chan wanted me to make a memo system for him. He linked me to sharpknife's script and asked me to make it so that he could see how many messages were sent so pretty much that became a big deal cus i had to completely rework the script. To be honest this is nothing like sharpknife's script but i owe him the debt of a starting point. Upon close scrutiny, I'm sure you can see this is just a heavy edit of his script.
sharpknife's script: http://www.hawkee.com/snippet/2779/
so, it works fairly nicely, it'll keep multiple messages, tell how long ago they were sent, notice someone whenever they join, change nicks or talk(with a spam control ofc). Drawbacks: the spam control requires a few variables in your list, it does not check if someone is recognized or not when they try to read a msg(my server doesn't let you but it isn't hard to add if yours does), and no spam control yet for !note's (I'll get on that right now cus i just thought of it :D ). Anyways, enjoy:
EDIT: spam protection added(not up on what to use for $address, any suggestions if 1 isn't good will be much appreciated) | fixed problem of first comment(making pics now too)
EDIT: supports /msg !note and multiple msg's with syntax !note //
EDIT: fixed some bugs (now works with nicks that have \ or | in them) and changed syntax :/ (not related)
on $*:TEXT:!note*:*: {
if ($3) {
if ($eval($+(%,spam.,$nick),3) > 15) {
.notice $nick You have been banned
set -eu129600 %ban.list $address($nick,1)
halt
}
if ($address($nick,1) isin %ban.list) {
.notice $nick You have been banned
halt
}
var %vnm $2
if ($numtok(%vnm,47) > 1) {
var %ghj 1
while (%ghj < $numtok(%vnm,47)) {
var %lkj $calc(%ghj +1)
while (%lkj <= $numtok(%vnm,47)) {
if ($gettok(%vnm,%lkj,47) == $gettok(%vnm,%ghj,47)) { .notice $nick You tried to send multiple messages to $gettok(%vnm,%ghj,47) but the multi-message system is not to be used for spam. If spam is on, try !note|# to spam messages. | halt }
/inc %lkj 1
}
/inc %ghj 1
}
}
if ($gettok($1,2,$asc(|)) isnum) && ($numtok(%vnm,47) == 1) && (%spam.note == on) && ($gettok($1,2,$asc(|)) <= 15) {
var %mnv 1
var %bnm $gettok($1,2,$asc(|))
var %vnm
while (%mnv <= %bnm) {
var %vnm $eval(%vnm,3) $+ / $+ $2
/inc %mnv 1
}
}
if ($gettok($1,2,$asc(|)) isnum) && ($numtok(%vnm,47) > 1) && (%spam.note == on) && ($gettok($1,2,$asc(|)) <= 15) { notice $nick Use of multi-message and spam together is not currently enabled | halt }
if ($gettok($1,2,$asc(|)) isnum) && (%spam.note != on) && ($gettok($1,2,$asc(|)) <= 15) { .notice $nick sorry spam is not on. | halt }
if ($gettok($1,2,$asc(|)) isnum) && (%spam.note == on) && ($gettok($1,2,$asc(|)) > 15) { .notice $nick sorry spam is currently limited to 15. | halt }
.writeini memos.ini $2 receiver $2
.writeini memos.ini $2 sender $nick
var %nick $nick
var %rty 1
var %tyu $numtok(%vnm,47)
while (%rty <= %tyu) {
var %nick $nick
.write $($+($replace($gettok(%vnm,%rty,$asc(/)),$chr(124),$chr(40),$chr(92),$chr(41)),.ctim)) $ctime
.write $($+($replace($gettok(%vnm,%rty,$asc(/)),$chr(124),$chr(40),$chr(92),$chr(41)),.memo)) %nick $+ : $3-
/inc %rty 1
}
set -eu60 $($+(%,spam.,$nick)) $calc(1 + $($+(%,spam.,$nick)))
set %nickvar %nick
.notice $nick Message has been sent to $2 $+ .
;.notice $2 You have a new message from $nick $+ ! Type !note to view it.
}
if (!$2) {
var %ert $lines($($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41)),.memo)))
if ($eval(%ert,4)) {
var %wer 0
.msg $nick ---Messages for $nick $+ ---
while (%wer < %ert) {
/inc %wer 1
set %cti $duration($calc($ctime - $read($eval($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41),$chr(92),$chr(41)),.ctim),4),$calc(%wer - 1))))
.timer 1 $calc(%wer * 2) .msg $nick %wer $chr(91) $+ %cti ago $+ $chr(93) $read($eval($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41)),.memo),4),%wer)
}
.timer 1 $calc(%wer * 2) .msg $nick ---End of Messages---
}
else .notice $nick You dont have any messages at the moment!
.remini memos.ini $nick
.remove $($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41)),.memo))
.remove $($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41)),.ctim))
.unset $+(%,msg.,$nick)
}
}
on *:text:*:#: {
if ($lines($($+($replace($nick,$chr(124),$chr(40)),.memo)))) && (!$eval($+(%,msg.,$replace($nick,$chr(124),$chr(40),$chr(92),$chr(41))),3)) {
.notice $nick You have $lines($($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41)),.memo))) message(s). Type !note to view them!
set -eu300 $+(%,msg.,$replace($nick,$chr(124),$chr(40))) 1
}
}
on *:nick: {
if ($lines($($+($replace($newnick,$chr(124),$chr(40),$chr(92),$chr(41)),.memo)))) {
.notice $newnick You have $lines($($+($replace($newnick,$chr(124),$chr(40)),.memo))) message(s). Type !note to view them!
set -eu300 $+(%,msg.,$replace($newnick,$chr(124),$chr(40),$chr(92),$chr(41))) 1
}
}
on *:JOIN:#:{
if ($lines($($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41)),.memo)))) {
.notice $nick You have $lines($($+($replace($nick,$chr(124),$chr(40),$chr(92),$chr(41)),.memo))) message(s). Type !note to view them!
set -eu300 $+(%,msg.,$replace($nick,$chr(124),$chr(40),$chr(92),$chr(41))) 1
}
}
alias spam {
if ($1) { set %spam.note $1 }
if (!$1) { set %spam.note $iif(%spam.note == on, off, on) }
}
thanks jonesy44 and glad you got it working theprodigy....its definitely a work in progress, sometime soon I'll convert it to an alias so that it can be used with both the !msg command and a /msg mybot !msg command(so i can institute the option to register and group msg accounts).
will keep posted and thanks :D
Alright, I didn't quite understand what you said about personA to personB at first. Sorry about that.
To clear this up, this can be done in queries, other chats, and/or server(s). As long as your bot is there. The person must type !msg UsersNameYouAreSendingAMessageTo YourMessageHere. Then it will be sent to the bot and kept there till the person retrieves the message by typing !msg.
I like it. Good job.
Ok so I tested it again. Still getting the "You don't have any messages at the moment!"
Is this a system that only works when someone queries you? Or your bot?
The insufficient parameters changed from line 39 to line 40 now.
I see you detailed what this script does but you should detail how it works so people have a better understanding of where the messages come from (I.E. Queries, other channels, highlighted names, etc).
The code is very neat, and clean. Well done :) nice script. Just for future reference, you can remove the /'s from the beginning of commands, sure you know this already but the INC has one :) also, instead of using the /halt command, you may want to look into more effective if-else logic. can make longer scripts so much easier to write/debug/read.
Jonesy44~
Hmmmm. I haven't gotten it to work to show me what it does. Every time I type !msg it tells me I don't have any messages at the moment yet I already did message test and other test to see if anything would pop up.
Also, line 39 has a timer problem.....