mIRC Home    About    Download    Register    News    Help

Print Thread
#1576 14/12/02 04:35 AM
Joined: Dec 2002
Posts: 22
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2002
Posts: 22
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?

#1577 14/12/02 04:46 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
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


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#1578 14/12/02 04:49 AM
Joined: Dec 2002
Posts: 22
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2002
Posts: 22
I just tried that and i got this in the window :
-
[08:48 pm] * Total:
-
nothing....

#1579 14/12/02 04:56 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
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


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#1580 14/12/02 04:58 AM
Joined: Dec 2002
Posts: 22
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2002
Posts: 22
this is what i have in the ini...
-
[sLiPkNoT6]
start_ctime1=1039830206
start_ctime2=1039830219
-

#1581 14/12/02 05:31 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
//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.



DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#1582 14/12/02 05:35 AM
Joined: Dec 2002
Posts: 22
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Dec 2002
Posts: 22
Ya it works now heh smile thanks how would i convert that number to ....mins secs etc?

#1583 14/12/02 09:22 AM
Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
...
echo -ati2 * Total: $duration(%total)


Code:
//if ( khaled isgod ) echo yes | else echo no

Link Copied to Clipboard