mIRC Home    About    Download    Register    News    Help

Print Thread
#113833 09/03/05 04:24 AM
Joined: Jan 2004
Posts: 84
A
Adriano Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Jan 2004
Posts: 84
see this code

$remove($replace($uptime(mirc,1),mins,m,secs,s), $+ $chr(32) $+ )

i need to remove that secs,s and if is possible to say like this

Uptime: 3h and 20m i not want that secs.


any help please.
thanks.

#113834 09/03/05 04:31 AM
Joined: Nov 2003
Posts: 257
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Nov 2003
Posts: 257
fairly simple

//echo $uptime(mirc,1)

returns 10hrs 25mins 3secs

//echo $uptime(mirc,2)

returns 10hrs 25mins

Last edited by alkahol1k; 09/03/05 04:32 AM.
#113835 09/03/05 04:38 AM
Joined: Jan 2004
Posts: 84
A
Adriano Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Jan 2004
Posts: 84
alkahol1k, thanks for quick reply, but that can be like this format eg. 6hrs and 30mins i like with that and between hr and mins. thanks anyway

#113836 09/03/05 07:36 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
this $remove($replace($uptime(mirc,1),mins,m,secs,s), $+ $chr(32) $+ ) does not even make this Uptime: 3h and 20m with or without seconds!?!?!?!?!?

alkahol1k was correct you need to use $uptime(mirc,2) which well not display the seconds, but it wont help using the above line try this one

$replace($uptime(mirc,2),days,d,hrs,h,mins,m,$chr(32),$+($chr(32),and,$chr(32)))

days become d, hrs become h, mins become m, seconds are not displayed

[edit] I just read your reply again, and now you wanted only " and " inserted and the hrs etc left as they are if so...

$replace($uptime(mirc,2),$chr(32),$+($chr(32),and,$chr(32)))

Last edited by DaveC; 09/03/05 07:39 AM.
#113837 09/03/05 07:51 AM
Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
Quote:
alkahol1k, thanks for quick reply, but that can be like this format eg. 6hrs and 30mins i like with that and between hr and mins. thanks anyway


Code:
alias myuptime {
tokenise 32 $uptime(mirc,2) 
return $1 and $2
}
 


Example Usage: //echo $myuptime

Or (replacing the standard units):

Code:
  
alias myuptime {
tokenise 32 $replace($uptime(mirc,2),hrs,h,mins,m)
return $1 and $2
}


Finally, what if there are only minutes (I don;t have mIRC running to test this)?


Code:
 
alias myuptime {
tokenise 32 $replace($uptime(mirc,2),hrs,h,mins,m)
return $1 iff($2, and $2, only )
}
 




Untested - I dont use tokenise a lot, so I hope I got the command right from memory!

Cheers,

DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!
#113838 09/03/05 06:49 PM
Joined: Jan 2004
Posts: 84
A
Adriano Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Jan 2004
Posts: 84
well done DaveC, thanks a lot. thanks for explain very well

#113839 09/03/05 06:56 PM
Joined: Jan 2004
Posts: 84
A
Adriano Offline OP
Babel fish
OP Offline
Babel fish
A
Joined: Jan 2004
Posts: 84
Darwin_Koala, thanks, but have problem with tokenise in 3 code of yours.

* /tokenise: not connected to server (line 180, settings.mrc)

Anyway thanks for effort.

#113840 10/03/05 06:30 AM
Joined: Feb 2004
Posts: 206
D
Fjord artisan
Offline
Fjord artisan
D
Joined: Feb 2004
Posts: 206
Quote:
Darwin_Koala, thanks, but have problem with tokenise in 3 code of yours.

* /tokenise: not connected to server (line 180, settings.mrc)

Anyway thanks for effort.


Your welcome :-)

My major error .. tokenise should be tokenize ! I think you will find that will make a difference. The "Not connected to a server" error may be because the software looks for a "server command" if it can't find a local one to the same job.

In my defence, I did say that I don't use it much!

Cheers,

DK


Darwin_Koala

Junior Brat, In-no-cent(r)(tm) and original source of DK-itis!

Link Copied to Clipboard