Public paste
Hlist v1.9
By: Kashin | Date: Feb 1 2007 13:42 | Format: None | Expires: never | Size: 6.75 KB | Hits: 1298

  1. ; /hlist [-asw] [table] [item] [data] [window]
  2. ; -a active
  3. ; -s status
  4. ; -w @window
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; HLIST ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6. ;Info:
  7. ;
  8. ;  By Kashin @ QuakeNet
  9. ;  Version 1.9 (written and tested on mIRC 6.17)
  10. ;
  11. ;  Last edit: Sat July 1 2006
  12. ;
  13. ;
  14. ;What does this script do?
  15. ;
  16. ;  List items and data of a hash table
  17. ;
  18. ;How to use:
  19. ;
  20. ;  /hlist [-asw] [table] [item] [data] [window]
  21. ;
  22. ;Parameters
  23. ;
  24. ; The -a echoes to the active window
  25. ; The -s echoes to the status window
  26. ; The -w echoes to a custom window (Own window names can be used: /hlist -w <table> <data> [window name])
  27. ; Should no name be given, default window name will be used.
  28. ;
  29. ;Updates
  30. ;
  31. ; * Added end report
  32. ; * Added total items in table display
  33. ; * Added matching items for each table
  34. ;
  35. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  36.  
  37. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.COLOR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  38. ; Set the color code for the background color of none matching items/data, note this only works if hlist.display is set to 1.
  39. alias -l hlist.color {
  40.   !return 14
  41. }
  42.  
  43. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.DISPLAY ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  44. ; Set this to 0 if you want the script to hide non-matching items.
  45. ; Set this to 1 if you want the script to give non-matching items a background color instead of hiding them.
  46. ; Set this to 2 if you want the script to make matching items a background color.
  47. alias -l hlist.display {
  48.   !return 1
  49. }
  50.  
  51. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.ITEMS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  52. ; Set this to 1 if you want the script to show amount of items in each table when performing a search
  53. alias -l hlist.items {
  54.   !return 1
  55. }
  56.  
  57. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.ITEMS.MATCH ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  58. ; Set this to 1 if you want the script to show amount of matching items in each table
  59. alias -l hlist.items.match {
  60.   !return 1
  61. }
  62.  
  63. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.MS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  64. ; Set this to 1 if you want the script to show how many ms search took.
  65. alias -l hlist.ms {
  66.   !return 1
  67. }
  68.  
  69. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.REPORT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  70. ; Set this to 1 if you would like a report of search shown when search is done.
  71. alias -l hlist.report {
  72.   !return 1
  73. }
  74.  
  75. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.SEPERATOR ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  76. ; Set the sign that should be seperating data from items when performing a search.
  77. alias -l hlist.seperator {
  78.   !return -->
  79. }
  80.  
  81. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.SIGN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  82. ; Set the sign that should be used next to table matches, names, end's and search ms.
  83. alias -l hlist.sign {
  84.   !return :::
  85. }
  86.  
  87. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST.WINDOW ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  88. ; Set the default window name if none should be suplied.
  89. alias -l hlist.window {
  90.   !return @Hlist
  91. }
  92.  
  93. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS HLIST ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  94. alias hlist {
  95.   if ($hlist.ms == 1) { var %ticks = $ticks }
  96.   if (!$1) { var %1 = *,%2 = *,%3 = * }
  97.   else { var %1 $1,%2 $iif($2,$2,*),%3 $iif($3,$3,*),%4 $iif($4,$4,*),$iif($5,%5 $5) }
  98.   elseif (($left(%1,1) == -) && (!$istokcs(-a -s -w ,%1,32))) { echo $color(info text) -es * /hlist: invalid switch ( $+ %1 $+ ) | halt }
  99.   elseif (($left(%1,1) == -) && ($istokcs(-a -s -w,%1,32)) && (!%2)) { echo $color(info text) -es * /hlist: insufficient parameters | halt }
  100.   elseif ($iif($left(%1,1) == -,%5,%4)) { echo $color(info text) -es * /hlist: too many parameters | halt }
  101.   elseif (($chr(42) !isin $iif($left(%1,1) == -, %2, %1)) && ($hget($iif($left(%1,1) == -, %2, %1)) == $null)) { echo $color(info text) -es * /hlist: No matching table ( $+ $iif($left(%1,1) == -, %2, %1) $+ ) | halt }
  102.   var %i = 1, %c = 0,%it = $color(info text)
  103.   while (%i <= $hget(0)) {
  104.     if ($iif($left(%1,1) == -, %2, %1) iswm $hget(%i)) { var %tjeck = $true | inc %c }
  105.     inc %i
  106.   }
  107.   if (!%tjeck) { echo %it -as * /hlist: No matching $iif($chr(42) isin $iif($left(%1,1) == -, %2, %1), tables, table) ( $+ $iif($left(%1,1) == -, %2, %1) $+ ) | halt }
  108.   var %w = $iif($left(%1,1) == -, %1, -a)
  109.  
  110.   if (%w == -w) {
  111.     var %w = $iif(%5 == $null,$hlist.window $+ . $+ %2 $+ . $+ %3 $+ $+ . $+ %4, $iif($left(%5,1) == @,$left(%5,-1),@ $+ $left(%5,-1)))
  112.     window -e %w
  113.   }
  114.   if ($chr(42) isin $iif($left(%1,1) == -, %2, %1)) echo %it $iif($left(%w,1) == @, -e %w, %w $+ e) $hlist.sign %c $iif(%c == 1, table, tables) matching ( $+ $iif($left(%1,1) == -, %2, %1) $+ ) $hlist.sign
  115.   var %i = 1
  116.   while (%i <= $hget(0)) {
  117.     if ($iif($left(%1,1) == -, %2, %1) iswm $hget(%i)) {
  118.       echo %w $hlist.sign  $+ $hget(%i) $+  $iif($hlist.items == 1,$chr(40) $+ $hget(%i,o).item) items $+ $chr(41)) $hlist.sign
  119.       if (($hlist.display == 1) || ($hlist.display == 2)) {
  120.         var %j = 1, %mi = 0, %mi.t = 0
  121.         while (%j <= $hget(%i,0).item) {
  122.           if ($hlist.display == 1) {
  123.           echo %w $iif(($iif($left(%1,1) == -,%3,%2) !iswm $hget(%i,%j).item || $iif($left(%1,1) == -,%4,%3) !iswm $hget(%i,%j).data), $+ $color(normal text) $+ $chr(44) $+ $hlist.color) $+ $hget(%i,%j).item $hlist.seperator $hget(%i,%j).data }
  124.           if ($hlist.display == 2) { echo %w $iif(($iif($left(%1,1) == -,%3,%2) iswm $hget(%i,%j).item && $iif($left(%1,1) == -,%4,%3) iswm $hget(%i,%j).data), $+ $color(normal text) $+ $chr(44) $+ $hlist.color) $+ $hget(%i,%j).item $hlist.seperator $hget(%i,%j).data }
  125.           inc %j
  126.         }
  127.       }
  128.       else {
  129.         var %j = 1, %a = $hfind(%i,$iif($left(%1,1) == -,%3,%2),0,w), %item = $iif($left(%1,1) == -,%3,%2), %mi = 0, %mi.t = 0
  130.         while (%j <= %a)  {
  131.           $iif($iif($left(%1,1) == -,%4,%3) iswm $hget(%i,$hfind(%i,%item,%j,w)),echo %w $hfind(%i,%item,%j,w) $hlist.seperator $hget(%i,$hfind(%i,%item,%j,w))) | inc %mi | inc %mi.t
  132.           inc %j      
  133.         }
  134.       }
  135.       echo $iif($left(%w,1) == @, -e %w, %w $+ e) $hlist.sign Table end $iif($hlist.items.match == 1,$chr(40) $+ %mi items matching $+ $chr(41)) $hlist.sign
  136.     }
  137.     inc %i
  138.   }
  139.   if ($hlist.report == 1) {
  140.     echo %it %w End report:
  141.     echo %it %w Search Criteria: Table: %1 ; Item: %2 ; Data: %3
  142.     echo %it %w %c matching $iif(%c == 1,table,tables)
  143.     echo %it %w %mi.t matching $iif(%mi.t == 1,item,items)
  144.   }
  145.   if ($hlist.ms == 1) { echo $iif($left(%w,1) == @, -e %w, %w $+ e) $hlist.sign Search took $calc($ticks - %ticks) ms $hlist.sign }
  146. }
  147.  
  148. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SCRIPT END ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  149.