mIRC Home    About    Download    Register    News    Help

Print Thread
#138417 31/12/05 01:48 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
i have
Code:
on *:start: {    
  if ($isfile(away.hsh)) {      
    hmake away 5    
    hload -o away away.hsh  
  }  
  else { 
    hmake away 5
    hadd away $+($date,$time) away  
  }
  if ($isfile(back.hsh)) {      
    hmake back 5    
    hload -o back back.hsh  
  }  
  else { 
    hmake back 5
    hadd back $+($date,$time) back  
  }
  if ($isfile(suffix.hsh)) {      
    hmake suffix 5    
    hload -o suffix suffix.hsh  
  }  
  else { 
    hmake suffix 5
    hadd suffix $+($date,$time) away  
  }
}
on *:exit: { 
  hsave -o away " $+ $scriptdiraway.hsh"  
  hfree away 
  hsave -o back " $+ $scriptdirback.hsh"  
  hfree back 
  hsave -o suffix " $+ $scriptdirsuffix.hsh"  
  hfree suffix 
}
on *:load:{
  if ($isfile(away.hsh)) {      
    hmake -s away 5    
    hload -so away away.hsh  
  }  
  else { 
    hmake -s away 5 
    hadd -s away $+($date,$time) away  
  }
  if ($isfile(back.hsh)) {      
    hmake -s back 5    
    hload -so back back.hsh  
  }  
  else { 
    hmake -s back 5
    hadd -s back $+($date,$time) back  
  }
  if ($isfile(suffix.hsh)) {      
    hmake -s suffix 5    
    hload -so suffix suffix.hsh  
  }  
  else { 
    hmake -s suffix 5
    hadd -s suffix $+($date,$time) away  
  }
  if (%as6cooldown == $null) {
    set %as6cooldown 160
  }
  set %as6awaymessage away
  set %as6backmessage back
  set %as6awaysuffix away
}
on *:unload:{
  away.off
  autoaway.off
  autoback.off  
  unset %as6*
  remove away.hsh
  remove back.hsh
  remove suffix.hsh
  hfree -s away
  hfree -s back
  hfree -s suffix
}

when i load the file i get this
* Made hash table 'away' (5)
-
* Added item '30/12/200519:43:48' to hash table 'away'
-
* Made hash table 'back' (5)
-
* Added item '30/12/200519:43:48' to hash table 'back'
-
* Made hash table 'suffix' (5)
-
* Added item '30/12/200519:43:48' to hash table 'suffix'
-
* /hmake: table 'away' exists (line 7, AWAYSC~1.MRC)
-

any idea why i get that last bit about the table already existing

Last edited by NeUtRoN_StaR; 31/12/05 01:58 AM.
#138418 31/12/05 02:02 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
well if i have it right it might be due to the presence on a on start event as well as a on load event

if i understand it correctly on start fires the first time a script is loaded as well as every subsequent time mirc is started

never the less confimartion is always nice

#138419 31/12/05 02:27 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Consider it confirmed. What I do, to be on the safe side, is use something like
Code:
 if !$hget(<table_name>) { .hmake table_name table_size }
 

That way, it checks if the table already exists, then makes it if it doesn't exist.

#138420 31/12/05 06:07 AM
Joined: Mar 2005
Posts: 212
N
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Mar 2005
Posts: 212
i went ahead and got rid of the on load and just beefed up the onstart it works well enough
i had plenty of time to do the !$hget later on in the script
although i think i took the more verbose route
$hget == $null


Link Copied to Clipboard