mIRC Home    About    Download    Register    News    Help

Print Thread
#28967 10/06/03 02:07 AM
Joined: Dec 2002
Posts: 271
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
hey, i have been away from scripting for a while, and am finding myself having trouble workin this out....
i'll try to explain it the best i can......

i have a hash table, with items names 1,2,3,4 etc, for example:


1 blah
2 me
3 you
4 them
5 us

Now, i send to the alias: everyone, so now it should look like this:

1 everyone
2 blah
3 me
4 you
5 them
6 us

and i can get that just fine, but now, if i send me to the alias again, and its already in the table somewhere, i end up getting multiple's, which i dont want, if i sent "me" to the alias, and its already in the alias, i want it to just place it at the top, and reorder the rest, without losing any or gaining any...so it would like like this:

1 me
2 everyone
3 blah
4 you
5 them
6 us

#28968 10/06/03 02:10 AM
Joined: Dec 2002
Posts: 271
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
ok, nevermind, sorted it out...i'll post what i came up with, and maybe someone might have a better way to do it, lol, thanks anyway tho smile




Code:
 alias -l r.recent {
  $iif(!$hget(recent),hmake recent 10)
  $iif($isfile(recent.rm),hload recent recent.rm)
  if ($hfind(recent,$1-).data) {
    var %a = $ifmatch
    while ($hget(recent,$calc(%a - 1))) {
      var %ifmatch = $ifmatch
      $iif(%a == 0,break)
      hadd recent %a %ifmatch
      dec %a
    }
  }
  else {
    var %a = $hget(recent,0).item
    while ($hget(recent,%a)) {
      $iif(%a == 0,break)
      hadd recent $calc(%a + 1) $hget(recent,%a)
      dec %a
    }
  }
  hadd recent 1 $1-
  hsave -o recent recent.rm
  hfree recent
}
 




Link Copied to Clipboard