server !seen and !idle scripts

By Pepsi_Man0077 on Apr 17, 2008

Completely new concept to a seen script. Not only does this seen script tell what the last user did. But if a user is not in a channel that the bot is in, it will do a raw whois and if the target is on the server, the bot will give a list of channels the target is on and the bot will contact the target for the user if the user wishes.

Syntex:

!seen - Will first check if user is on the server, if not it will deliver what the target was last seen doing, and how long ago

!idle - Delivers the nicks idle time (not channel idle time, server idle time)

!search - If the target of the !seen command is on the server, the bot will locate the target for the user if the user wishes.

note: you only have 2 minutes to use the !search command after you perform the !seen command and the target is on the server :P

I am pretty sure all bugs are worked out, it you find any please let me know.

Special Thanks to OliMaylen for the raw 319 portion

:) Enjoy

  • PePSiMaN
;=======================
;== !Seen Script v2.0 ||
;=======================
;==    By PePSiMaN    ||
;=======================

;== Raw ==

raw 402:*: {
  if (%xseen) {
    if (!$hget(xSeen,%xseen.target)) {  msg %xseen.chan Sorry, %xseen.target was not found in my database. }
    if ($hget(xSeen,%xseen.target)) {
      var %xseen.data $left($hget(xSeen,$2),1) 
      tokenize 32 $hget(xSeen,%xseen.target)
      if ($1 = Q) { msg %xseen.chan $2 was last seen Quitting $duration($calc($ctime - $3)) ago. | msg %xseen.chan (Quit Message: $4- $+ ) }
      if ($1 = S) { msg %xseen.chan $2 was last seen by me on the server $duration($calc($ctime - $3)) ago. }
      if ($1 = K) { msg %xseen.chan $2 was last seen being kicked from $4 $duration($calc($ctime - $3)) ago. | msg %xseen.chan (Kick Reason: $5- $+ ) }
      if ($1 = P) { msg %xseen.chan $2 was last seen parting $4 $duration($calc($ctime - $3)) ago. | if ($5) { msg %xseen.chan (Part Reason: $5- $+ ) } }
      if ($1 = N) { msg %xseen.chan $2 was last seen changing his/her nick to $4 $duration($calc($ctime - $3)) ago. }
      if ($1 = J) { msg %xseen.chan $2 was last seen joining $4 $duration($calc($ctime - $3)) ago. }
      if ($1 = T) { msg %xseen.chan $2 was last seen talking in $4 $duration($calc($ctime - $3)) | msg %xseen.chan (Text said: $5- $+ ) }
    }
    xdefclear
  }
  if (%idle.time.get = on) {
    msg %idle.chan Sorry %idle.x $+ , %idle.nick was not found on this server. Try !seen %idle.nick
    unset %idle.nick
    unset %idle.chan
    unset %idle.time.get
    unset %idle.x
    halt
  }
}

raw 319:*:{
  if (%xseen) {
    msg %xseen.chan User $2 is currently in: $remove($3-,$chr(94),$chr(64),$chr(43),$chr(37),$chr(42))
    notice %xseen.nick Click a room(s) to join them, or type !search & I'll tell them you're looking for them.
    set -u60 %xfind. [ $+ [ %xseen.nick ] ] %xseen.target
    hadd -m xSeen %xseen.target S $nick $ctime
    xdefclear
    ;halt
  }
}

raw 317:*:{ 
  if (%xseen) { 
    msg %xseen.chan $2 was found on the server but not in any channel.
    notice %xseen.nick If you would like me to inform $2 you are looking for them, type !search
    set -u60 %xfind. [ $+ [ %xseen.nick ] ] %xseen.target
    hadd -m xSeen %xseen.target S $nick $ctime
    xdefclear
  }
  if (%idle.time.get = on) {
    set %temp.idle.time $3
    msg %idle.chan $2 has been idle for $duration(%temp.idle.time)
    unset %temp.idle.time
    unset %idle.nick
    unset %idle.chan
    unset %idle.time.get
    halt 
  }
}

;== Aliases ==

alias xseen.save {
  hsave xSeen xSeen.hsh
  .timerxseensave 0 300 xseen.save
}

