mIRC Home    About    Download    Register    News    Help

Print Thread
#121039 23/05/05 03:16 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Is there a way to save the value of a time identifier like $ctime or $fulladdress to a % variable so that it can be used later? I'm writing a script that does the same as /whowas except with more features, and I want to save the value of a time identifier when a person joins so I can record it. Thanks.

#121040 23/05/05 03:24 PM
Joined: Mar 2004
Posts: 359
L
Fjord artisan
Offline
Fjord artisan
L
Joined: Mar 2004
Posts: 359
on 1:join:#: { set %time $ctime } or whatever, is that what your lookin for?

#121041 23/05/05 03:45 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You could try something along the lines of..

Code:
alias hash { return times }

On *:Start: {
  hmake $hash
  if ($isfile(times.dat)) hload -oi $hash times.dat
}

On *:Join:#: {
  if (!$hget($hash)) hmake $hash
  if (!$hget($hash,$nick)) { hadd $hash $nick $time }
  else { hadd $hash $nick $+($hget($hash,$nick),$chr(44),$time) }
  hsave -oi $hash times.dat
}

alias times {
  if ($hfind($hash,$1)) echo -a $1 has joined at these times: $hget($hash,$1)
}


When someone joins the channel their nickname gets stored in a hash table which is then saved further on in the event. If the nick exists it gets seperated by a , (comma) with the date next to the previous.

Example:

When they first join:
Andy=16:40:03.

If that's their third join:
Andy=16:40:03,16:40:59,16:43:09

You can check back for references by typing /times <nick> if you was to type /times Andy as used above you'd get a message echoed to you saying: Andy has joined at these times: 16:40:03,16:40:59,16:43:09.

*Note: If you want it for $ctime instead of $time, that can easily be changed from:

Code:
if (!$hget($hash,$nick)) { hadd $hash $nick $time }
else { hadd $hash $nick $+($hget($hash,$nick),$chr(44),$time) }

to:

Code:
if (!$hget($hash,$nick)) { hadd $hash $nick $ctime }
else { hadd $hash $nick $+($hget($hash,$nick),$chr(44),$ctime) }


When mIRC closes, data wont be lost. mIRC loads it back in when you start your script. Hope this helps.

-Andy

#121042 23/05/05 03:46 PM
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Thank you...that was exactly what I was looking for. Now I feel stupid that it was that easy, lol. I didn't realize you could set variables in a different syntax (I'm relatively new to this). Thanks again.


Link Copied to Clipboard