mIRC Home    About    Download    Register    News    Help

Print Thread
#71188 12/02/04 03:55 PM
Joined: Mar 2003
Posts: 27
doglem Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Mar 2003
Posts: 27
Hidy laugh I am working on an away system and I have an option in it so that you can deop/dehop/devoice when you set away. I have got it working so when you set away it will drop ur status in all your channels, but I'm having trouble when I set back to gain the access back. When I set away I have it set to add the network;channel;access to a hash table: ie: DALnet;#arandomchan;op .. then when I try to set back and regain my access I have a script that reads from the hashtable but it is producing some problems, It will regain my status on the channels that I type the command in first: say i have DALnet Gh0st4u.Net and Axenet, if i type the alias "/astatus" on a DALnet window I will regain the status in the channels on DALnet, but it seems it doesn't want to dec the scon var because it will get my access back on DALnet but it wont on Axenet or Gh0st4u.net? I've tested to make sure that the channels+access is listed in the hashtable and they are. in the format Network:#Channel:Status : heres both the alias that I use when i set away, and the alias I use when i set back:
-=-=-=-=-=-=-=-=-=-=-
Code:
alias dstatus {
  set %d $scon(0)
  if ($hget(awaydstat)) { hfree awaydstat }
  if (!$hget(awaydstat)) { hmake awaydstat }
  while (%d >= 1) {
    scid $scon(%d)
    set %i $chan(0)
    while (%i >= 1) {
      if ($me isop $chan(%i)) { mode $chan(%i) -ov $me $me | hadd awaydstat $network $+ $chr(59) $+ $chan(%i) $+ $chr(59) $+ op | goto end }
      if ($me ishop $chan(%i)) { chanserv dehalfop $chan(%i) $me | hadd awaydstat $network $+ $chr(59) $+ $chan(%i) $+ hop | goto end }
      if ($me isvoice $chan(%i)) { hop $chan(%i) | hadd awaydstat $network $+ $chr(59) $+ $chan(%i) $+ $chr(59) $+ voice }
      :end     
      dec %i
    }
    dec %d
  }
  hsave awaydstat remotes\away.hts
}

-=-=-=-=-=-=-=-=-=-=-=-=-

alias astatus {
  if (!$hget(awaydstat)) { hload awaydstat remotes\away.hts }
  set %d $scon(0)
  set %i $hget(awaydstat,0).item
  while (%d >= 1) {
    while (%i >= 1) {
      if ($scon(%d).network = $gettok($hget(awaydstat,%i).item,1,59)) { 
        scon %d
        if ($gettok($hget(awaydstat,%i).item,3,59) = op) { chanserv op $chan(%i) $me | goto end }
        if ($gettok($hget(awaydstat,%i).item,3,59) = hop) { chanserv halfop $chan(%i) $me | goto end }
        if (($gettok($hget(awaydstat,%i).item,3,59) = voice) && ($network != DALnet)) { chanserv voice $chan(%i) $me }
        :end
      } 
      dec %i
    }
    dec %d
  }
}
  


Mess with the best, Die like the rest.
#71189 12/02/04 10:23 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
set %i $hget(awaydstat,0).item
while (%d >= 1) {
while (%i >= 1) {

replace with

while (%d >= 1) {
set %i $hget(awaydstat,0).item
while (%i >= 1) {

your problem was after the first pass %i well be zero so every other pass the inner while loop is never actioned as %i is already zero.

#71190 15/02/04 02:30 PM
Joined: Mar 2003
Posts: 27
doglem Offline OP
Ameglian cow
OP Offline
Ameglian cow
Joined: Mar 2003
Posts: 27
Thanks bunches! grin I had been up so long I just overlooked the simpler stuff. Thanks again!


Mess with the best, Die like the rest.

Link Copied to Clipboard