alias xdefclear {
  unset %xseen 
  unset %xseen.chan 
  unset %xseen.nick 
  unset %xseen.target
}

alias xtimedclear {
  if (%xseen) { xdefclear }
  if (%idle.time.get) { unset %idle.time.get }
  .timer 0 300 xtimedclear
}

;== Remotes ==

on *:TEXT:*:*: {
  hadd -m xSeen $nick T $nick $ctime $chan $1-
  if (%spam [ $+ [ $nick ] ] >= 3) { 
    if ($1 = !seen) || ($1 = !idle) { 
      msg $chan Do not abuse the !seen or !idle commands
      halt 
    }
  }
  if ($1 = !seen) {
    inc -u300 %spam [ $+ [ $nick ] ]
    if (!$2) { msg $chan are you looking for someone? | halt }
    elseif ($2 = $nick) { msg $chan Are you trying to find yourself $nick $+ ? I know of some great Counselors that might be able to help you :-\ | halt }
    elseif ($2 = $me) { msg $chan Find my yet, $nick $+ ? | halt }
    elseif ($2 ison $chan) { msg $chan $2 is currently on the channel. | halt }
    elseif (%xseen = $null) {
      raw whois $2 $2
      set %xseen ON
      set %xseen.chan $chan
      set %xseen.nick $nick
      set %xseen.target $2
    }
    elseif (%xseen != $null) {
      msg $chan There is currently already a !seen check in progress $nick $+ , please wait a second and try again.
    }
  }
  if ($1 = !search) && (%xfind. [ $+ [ $nick ] ]) {
    msg %xfind. [ $+ [ $nick ] ] Hello there, I am an automated bot, please do not reply.
    msg %xfind. [ $+ [ $nick ] ] $nick performed a !seen command on you and wanted me to let you know he was looking for you.
    msg $chan Message has been send.
    unset %xfind*
  }
  if ($1 = !idle) {
    inc -u300 %spam [ $+ [ $nick ] ]
    if (!$2) { msg $chan I need a nick to idle :P | halt }
    if ($2 = $nick) { msg $chan Idle'n youself, $nick $+ ? | halt }
    if ($2 = $me) { msg $chan I never idle $nick $+ . :) | halt }
    else {
      if (%idle.time.get) { msg $chan I am sorry $nick $+ , but there is already an idle check in progress, please try in a second. | halt }
      raw whois $2 $2
      set %idle.time.get on
      set %idle.chan $chan
      set %idle.nick $2
      set %idle.x $nick
    }
  }
}

on *:START: {
  if (!$hget(xSeen)) { hmake xSeen 10000 }
  if ($isfile(xSeen.hsh)) { hload xSeen xSeen.hsh }
  xseen.save
  xtimedclear
}

on *:UNLOAD: {
  timerxseensave off
}

on *:EXIT: {
  hsave xSeen xSeen.hsh
}

on *:QUIT: {
  hadd -m xSeen $nick Q $nick $ctime $1-
}

on *:KICK:#: {
  hadd -m xSeen $knick K $nick $ctime $chan $1-
}

on *:JOIN:#: {
  hadd -m xSeen $nick J $nick $ctime $chan
}

on *:NICK: {
  hadd -m xSeen $nick N $nick $ctime $newnick
}

on *:PART:#: {
  hadd -m xSeen $nick P $nick $ctime $chan $1-
}

Comments

Sign in to comment.
Slyvar   -  Mar 07, 2011

It would have been the best Seen Script ever if it wasn't making the bot Quit(Ping timeout)

Such a waste :/

 Respond  
yasi   -  Oct 24, 2010

hey guys can any one help me about what is raw <--- . i am new

 Respond  
Warriorii   -  Sep 10, 2010

i had a couple of problems with it but i think it was on my side. i rebooted my computer and so far it's working great. if i have the same problems again i'll post them

 Respond  
Cheiron   -  Sep 10, 2010

useful upgrade to this would be the strip of the ident@host out of the return message so it only shows for example Tom was last seen at .... instead of Tom (nick@host) was last seen at. otherwise not too bad :)

 Respond  
Warriorii   -  Sep 10, 2010

