SHARE
TWEET

Hash viewer

Seb Nov 20th, 2011 (edited) 171 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dialog Hash {
  2.   title "Hash Dialog"
  3.   size -1 -1 294 171
  4.   option dbu
  5.   list 1, 8 11 83 107, size hsbar vsbar
  6.   box "Hash Tables", 2, 4 3 92 149
  7.   button "New Table", 3, 8 126 35 9
  8.   button "Del Table", 4, 55 126 35 9
  9.   box "Table Items", 5, 101 3 92 149
  10.   button "New Item", 6, 105 126 35 9
  11.   button "Del Item", 7, 152 126 35 9
  12.   list 8, 105 11 83 107, size hsbar vsbar
  13.   box "Item Data", 9, 198 3 92 149
  14.   list 10, 202 11 83 107, size hsbar vsbar
  15.   button "New Data", 11, 202 126 35 9
  16.   button "Del Data", 12, 249 126 35 9
  17.   button "Edit Table", 13, 31 139 35 9
  18.   button "Edit Item", 14, 129 139 35 9
  19.   button "Edit Data", 15, 226 139 35 9
  20.   button "...", 16, 181 155 11 12
  21.   edit "Input Search Term Here", 17, 4 155 135 12
  22.   button "Search", 18, 141 155 37 12
  23.   text "Hash Dialog Created by Zeta of SwiftIRC", 19, 194 157 99 8
  24.   button "OK", 20, 245 153 29 8
  25.   button "Cancel", 21, 245 161 29 8
  26.   edit "", 22, 173 155 68 10
  27.   edit "100", 23, 99 155 42 11, center
  28.   text "Number of Slots (Default of 100)", 24, 20 157 79 8
  29.   text "Table Name", 25, 142 157 29 8
  30.   text "New Data", 27, 142 157 25 8
  31.   edit "", 26, 70 155 68 10
  32.   text "New Item", 28, 43 157 25 8
  33. }
  34. on *:DIALOG:Hash:INIT:0:{
  35.   did -h Hash 20-28
  36.   var %Hget $hget(0)
  37.   var %X 1
  38.   while (%X <= %Hget) {
  39.     did -i Hash 1 %X $hget(%X)
  40.     inc %X
  41.   }
  42.   did -z Hash 1
  43.   did -b Hash 4,6,7,11,12,13,14,15
  44. }
  45. on *:DIALOG:Hash:SCLICK:1,8,10:{
  46.   if ($did == 1) {
  47.     if ($did(Hash, 1).sel) {
  48.       did -h Hash 20-28
  49.       did -v Hash 16-19
  50.       did -r Hash 8,10
  51.       did -e Hash 4,6,11,13
  52.       did -b Hash 7,14,12,15
  53.       var %Item $hget($did(Hash, 1).seltext,0).item
  54.       var %X 1
  55.       while (%X <= %Item) {
  56.         did -i Hash 8 %X $hget($did(Hash, 1).seltext,%X).item
  57.         did -i Hash 10 %X $hget($did(Hash, 1).seltext,%X).data
  58.         inc %X
  59.       }
  60.       did -z Hash 8,10
  61.     }
  62.   }
  63.   if ($did == 8) {
  64.     if ($did(Hash, 8).sel) {
  65.       did -h Hash 20-28
  66.       did -v Hash 16-19
  67.       did -c Hash 10 $did(Hash, 8).sel
  68.       did -e Hash 7,14,12,15
  69.     }
  70.   }
  71.   if ($did == 10) {
  72.     if ($did(Hash, 10).sel) {
  73.       did -h Hash 20-28
  74.       did -v Hash 16-19
  75.       did -c Hash 8 $did(Hash, 10).sel
  76.       did -e Hash 7,14,12,15
  77.     }
  78.   }
  79. }
  80. ;Numbers are so I wouldn't forget what $dids to put :>
  81. on *:DIALOG:Hash:SCLICK:3,4,6,7,11-16,18,20-25:{
  82.   if ($did == 3) {
  83.     did -h Hash 16-19,26-28
  84.     did -v Hash 20-25
  85.     did -r Hash 22
  86.     did -r Hash 23
  87.     did -a Hash 23 100
  88.   }
  89.   if ($did == 4) {
  90.     noop $input(Are you sure you would like to delete the table $+(',$did(Hash, 1).seltext,',?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
  91.     if ($! == $true) {
  92.       hfree $did(Hash, 1).seltext
  93.       did -d Hash 1 $did(Hash, 1).sel
  94.       did -b Hash 6,7,11-15
  95.       did -r Hash 8,10
  96.       did -z Hash 1
  97.     }
  98.   }
  99.   if ($did == 6) {
  100.     did -h Hash 16-25
  101.     did -v Hash 20-22,26-28
  102.   }
  103.   if ($did == 7) {
  104.     noop $input(Are you sure you would like to delete the item $+(',$did(Hash, 8).seltext,') from the $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) table $+(',$did(Hash, 1).seltext,'?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
  105.     if ($! == $true) {
  106.       hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
  107.       did -d Hash 8,10 $did(Hash, 8).sel
  108.       did -b Hash 7,11-15
  109.     }
  110.   }
  111.   if ($did == 11) {
  112.     did -h Hash 16-25
  113.     did -v Hash 20-22,26-28
  114.   }
  115.   if ($did == 12) {
  116.     noop $input(Are you sure you would like to delete the data $+(',$did(Hash, 10).seltext,') from the $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) table $+(',$did(Hash, 1).seltext,'?) $crlf $chr(160) $chr(160) $chr(160) $chr(160) $chr(160) There's no way of restoring it if you do.,w,Delete Warning)
  117.     if ($! == $true) {
  118.       hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
  119.       did -d Hash 8,10 $did(Hash, 8).sel
  120.       did -b Hash 7,11-15
  121.     }  
  122.   }
  123.   if ($did == 13) {
  124.     did -h Hash 16-19,23,24,26-28
  125.     did -v Hash 20-22,25
  126.     did -r Hash 22
  127.     did -a Hash 22 $did(Hash, 1).seltext
  128.   }
  129.   if ($did == 14) {
  130.     did -h Hash 16-25
  131.     did -v Hash 20-22,26-28
  132.     did -r Hash 22,26
  133.     did -a Hash 22 $did(Hash, 10).seltext
  134.     did -a Hash 26 $did(Hash, 8).seltext
  135.   }
  136.   if ($did == 15) {
  137.     did -h Hash 16-25
  138.     did -v Hash 20-22,26-28
  139.     did -r Hash 22,26
  140.     did -a Hash 22 $did(Hash, 10).seltext
  141.     did -a Hash 26 $did(Hash, 8).seltext
  142.   }
  143.   if ($did == 16) {
  144.     did -z Hash 1
  145.     did -b Hash 4,6,7,11,12,13,14,15
  146.     did -r Hash 1,8,10
  147.     did -u Hash 1 $did(Hash, 1).sel
  148.     did -r Hash 17
  149.     did -a Hash 17 Input Search Term Here
  150.     var %Hget $hget(0)
  151.     var %Z 1
  152.     while (%Z <= %Hget) {
  153.       did -i Hash 1 %Z $hget(%Z)
  154.       inc %Z
  155.     }
  156.   }
  157.   if ($did == 18) {
  158.     if ($did(Hash, 17).edited) {
  159.       did -r Hash 1,8,10
  160.       var %X 1
  161.       var %Y $hget(0)
  162.       while (%X <= %Y) {
  163.         if ($replace($did(Hash, 17).text,$chr(32),_) isin $hget(%X)) {
  164.           did -a Hash 1 $hget(%X)
  165.           inc %X
  166.         }
  167.         else {
  168.           inc %X
  169.         }
  170.       }
  171.       did -z Hash 1
  172.     }
  173.   }
  174.   if ($did == 20) {
  175.     if ($did(Hash, 27).visible == $true) {
  176.       if (!$did(Hash, 8).sel) || (!$did(Hash, 10).sel) {
  177.         hadd $did(Hash, 1).seltext $replace($did(Hash, 26).text,$chr(32),_) $did(Hash, 22).text
  178.         did -i Hash 8 1 $replace($did(Hash, 26).text,$chr(32),_)
  179.         did -i Hash 10 1 $did(Hash, 22).text
  180.       }
  181.       elseif ($did(Hash, 22).edited) || ($did(Hash, 26).edited) {
  182.         if (!$did(Hash, 22).text) || (!$did(hash, 26).text) {
  183.           noop $input(Please put an item and data!,h,Error)
  184.         }
  185.         else {
  186.           hdel $did(Hash, 1).seltext $did(Hash, 8).seltext
  187.           hadd $did(Hash, 1).seltext $replace($did(Hash, 22).text,$chr(32),_) $replace($did(Hash, 26).text,$chr(32),_)
  188.           did -d Hash 8,10 $did(Hash, 8).sel
  189.           did -i Hash 8 1 $replace($did(Hash, 22).text,$chr(32),_)
  190.           did -i Hash 10 1 $replace($did(Hash, 26).text,$chr(32),_)
  191.           did -h Hash 20-28
  192.           did -v Hash 1-19
  193.         }
  194.       }
  195.     }
  196.     if ($did(Hash, 24).visible != $true) && ($did(Hash, 25).visible == $true) {
  197.       if ($did(Hash, 22).edited) {
  198.         if (!$did(Hash, 22).text) {
  199.           noop $input(Please put a new table name!,h,Error)
  200.         }
  201.         else {
  202.           hsave -b $did(Hash, 1).seltext ht.temp
  203.           hfree $did(Hash, 1).seltext
  204.           hmake $replace($did(Hash, 22).text,$chr(32),_)
  205.           hload -b $replace($did(Hash, 22).text,$chr(32),_) ht.temp
  206.           remove ht.temp
  207.           did -d Hash 1 $did(Hash, 1).sel
  208.           did -i Hash 1 1 $replace($did(Hash, 22).text,$chr(32),_)
  209.           did -r Hash 8,10
  210.           did -h Hash 20-28
  211.           did -v Hash 1-19
  212.         }
  213.       }
  214.     }
  215.     if ($did(Hash, 24).visible == $true) && ($did(Hash, 25).visible == $true) {
  216.       if (!$did(Hash, 22).text) || (!$did(hash, 23).text) {
  217.         noop $input(Please put a table name and number of slots!,h,Error)
  218.       }
  219.       else {
  220.         hmake $did(Hash, 22).text $did(Hash, 23).text
  221.         did -r Hash 8,10
  222.         did -h Hash 20-28
  223.         did -v Hash 1-19
  224.         did -i Hash 1 1 $replace($did(Hash, 22).text,$chr(32),_)
  225.       }
  226.     }
  227.   }
  228.   if ($did == 21) {
  229.     did -h Hash 20-28
  230.     did -a Hash 22,26
  231.     did -v Hash 1-19
  232.   }
  233. }
RAW Paste Data
Top