mIRC Home    About    Download    Register    News    Help

Print Thread
#207814 03/01/09 07:49 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I trying to use dec in a while loop, but i need it to delay the dec in seconds, any way i can do this without the use of a timer?
Code:
alias test
    var %x = 20
    while (%x) {
      echo -a %x
      dec %x
    }
  }
}


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
sparta #207815 03/01/09 08:46 AM
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
You can't. If you want to delay the /echo you can...
a) write the loop to a .txt and /play it
b) put a timer (possibly in milliseconds) in the /echo command where you also /inc (or /dec) the delay.

sparta #207818 03/01/09 01:50 PM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
From the help file under /help /dec
Quote:
The -c switch decreases %var once per second.


Therefore, having your variable initially set at 20, and looping to 0, would take 20 seconds.

Note that this is not an exact timing, and previous tests with this type of increase/decrease using the -c switch have had an average time increase of approximately .25 seconds/second.

sparta #207824 03/01/09 03:36 PM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Create an alias and use a timer. I don;t know why you don;t want to use a timer. Why are you cutting off your arm when you need to use it? That;s like saying, "How can I drive to michigan without using gas or electricity?" Why?

Code:
EVENT {
set %var 20
.timerslow 1 1 /slow

}

alias slow {
if (%var == 0) { unset %var | return }
echo -a %var
dec %var
.timerslow 1 1 slow 
}


I seriously just woke up so I may have missed something but this is the idea ...

DJ_Sol #207825 03/01/09 06:05 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I did use a timer, but i didn't know if it was any other way to solve it.. =)


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Link Copied to Clipboard