Well i spoke to soon :) Now each time i do a !seen I get this.....

Trivbot: I have not seen luvme4me Do not abuse the !seen or !idle commands did i just not notice the second line or is there an error. I don't want that going to my users and them think i am trying to accuse them of something loool. let me know if it is suppose to be there please. thanks Also the !search doesn't seem to work anymore and i came back and grabed the code again and it still does the same thing
 Respond  
Warriorii   -  Sep 10, 2010

So far it's working fine for me and it's a great script. I started looking for a !seen script and went through about 6 of them and didnt like them then came on this one and it sounded interesting so i grabed it and tried it out and i'm glad i did. Thanks for a great script and keep up the good work

 Respond  
amboooz   -  Aug 02, 2010

Nice script. I think, if my pc got hang and I reboot, why the saved data all disappear? Is it only happening to me? Like for example, nickA joined today at 4pm lets say. I had to reboot my pc cause it got hang. After reboot if someone use !seen nickA , bot would say not today's 4pm, may be yesterdays log. How to save the log permanently?

 Respond  
Redly   -  Apr 02, 2010

is there a way for the script to say what the last person said, even if they are presently in the channel, lurking?

PS. working okay for me

 Respond  
StonaJakey   -  Mar 14, 2010

the same thing thats happening to jenny happens to me :/
my bot client will become unresponsive when i try to open it from the taskbar. and it starts using about 50% of my processor resources. i totally redid my bot. then tried it for a day without your script and it was fine. then i added your script to it and it crashed an hour later. it seems to crash about an hour after i boot my bot. and if reboot my bot, it still happens crashes after an hour :/ i really like this script. and im hoping this bug can be fixed :D

 Respond  
FordLawnmower   -  Mar 06, 2010

Just glancing at the script Drazhar, I would just type /unset %idle.time.get

 Respond  
Drazhar   -  Mar 06, 2010

I have a problem... I started using the earlier version of this I believe, and someone did an idle check without offering a nick, and to this day, even with the new version it says there's an idle check in progress... how do I reset it?

 Respond  
Jenny   -  Mar 01, 2010

For some reason this script makes my bot freeze up. Works excellent tho until then. Any idea what the reason may be?

 Respond  
MuttCowboy   -  Dec 31, 2009

Great script! Worked flawlessly!

 Respond  
Pepsi_Man0077   -  Sep 11, 2008

that means that the user is not online. You dont have to worry about that stuff tho, that is just the bot finding out the users info.

 Respond  
Escape-From-Hell   -  Aug 06, 2008

I love this script.

One things is, when i type: !seen Escape - when i look in the bots status tab it comes up:

-> Server: whois Escape Escape

No such server

Any ideas what is wrong?

 Respond  
Lovely3000   -  Jun 05, 2008

It also says that there is currently a !seen check going though. There is none. what am i doing wrong?

 Respond  
Lovely3000   -  Jun 05, 2008

I keep geting this error.

3:14pm] ««Ë®®öR»»Unknown command: XSEEN.SAVE
3:14pm] ««Ë®®öR»»Unknown command: XTIMEDCLEAR

 Respond  
ISM   -  May 04, 2008

i am not using a bot in my room, but can i have past this script in remot. when i type !seen nick doesnt do anything for me, i am using pnplus script. or this script only for bot> thanks for ur help

 Respond  
OliMaylen   -  May 03, 2008

Ah sorry Vexx, didn\'t get what you ment, but yes you were right. They were in the wrong order which Pepsi_man has stated. I had already swapped them around so they worked right for my bot, but forgot to mention that to pepsi. :)

 Respond  
Vexx   -  Apr 25, 2008

lol. no need for sorry pepsi_man. re got it now and working fine..Thanks
=D

 Respond  
Pepsi_Man0077   -  Apr 25, 2008

You are right Vexx, i am sorry about that i had it in the wrong order, Just updated. Get the snippet again and it will work fine :)

 Respond  
Vexx   -  Apr 24, 2008

yeah i get that OliMaylen, sorry i wasnt quite clear..having set this in a bot of mine

i asked the bot !seen vexx it returned \"vexx is currently on the channel.\"

