mIRC Home    About    Download    Register    News    Help

Print Thread
A 'Last Seen' script #223301 20/07/10 11:00 PM
Joined: Jul 2010
Posts: 23
B
botnoob Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Jul 2010
Posts: 23
Wondering if anybody knew a place where I could download one (trusted site of course)

Thanks

Re: A 'Last Seen' script [Re: botnoob] #223306 21/07/10 02:07 AM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
mircscripts.org or similar.


Invision Support
#Invision on irc.irchighway.net
Re: A 'Last Seen' script [Re: Riamus2] #223309 21/07/10 02:10 AM
Joined: Jul 2010
Posts: 23
B
botnoob Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Jul 2010
Posts: 23
thanks a lot. laugh

Re: A 'Last Seen' script [Re: botnoob] #223459 25/07/10 11:00 AM
Joined: Apr 2007
Posts: 60
M
maconga Offline
Babel fish
Offline
Babel fish
M
Joined: Apr 2007
Posts: 60
I use this script. creates a folder for the network, and a .ini file for the name of each person. Copy and paste in the Remote Tab and save.

Code:
; $seen.dir -> network specific directory.
; $seen.dir(nick) -> network and nick specific file.
alias seen.dir {
  if ($0) {
    ; This will replace invalid characters with an underscore.
    var %fn = $replacex($1,/,_,\,_,:,_,",_,<,_,>,_,|,_)
    return $qt($+(seen\,$network,\,%fn,.ini))
  }
  else {
    return $qt($+(seen\,$network))
  }
}

; /seen.clear nick -> Clears the info stored about the nick
alias seen.clear {
  ; this are going to change [ to @ and ] to ~
  var %topic = $replacex($1,[,@,],~)
  var %filename = $seen.dir($1)
  if ($isfile(%filename)) {
    remini $seen.dir($1) %topic
  }
  else {
    var %dir = $qt($left($nofile(%filename),-1))
    if ($isdir(%dir) == $false) {
      mkdir %dir
    }
  }
}

; /seen.set nick name value -> Stores name=value for the nick.
alias seen.set {
  var %topic = $replacex($1,[,@,],~)
  var %filename = $seen.dir($1)
  var %dir = $qt($left($nofile(%filename),-1))
  if ($isdir(%dir) == $false) {
    mkdir %dir
  }
  if ($3 != $null ) { 
  writeini %filename %topic $2 $3- }
}

; $seen.get(nick,name) -> Retrieves the value stored for the nick.
alias seen.get {
  var %topic = $replacex($1,[,@,],~)
  var %filename = $seen.dir($1)
  return $readini(%filename,%topic,$2)
}

on 1:TEXT:!seen:#:{
  msg $chan $nick $+ , there are $findfile($seen.dir(*),0) seen records in my database. Please refine your search.
}

on 1:TEXT:suggest seen *:#:{
  var %pattern = $+(*,$3,*.ini)
  var %delay = 1
  .timer 1 %delay notice $nick [ClubCX AI] Based on your search, I would suggest you are looking for one of the following nicknames:
  inc %delay 2
  var %n = $findfile($seen.dir,%pattern,0)
  var %i = 1
  while (%i < %n) {
    .timer 1 %delay notice $nick $left($nopath($findfile($seen.dir,%pattern,%i)),-4)
    inc %delay 2
    inc %i
    if (%i == 5) { break }
  }
  .timer 1 %delay notice $nick I found $calc(%n - %i) more matches. You can refine your search even more by supplying a better query. For example, *TAR* instead of *AR*
}

