mIRC Homepage
Posted By: Sl1pkn0t how would i do this.. - 14/12/02 04:35 AM
I want to make a alias that will read a ini and calc something like this
[ini]
-
[sLiPkNoT6]
start_ctime1=1039830206
start_ctime2=1039830219
-
I want to calc ctime1 to mins hours etc then same for 2 and so on then add them all together then return the total how would i go about doing this?
-
This is what i have for calc one of them
Code:
  
$duration($calc($ctime - $readini(time.ini,$nick,start_ctime)))

but how would i do it for muti ones like if theres 1,2,3,4,5,6,7,8,9 and so on....then add them all together anyone know?
Posted By: Hammer Re: how would i do this.. - 14/12/02 04:46 AM
Code:

  var %total, %i = 1
  while ($ini(time.ini,$nick,%i)) {
    if (start_ctime* iswm $ini(time.ini,$nick,%i)) %total = $calc(%total + ($ctime - $readini(time.ini,$nick,$ini(time.ini,$nick,%i))))
    inc %i
  }
  echo -ati2 * Total: %total
Posted By: Sl1pkn0t Re: how would i do this.. - 14/12/02 04:49 AM
I just tried that and i got this in the window :
-
[08:48 pm] * Total:
-
nothing....
Posted By: Hammer Re: how would i do this.. - 14/12/02 04:56 AM
Make sure you have your [$nick] section set up correctly, with start_ctimeN=ctimes. If it's not, then it will not work.

[Hammer]
start_ctime1=1039840977
start_ctime2=1039841077
start_ctime3=1039841177
start_ctime4=1039841277
start_ctime5=1039841377
Posted By: Sl1pkn0t Re: how would i do this.. - 14/12/02 04:58 AM
this is what i have in the ini...
-
[sLiPkNoT6]
start_ctime1=1039830206
start_ctime2=1039830219
-
Posted By: Hammer Re: how would i do this.. - 14/12/02 05:31 AM
//writeini time.ini Hammer start_ctime1 $ctime
//writeini time.ini Hammer start_ctime2 $ctime
//writeini time.ini Hammer start_ctime3 $ctime
//writeini time.ini Hammer start_ctime4 $ctime
//writeini time.ini Hammer start_ctime5 $ctime

[Hammer]
start_ctime1=1039843519
start_ctime2=1039843526
start_ctime3=1039843534
start_ctime4=1039843540
start_ctime5=1039843545

//var %total, %i = 1 | while ($ini(time.ini,Hammer,%i)) { if (start_ctime* iswm $ini(time.ini,Hammer,%i)) %total = $calc(%total + ($ctime - $readini(time.ini,Hammer,$ini(time.ini,Hammer,%i)))) | inc %i } | echo -ati2 * Total: %total

* Total: 766
* Total: 786
* Total: 931
* Total: 976

Works for me when I hard-code my own nick.

Posted By: Sl1pkn0t Re: how would i do this.. - 14/12/02 05:35 AM
Ya it works now heh smile thanks how would i convert that number to ....mins secs etc?
Posted By: theRat Re: how would i do this.. - 14/12/02 09:22 AM
...
echo -ati2 * Total: $duration(%total)
© mIRC Discussion Forums