mIRC Homepage
Posted By: JuanAm show running clock per channel - 16/11/14 11:42 AM
I wish to display a clock on the channel, which is running for 1 minute, showing hour, minutes and seconds, and then stop.

I made an alias, but not how to take the result identifier $clock.

Code:
If ($1 == !clock) { msg # This is my clock: $clock( ) }

alias clock {
  var %n = 1
  while (%n >= ???) {
    .timer 1 $calc(1* %n)  var %clock = $asctime(HH:nn:ss)
    return %clock
  }
  inc %n
}
 


I know this code is wrong, but it was what I tried to do.

Posted By: Nillen Re: show running clock per channel - 16/11/14 11:59 AM
What do you mean by running for 1 minute? Do you want it to post 60 messages, each updating for each second or do you just want to return the clock right now? Your while loop is wrong, if it didn't have the return line your mIRC application would be stuck in an endless loop and would freeze until you end the process, and I can't really see what it is you're trying to accomplish with it, start ??? number of timers, each updating per one second? The $calc is unneccessary as (1 * x) = x

If you want to run 60 messages to the channel (which I don't recommend) you can use this code
Code:
on *:text:!clock:#: { clock # }
alias clock { if(!$timer(clock)) .timerclock 60 1 msg $1 $!asctime(HH:nn:ss) }
Posted By: JuanAm Re: show running clock per channel - 16/11/14 12:16 PM
Quote:
If you want to run 60 messages to the channel (which I don't recommend) you can use this code


I do not want to send 60 messages to the channel.
I just want to send one, but the clock run showing the hour, minutes and the actual seconds, for 1 minute.

Conclusion: show the clock in operation.

Perdon, for my bad english, I use the google traductor.

This is my code:
Code:
if ($1 == %prefij $+ h) {
    var %date = $asctime(dddd dd mmmm)
    var %date = $replace(%date,Monday,Lunes,Tuesday,Martes,Wednesday,Miércoles,Thursday,Jueves,Friday,Viernes,Saturday,Sábado,Sunday,Domingo)
    var %date = $replace(%date,January,Enero,February,Febrero,March,Marzo,April,Abril,May,Mayo,June,Junio,July,Julio,August,Agosto,September,Setiembre,October,Octubre,November,Noviembre,December,Diciembre )
    msg # 1Son las 12 $asctime(HH) $+ hrs $asctime(nn) $+ mins 1del 12 $gettok(%date,1,32) 1 $gettok(%date,2,32) de $gettok(%date,3,32) $+.  
    msg # 1Horario de  12 URUGUAY 1(GMT-02:00) HERE I PUT THE CLOCK IN OPERATION FOR 1 MINUTE  
Posted By: JuanAm Re: show running clock per channel - 16/11/14 03:30 PM
I want a clock running second per second.
As seen in this link:
http://24timezones.com/
By typing the command "!Time"
If ($1 == !time) { The time is ....HERE CLOCK RUNNING }

After 1 minute it stops.

Posted By: Nillen Re: show running clock per channel - 16/11/14 04:46 PM
You can't update a message once it's posted. How do you expect it to run for 1 minute?
Posted By: JuanAm Re: show running clock per channel - 16/11/14 07:10 PM
Quote:
You can't update a message once it's posted.


Sorry Nillen, to do update the post, is that very little English and did not give me to understand.

Quote:
How do you expect it to run for 1 minute?


I guess through a timer.
You could make a custom identifier with an alias and returns a value, that will be updated by means of a loop (while).
Posted By: Nillen Re: show running clock per channel - 16/11/14 07:14 PM
What you're asking for is impossible. You can't do it. There's no way through irc text messages to change your message from Time: 14:05:44 to Time: 14:05:45 without sending a new message.
Posted By: JuanAm Re: show running clock per channel - 16/11/14 07:47 PM
Originally Posted By: Nillen
What you're asking for is impossible. You can't do it. There's no way through irc text messages to change your message from Time: 14:05:44 to Time: 14:05:45 without sending a new message.


In other languages is achieved, I did many years ago in BASIC.

I thought that MSL could be achieved, but I see that is not so.

I appreciate the effort and time spent.
© mIRC Discussion Forums