on 1:TEXT:!seen *:#:{
  ; if the guy is looking for you
  if (* isin $2) || (? isin $2) {
    var %pattern = $+(*,$2,*.ini)
    msg $chan [ClubCX AI] $nick $+ , there are $findfile($seen.dir,%pattern,0) matching records in my database. To list them, type: suggest seen $2 
    return
  }
  elseif ($2 == $me) { 
    msg $chan $2 is running successfully. 
    return
  }
  ; if the guy is so stupid that he looks after him self
  elseif ($2 == $nick) { 
    msg $chan $nick $+ , you do realise this is a computer don't you? 
    return
  } 
  ; if the person he's looking for already is in the channel
  elseif ($2 ison $chan) { 
    msg $chan $nick $+ , $2- is still in $chan $+ .
    return
  }

  ; this are going to change [ to @ and ] to ~
  var %action = $seen.get($2,action)
  var %time = $seen.get($2,time)

  ; if he's not in the ini files
  if (%action == $null) {
    msg $chan Sorry $nick $+ . I haven't seen $2 around.
  }
  ; if the latest thing he did was to join the channel
  elseif (%action == join) { 
    var %joinchannel = $seen.get($2,channel)
    msg $chan $nick $+ , $2- joined %joinchannel $+ , $duration($calc($ctime - %time)) ago.
  }
  ; if the latest thing he did was to part the channel...
  elseif (%action == part) { 
    var %partchannel = $seen.get($2,channel)
    msg $chan $nick $+ , $2 parted %partchannel $+ , $duration($calc($ctime - %time)) ago.
  }
  ; if the latest thing he did was to quit...
  elseif (%action == quit) { 
    var %quitmessage = $seen.get($2,message)
    msg $chan $nick $+ , $2 quit with the message $qt(%quitmessage) $+ , $duration($calc($ctime - %time)) ago.
  }
  ; if the latest thing he did was to be kicked...
  elseif (%action == kick) { 
    var %kickchannel = $seen.get($2,channel)
    msg $chan $nick $+ , $2 was kicked from %kickchannel $+ , $duration($calc($ctime - %time)) ago.
  }
  ; if the latest thing he did was to change nickname
  elseif (%action == nick) { 
    var %nicknew = $seen.get($2,nick)
    msg $chan $nick $+ , $2 changed his nick to %nicknew $+ , $duration($calc($ctime - %time)) ago.
  }
  ; if the latest thing he did was to say something...
  elseif (%action == text) { 
    var %textchannel = $seen.get($2,channel)
    msg $chan $nick $+ , $2 said something $+ , $duration($calc($ctime - %time)) ago.
  }
  ; if the latest thing he did was an action
  elseif (%action == action) { 
    var %actionchannel = $seen.get($2,channel)
    msg $chan $nick $+ , $2 did an action in %actionchannel $+ , $duration($calc($ctime - %time)) ago.
  }
}

; when someone joins...
on 1:JOIN:#:{
  seen.clear $nick
  seen.set $nick action join
  seen.set $nick channel $chan 
  seen.set $nick time $ctime
}

; when someone parts the channel
on 1:PART:#:{
  seen.clear $nick
  seen.set $nick action part
  seen.set $nick channel $chan 
  seen.set $nick time $ctime
}

; when someone quits
on 1:QUIT:{
  seen.clear $nick
  seen.set $nick action quit
  seen.set $nick time $ctime
  seen.set $nick message $1-
}

; when some moron gets kicked from the channel
on 1:KICK:#:{
  seen.clear $nick
  seen.set $nick action kick
  seen.set $nick channel $chan 
  seen.set $nick time $ctime
}

; when someone changes nick
on 1:NICK:{
  seen.clear $nick
  seen.set $nick action nick
  seen.set $nick newnick $newnick
  seen.set $nick time $ctime
}

; when someone says something in the channel
on 1:TEXT:*:#:{
  seen.clear $nick
  seen.set $nick action text
  seen.set $nick channel $chan
  seen.set $nick text $1-
  seen.set $nick time $ctime
}

; when someone makes an action in the channel
on 1:ACTION:*:#:{
  seen.clear $nick
  seen.set $nick action action
  seen.set $nick channel $chan
  seen.set $nick text $nick $1-
  seen.set $nick time $ctime
}

Re: A 'Last Seen' script [Re: maconga] #223685 31/07/10 12:04 PM
Joined: Jul 2010
Posts: 5
K
Kanegasi Offline
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
K
Joined: Jul 2010
Posts: 5
Hey maconga, awesome script. This would be more of a separate problem, but it kind of pertains here, so I'll just piggy back in this thread. For some reason, mIRC couldn't make a directory. I had to go into the mIRC folder and create directories for the networks I use. The ini files are created just fine. I am running Windows 7 Pro as the sole user and administrator and I have tried running an elevated copy of mIRC which doesn't work. Any thoughts?

EDIT: Also, I would like to suggest a feature in the script for the ability to track the same person using several nicks. The way it's set up right now, for people looking for someone, they have to get lucky to catch the last known nick for that person, especially if he/she left with an afk or sleep version of their nick. Sure, there will still be ini files for old nicks and you could track the changes through several !seen requests, but there has to be a way to recognize them in a blanket way no matter what is requested in the !seen command. I envision usage of their mask to some point, also allowing leeway for possible different masks. I'll tinker with it and let you know if I get something usable if you want to use it.

Last edited by Kanegasi; 31/07/10 12:22 PM.
Re: A 'Last Seen' script [Re: Kanegasi] #223703 31/07/10 04:27 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Note that you may have issues with scripts having access to create folders/files or remove or change them if you install to Program Files in Vista or 7 depending on settings. If you install mIRC to something like c:\mirc\, you usually have fewer problems.


Invision Support
#Invision on irc.irchighway.net
Re: A 'Last Seen' script [Re: Riamus2] #223715 31/07/10 07:55 PM
Joined: Feb 2009
Posts: 133
C
chacha Offline
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
i agree with Riamus2

i think using $scriptdir is a good idea


WorldDMT