mIRC Home    About    Download    Register    News    Help

Print Thread
#77903 04/04/04 05:12 PM
Joined: Mar 2004
Posts: 111
Z
Zeusbwr Offline OP
Vogon poet
OP Offline
Vogon poet
Z
Joined: Mar 2004
Posts: 111
Ok, im looking to slow down a while loop, OR have it msg slower. What im looking for it to do is basicly msg a person 60times slowly. This is in DCC Chat so server rules do not apply, but the thing is i can do it fast, but its slightly laggy, and if i do it with timers it uses 60 timers... which isnt good iv heard (lots of timers = bad from what iv been told, iv never used that many timers lol).

Now im not looking for someone to write this, im just wondering, is there any other way? cuz i want it to be slower so it doesent lag the "reciever" of the msg, and the "sender". and timers i assume lag the "sender"... Any ideas?

Joined: Jun 2003
Posts: 994
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Jun 2003
Posts: 994
/help /play


I refuse to engage in a battle of wits with an unarmed person. wink
Joined: Dec 2002
Posts: 1,541
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Dec 2002
Posts: 1,541
Why would you need that many timers? Use a timer and an alias or as CTRLALTDEL suggested (which would prolly be better)


Those who fail history are doomed to repeat it
Joined: Mar 2004
Posts: 111
Z
Zeusbwr Offline OP
Vogon poet
OP Offline
Vogon poet
Z
Joined: Mar 2004
Posts: 111
well the reason i would need that many timers is because a the loop would need to msg a person 60 times at lets say 5 seconds apart, as of yet i do not know a way to "time" things without a timer.

Now, just from the tiny bit iv read on /play, it seems to only display a text file. i COULD use this but the only way i see of making it do what i need is befor i use the /play command i use a loop to write the lines i need into the text file, in which case the loop is still doing a command 60 times very fast which would lag slightly, now if i could time the /write command to write each line every 5 sec or whatever then id be set, BUT then i may as well not /write, instead /msg.

But, the whole display factor is prob done best by using a loop to write 60 lines to a text file, then having /play message each line to a user.
Could there possibly be a better way? slowing down a loop would be perfect, i just dont know of any way.

Joined: Dec 2003
Posts: 261
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2003
Posts: 261
Hi, there. You don't need a loop... use:
/timer 60 5 /YourCommandOrAlias

Hope that helped.


velicha dusha moja Gospoda
Joined: Dec 2002
Posts: 102
M
Vogon poet
Offline
Vogon poet
M
Joined: Dec 2002
Posts: 102
The way the thread is processed there's no way way to internally use a loop and have it run slower. Writing to a file and tweaking the delay on the /play command is likely to be the best bet in this situation. (Even if you only use a delay of 100 or 200 miliseconds.) If you really want to make a single sequence of events run in a loop like fashion you can use a form of recursion:

Code:
alias SlowLoop {
  if ($1 isnum) {
    if ($1 <= 10) {
      echo -s Loop number: $1 Parameters: $2-
      .timer 1 5 SlowLoop $calc($1 + 1) $2-
    }
    else {
      echo -s Slow Loop finished: $2- 
  } }
  else {
    echo -s Beginning Slow Loop, parameters: $1-
    .timer 1 5 SlowLoop 1 $1-
} }


Of course then you run into other issues controling it. You can't have the first parameter as a number, passing dynamic information is a pain, things update as it's run so you have to take those into consideration (nick changes,) etc. Also you can make the timers dynamically change delays or skip numbers (like: if ($1 == 7) tokenize 32 8 $2- ) or just not get called at all to emulate /break /continue or /halt

I've found cases where this is one way to approach such a problem and have had a lot of success with it though.


-
MIMP

Link Copied to Clipboard