then asked the bot !seen bot it returned \"bot is currently on the channel.\"

this piece of coding doesnt even come into use

if ($2 = $nick) { Are you trying to find yourself $nick $+ ? I know of some great Counselors that might be able to help you :- | halt }
if ($2 = $me) { Find my yet, $nick $+ ? | halt }

unless you remove this line

if ($2 ison $chan) { msg $chan $2 is currently on the channel. | halt }

after removing that 1 line the replies now are

!seen vexx returns Are you trying to find yourself vexx ? I know of some great Counselors that might be able to help you :-\

!seen bot returns Find me yet, vexx ?

but of course removing that line when asked if !seen in the channel and that person is in the same room,it returns the list of rooms they are currently in, rather than say is currently in the channel..

hope thats a bit more clearer

way to solve this ?
unless its just me =/

then in which case may brimstone and fire rain down on my home

thanks

 Respond  
OliMaylen   -  Apr 24, 2008

Vexx,

if ($2 = $nick) is if the person using the !seen command types in their own name.

if ($2 = $me) is if the person tries to perform the !seen command on the bot/user running the script. It\'s just a bit of fun. It could be left so it just says they are on the channel, but it just adds a bit extra to the script to give a humerous answer if a user \"!seen\'s\" themselves or the bot/user running the script. :)

 Respond  
Vexx   -  Apr 24, 2008

Hi ,love the snippet,im no scripter and yes im a noob but just im just a wondering the point of these lines

if ($2 = $nick) { Are you trying to find yourself $nick $+ ? I know of some great Counselors that might be able to help you :-\\ | halt }
if ($2 = $me) { Find my yet, $nick $+ ? | halt }

because of this line

if ($2 ison $chan) { msg $chan $2 is currently on the channel. | halt }
 Respond  
Pepsi_Man0077   -  Apr 23, 2008

Thank you :)

 Respond  
OliMaylen   -  Apr 23, 2008

Thanks, I\'m still very new. Used to mess with VB \"back in the day\", this is the first bit of coding/scripting for ages & I\'m finding it fun.

Only started looking at it week ago, so most of the stuff I try is trial & error at the moment.

Anyway, glad you liked it & thanks for a nice script. :)

 Respond  
Pepsi_Man0077   -  Apr 22, 2008

Snippet updated, i also took the time to remove the ^,@,+, and % from the beggining of channels when a whois is done.

 Respond  
Pepsi_Man0077   -  Apr 22, 2008

I like that, good job i will update it and give you credit :)

 Respond  
OliMaylen   -  Apr 22, 2008

Thought this might be useful, I have progressed a lot since my last comment, which I am unable to delete. I think I had other errors which accounted for the error I had before. Anyway I edited part of the script & added bits to handle the 319 code from the raw whois. Now instead of just saying if the user is on the server, it now returns a list of channels the user you \"!seen\" is on. It now also handles if users are on the server but not in any rooms and tells you this info also.

The bits I added may be a little crude, but it works. Changed the

msg $chan\"

to

.notice %xseen.nick

in a lot of places for my own use so as not to spam the room with people going mad with the script. It puts a nice touch to an already great script I think. :-)

Here is the bit i edited:

raw 402:*: {
  if (%xseen) {
    if (!$hget(xSeen,%xseen.target)) { .notice %xseen.nick 12Sorry,4 %xseen.target 12was not found in my database, or on the server. }
    if ($hget(xSeen,%xseen.target)) {
      var %xseen.data $left($hget(xSeen,$2),1) 
      tokenize 32 $hget(xSeen,%xseen.target)
      if ($1 = Q) { .notice %xseen.nick 4 $+ %xseen.target 12was last seen Quitting 4(Quit Message: $4- $+ ) $duration($calc($ctime - $3)) ago. }
      if ($1 = S) { .notice %xseen.nick 4 $+ %xseen.target 12was last seen by me on the server4 $duration($calc($ctime - $3)) ago. }
      if ($1 = K) { .notice %xseen.nick 4 $+ %xseen.target 12was last seen being kicked from4 $4 (Kick Reason: $5- $+ ) $duration($calc($ctime - $3)) ago. }
      if ($1 = P) { .notice %xseen.nick 4 $+ %xseen.target 12was last seen parting4 $4 (Part Reason: $5- $+ ) $duration($calc($ctime - $3)) ago. }
      if ($1 = N) { .notice %xseen.nick 4 $+ %xseen.target 12was last seen changing his/her nick to4 $4 $duration($calc($ctime - $3)) ago. }
    }
    xdefclear
  }
  if (%idle.time.get = on) {
    .notice %idle.x 12Sorry4 %idle.x $+ 12,4 %idle.nick 12was not found on this server. Try 4!seen12 %idle.nick
    unset %idle.nick
    unset %idle.chan
    unset %idle.time.get
    unset %idle.x
    halt
  }
}

