mIRC Homepage
Posted By: Adriano Uptime mIRC - 09/03/05 04:24 AM
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.
Posted By: alkahol1k Re: Uptime mIRC - 09/03/05 04:31 AM
fairly simple

//echo $uptime(mirc,1)

returns 10hrs 25mins 3secs

//echo $uptime(mirc,2)

returns 10hrs 25mins
Posted By: Adriano Re: Uptime mIRC - 09/03/05 04:38 AM
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
Posted By: DaveC Re: Uptime mIRC - 09/03/05 07:36 AM
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)))
Posted By: Darwin_Koala Re: Uptime mIRC - 09/03/05 07:51 AM
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
Posted By: Adriano Re: Uptime mIRC - 09/03/05 06:49 PM
well done DaveC, thanks a lot. thanks for explain very well
Posted By: Adriano Re: Uptime mIRC - 09/03/05 06:56 PM
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.
Posted By: Darwin_Koala Re: Uptime mIRC - 10/03/05 06:30 AM
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
© mIRC Discussion Forums