mIRC Home    About    Download    Register    News    Help

Print Thread
#269569 03/11/21 06:55 AM
Joined: Mar 2021
Posts: 25
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Mar 2021
Posts: 25
alias xtime {
var %i = 1
while (%i <= 10) {
echo 2 %i $time
inc %i
}

03:55:21-- 03:56:21 like that

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It's hard to understand what you're asking.
You say you want to show a clock like the computer, then you have a script which loops so that it shows the same time repeatedly. Your text shows 2 times 60 seconds apart, but your loop only repeats 10 times.

If this isn't what you're wanting, you'll need to try explaining again:

/timerclock -o 60 1 echo 2 $time

That echoes the time at 1 second interval for 60 seconds. If you change the 60 0 it repeats forever until you stop the timer. If you change the 1 to something else, that's the number of seconds between showing the time.

Joined: Mar 2021
Posts: 25
D
Ameglian cow
OP Offline
Ameglian cow
D
Joined: Mar 2021
Posts: 25
thnx , its work !!! but in the same line how i do it?

Joined: Dec 2002
Posts: 252
T
Fjord artisan
Offline
Fjord artisan
T
Joined: Dec 2002
Posts: 252
There's a number of ways to do what I think you want.

Option 1:
use /titlebar to shove the time you want into a titlebar of a window, other than that you would need some form of custom @window.

Option 2: Custom @window
Using a combination of /aline and /rline you could first display the time, then periodically replace the line with the updated time.

Example:
Code
alias tclock {
  if (!$window(@TClock) && !$1) { window -dBfk0 +t @TClock -1 -1 150 150 | aline @TClock $time }
  if ($window(@TClock)) {
    rline @TClock 1 $time
    titlebar @TClock $time
    .timerTClock -om 1 100 TClock Update
  }
}


Option 3: Custom Picture @window
Using picture windows grants you the ability to "draw" whatever you wish with the available /draw* commands, and you can get as creative as you wish to output your clock.

Example:
Code
alias pclock {
  if (!$window(@Clock) && !$1) { window -dBpfk0 +t @Clock -1 -1 150 150 }
  if ($window(@Clock)) {
    var %x = 0 , %y = 15 , %hw = $window(@Clock).dw / 2 , %hh = $window(@Clock).dh / 2 , %r = %hw - 10
    drawrect -nf @Clock 1 1 0 0 $window(@Clock).dw $window(@Clock).dh
    while (%x <= %y) {
      var %a = $calc(%x * $pi * 2 / 60) , %dx = $calc(%r * $cos(%a)) , %dy = $calc(%r * $sin(%a)) , %c = $iif($calc(%x % 5),14 2,4 4)
      drawdot -n @Clock %c $calc(%dx + %hw) $calc(%dy * -1 + %hh)
      drawdot -n @Clock %c $calc(%dx + %hw) $calc(%dy + %hh)
      drawdot -n @Clock %c $calc(%dx * -1 + %hw) $calc(%dy + %hh)
      drawdot -n @Clock %c $calc(%dx * -1 + %hw) $calc(%dy * -1 + %hh)
      inc %x
    }
    tokenize 58 $asctime(HH:nn:ss)
    var %ha = $calc(($1 - 3 + $2 / 60) * $pi * 2 / 12) , %ma = $calc(($2 - 15 + $3 / 60) * $pi * 2 / 60) , %sa = $calc(($3 - 15) * $pi * 2 / 60)
    drawline -n @Clock 14 2 $calc($cos(%ha) * %r * 0.6 + %hw) $calc($sin(%ha) * %r * 0.6 + %hw) %hw %hw $calc($cos(%ma) * %r * 0.9 + %hw) $calc($sin(%ma) * %r * 0.9 + %hw)
    drawline -n @Clock 4 2 $calc($cos(%sa) * %r + %hw) $calc($sin(%sa) * %r + %hw) %hw %hw
    drawtext -n @Clock 14 $qt($window(@Clock).font) $window(@Clock).fontsize $calc(%hw - $width($asctime(hh:nn:ss TT),$window(@Clock).font,$window(@Clock).fontsize) / 2) %hh $asctime(hh:nn:ss TT)
    drawdot @Clock
    titlebar @Clock $asctime(HH:nn:ss)
    .timerClock -om 1 100 PClock Update
  }
}

Joined: Jan 2012
Posts: 299
Fjord artisan
Offline
Fjord artisan
Joined: Jan 2012
Posts: 299
Your question and the code example provided looks very cryptic, so it's hard to understand out how to help you ... ✨ This looks like a new puzzle for players "Game in Squid" (Squid Game) smirk

The only thing that is clear from the example is that cycle (while) will display exactly 10 times an echo-message with an identifier "$time" which will show the currently time on your computer while the cycle itself is running.

Could you please provide more information on what you specifically want your script to do and what output should be displayed in the mIRC window?



🌐 http://forum.epicnet.ru 📜 irc.epicnet.ru 6667 #Code | mIRC scripts, help, discuss, examples
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Still not clear what you're wanting. If you're wanting it to show the fixed time that the timer started next to the current time, that's the difference between the timer using an identifier that's evaluated at the time the timer is created, and an identifier that isn't evaluated until the timer is executed.

alias xtime {
/timerclock -o 60 1 echo 2 $time -- $!time
}

Inside an alias, $identifier is evaluated as the script is run, but when you use the form $!identifier, the "!" delays the evaluation - in this case it's delayed until each timer executes

If this isn't what you want, please be more clear


Link Copied to Clipboard