raw 319:*:{
  if (%xseen) {
    .notice %xseen.nick 12User4 $2 12is currently in:9 $3-
    .notice %xseen.nick 12Click a room(s) to join them, or type 4!search 12& I\'ll tell them you\'re looking for them.
    set -u60 %xfind. [ $+ [ %xseen.nick ] ] %xseen.target
    hadd -m xSeen %xseen.target S $nick $ctime
    xdefclear
    ;halt
  }
}

raw 317:*:{ 
  if (%xseen) { 
    .notice %xseen.nick 4 $+ $2 12was found on the server but not in any channel.
    .notice %xseen.nick 12If you would like me to inform4 $2 12you are looking for them, type 4!search
    set -u60 %xfind. [ $+ [ %xseen.nick ] ] %xseen.target
    hadd -m xSeen %xseen.target S $nick $ctime
    xdefclear
  }
  if (%idle.time.get = on) {
    set %temp.idle.time $3
    .notice %idle.x 4 $+ $2 12has been idle for4 $duration(%temp.idle.time)
    unset %temp.idle.time
    unset %idle.nick
    unset %idle.chan
    unset %idle.time.get
    halt 
  }
}
 Respond  
OliMaylen   -  Apr 20, 2008

Hi there, I\'m new to the site & new to IRC scripting. This is the first time I have studied it & the first time editing it, (learning as I go) so go easy on me if there are glaringly obvious errors.

I really liked this script as it was the only one I could find that used WHOIS to find a user that was not in the channel. I added it to a mIRC bot, (Yourbot IRC Bot 4.5.2) which was intergrated into mIRC v6.2, but the last user action (ie: Kick, Quit, Part etc) database wouldnt function properly & the script would freeze giving the bot client the error message: * Invalid format: $left (line 17, seen.mrc).

After some playing with the code & changing the v6.2 mIRC exe for the new v6.31 exe, the script works exactly as it should for my bot.

Like I said, it worked for me, there may have been a much easier way to sort the problem, but I didn\'t know it. :-) Thought I would share this in case other people had the same problem, or to see if there was an easier way of fixing the problem.

The code I changed was:

raw 402:*: {
  if (%xseen) {
    if (!$hget(xSeen,%xseen.target)) { msg %xseen.chan 12Sorry,4 %xseen.target 12was not found in my database, or on the server. }
    if ($hget(xSeen,%xseen.target)) {
      var %xseen.data $left($hget(xSeen,%xseen.target),1) 
      tokenize 32 $hget(xSeen,%xseen.target)
      if ($1 = Q) { msg %xseen.chan %xseen.target was last seen Quitting (Quit Message: $4- $+ ) $duration($calc($ctime - $3)) ago. }
      if ($1 = S) { msg %xseen.chan %xseen.target was last seen by me on the server $duration($calc($ctime - $3)) ago. }
      if ($1 = K) { msg %xseen.chan %xseen.target was last seen being kicked from $4 (Kick Reason: $5- $+ ) $duration($calc($ctime - $3)) ago. }
      if ($1 = P) { msg %xseen.chan %xseen.target was last seen parting $4 (Part Reason: $5- $+ ) $duration($calc($ctime - $3)) ago. }
      if ($1 = N) { msg %xseen.chan %xseen.target was last seen changing his/her nick to $4 $duration($calc($ctime - $3)) ago. }
    }
    xdefclear
  }
 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.