Snippets
  • Uploaded By: entropy
  • Added: 2 years ago
  • Updated: 1 month ago
  • mIRC Version: 7.52+
  • Hits: 948
  • Size: 5.67KB
  • Downloads: 37
  • Review By: entropy



Simple Seen v1.8

This snippet stores data for each nick and returns it with the !seen command.
Screenshot...

  
  4    0  Login to Vote.


Source Code:
  1. ; Simple Seen v1.8 - by entropy 2020
  2. ; Usage: !seen <nick>
  3.  
  4. on *:start:{ .timerseen -o 0 300 saveall }
  5. on *:exit:{ saveall }
  6. on *:disconnect:{ if ($hget($+(seen.,$network))) { hsave -o $+(seen.,$network) $qt($+($scriptdir,seen.,$network,.dat)) | hfree $+(seen.,$network) } }
  7.  
  8. on *:connect:{
  9. if (!$hget($+(seen.,$network))) { hmake $+(seen.,$network) 100 }
  10. if ($exists($qt($+($scriptdir,seen.,$network,.dat)))) { hload $+(seen.,$network) $qt($+($scriptdir,seen.,$network,.dat)) }
  11. }
  12.  
  13. alias -l saveall { var %a = 1, %b | while ($scon(%a)) { %b = $v1 | scid %b | if ($hget($+(seen.,$network))) { hsave -o $+(seen.,$network) $qt($+($scriptdir,seen.,$network,.dat)) } | inc %a } }
  14. alias -l clearall { var %a = 1, %b | while ($scon(%a)) { %b = $v1 | scid %b | if ($hget($+(seen.,$network))) { hfree $+(seen.,$network) | hmake $+(seen.,$network) 100 } | inc %a } }
  15.  
  16. #seen on
  17. on *:text:*:#:{
  18. hadd -m $+(seen.,$network) $fulladdress $ctime Messaging # with text: $qt($1-)
  19. if (?seen iswm $1 && $left($1,1) isin @!.) {
  20. if (!$2) { msg # No "seen" nickname specified! }
  21. else { seenx # $2 $1- }
  22. }
  23. }
  24. on *:input:#:{
  25. if ($server && /* !iswm $1) { hadd -m $+(seen.,$network) $address($me,5) $ctime Messaging # with text: $qt($1-) }
  26. if (?seen iswm $1 && $left($1,1) isin @!.) {
  27. if (!$2) { msg # No "seen" nickname specified! }
  28. else { seenx # $2 $1- }
  29. }
  30. }
  31.  
  32. on *:action:*:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Actioning # with text: $qt($1-) }
  33. on *:join:#:{ if ($nick == $me) { .ialfill # } | hadd -m $+(seen.,$network) $fulladdress $ctime Joining # }
  34. on *:part:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Parting # with text: $qt($1-) }
  35. on *:rawmode:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Setting # mode(s) to: $qt($1-) }
  36. on *:kick:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Kicking $knick out of # with text: $qt($1-) }
  37. on *:quit:{ hadd -m $+(seen.,$network) $fulladdress $ctime Quitting IRC with text: $qt($1-) }
  38. on *:topic:#:{ hadd -m $+(seen.,$network) $fulladdress $ctime Setting # topic to: $qt($1-) }
  39. on *:nick:{ hadd -m $+(seen.,$network) $fulladdress $ctime Changing nickname to: $newnick }
  40.  
  41. alias -l seenx {
  42. var %all, %host
  43. if ($gettok($address($2,5),2,33)) { %host = $+($2,!,$v1) }
  44. else { %host = $+($2,!*) }
  45.  
  46. if (* isin $2) { %all = $hfind($+(seen.,$network),$2,1,w).item | var %nick = $gettok(%all,1,33) }
  47. else { %all = $hfind( $+(seen.,$network) , %host , 1 , w).item | var %nick = $gettok(%all,1,33) }
  48.  
  49. if ($2 == $me) { msg $1 I'm right here! | return }
  50.  
  51. var %a = $2
  52. var %b = $hget($+(seen.,$network),%a)
  53. var %q = $hfind($+(seen.,$network),%a,1).item
  54. var %time = $asctime($gettok($hget($+(seen.,$network),%all),1,32))
  55. var %nt = $gettok($hget($+(seen.,$network),%all),1,32)
  56. var %dur = $calc($ctime - %nt)
  57. var %dur = $remove($replace($duration(%dur),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)) ago
  58. var %rsn = $gettok($hget($+(seen.,$network),%all),2-,32)
  59. var %no = $gettok(%all,2,33)
  60. var %mo = $gettok($gettok(%b,1,32),2,33)
  61. var %r = $gettok($hfind($+(seen.,$network),%a,1,w).item,1,33)
  62.  
  63. if (* isin $2) {
  64. var %total = $hfind($+(seen.,$network),$2,0,w).item
  65. if (%total >= 5) { msg $1 [Seen] $chr(9679) $qt($2) has $bytes(%total,b) $iif(%total == 1,result!,results!) Please refine your search and try again! }
  66. elseif (%total != 1) {
  67. var %c = 1, %d, %all
  68. while ($hfind($+(seen.,$network),$2,%c,w).item) {
  69. %d = $v1
  70. %all = %all %d
  71. inc %c
  72. }
  73. if ($numtok(%all,32) >= 5) { %all = $gettok(%all,1-5,32) $+ ... }
  74. if ($numtok(%all,32) != 0) { msg $1 [Seen] $chr(9679) Found $bytes($numtok(%all,32),b) $iif($numtok(%all,32) == 1,Result:,Results:) $replace(%all,$chr(32),$+($chr(44),$chr(32))) }
  75. else { msg $1 [Seen] $chr(9679) No results found! }
  76. }
  77. elseif ($hfind($+(seen.,$network),$2,1,w).item) {
  78. var %all = $hfind($+(seen.,$network),$2,1,w).item
  79. var %a = %all
  80. var %b = $hget($+(seen.,$network),%all)
  81. var %q = $gettok(%all,1,33)
  82. var %time = $asctime($gettok($hget($+(seen.,$network),%a),1,32))
  83. var %nt = $gettok($hget($+(seen.,$network),%a),1,32)
  84. var %dur = $calc($ctime - %nt)
  85. var %dur = $remove($replace($duration(%dur),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)) ago
  86. var %rsn = $gettok($hget($+(seen.,$network),%a),2-,32)
  87. var %no = $gettok(%a,1,33)
  88. var %mo = %all
  89. msg $1 [Seen] $chr(9679) I Last Saw $qt(%q) $iif(%mo,$+($chr(40),$gettok(%mo,2,33),$chr(41))) %time $+($chr(40),%dur,$chr(41)) - %rsn
  90. }
  91. else { msg $1 [Seen] $chr(9679) I have not seen that person. }
  92. }
  93. elseif (%all) {
  94.  
  95. var %c = 1, %d, %e, %elapsed, %found
  96. while ($hfind($+(seen.,$network),$+($2,!*),%c,w).item) {
  97. %d = $v1
  98. %e = $gettok($hget($+(seen.,$network),%d),1,32)
  99. if (%e >= %elapsed || !%elapsed) {
  100. %found = %d $hget($+(seen.,$network),%d)
  101. %elapsed = %e
  102. }
  103. inc %c
  104. }
  105. if (%found) {
  106. var %nick = $gettok(%found,1,33)
  107. var %c = $gettok(%found,1,32)
  108. var %d = $gettok(%found,2-,32)
  109.  
  110. var %time = $asctime($gettok(%found,2,32))
  111. var %dur = $calc($ctime - $gettok(%found,2,32))
  112. var %dur = $remove($replace($duration(%dur),wks,w,wk,w,days,d,day,d,hrs,h,hr,h,mins,m,min,m,secs,s,sec,s),$chr(32)) ago
  113. var %rsn = $gettok(%d,2-,32)
  114. msg $1 [Seen] $chr(9679) I Last Saw $qt(%nick) $+($chr(40),$gettok(%c,2,33),$chr(41)) %time $+($chr(40),%dur,$chr(41)) - %rsn
  115. }
  116. }
  117. else { msg $1 [Seen] $chr(9679) I have not seen that person. }
  118. }
  119. #seen end
  120.  


Comments (2)
November 27th, 2018 - By: hornest
Weird that it also works with ".seen"
I would like to see wildcard usage with it.
Like !seen nick*
Regards
November 27th, 2018 - By: entropy
Admin
Done.

Login to Comment.