mIRC Home    About    Download    Register    News    Help

Print Thread
#133308 18/10/05 09:26 PM
Joined: Oct 2005
Posts: 4
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Oct 2005
Posts: 4
Code:
 
/draw {
  set %time 0
  while ( $read(Teams1.txt) !== $null ) {
    set %crew $read(Crews1.txt)
    set %test $readn
    set %time %time + 5
    set %time1 %time + 1.5
    set %time2 %time + 3
    set %time3 %time + 4.5
    set %time4 %time + 6
    set %time5 %time + 7.5
    set %time6 %time + 9
    /write -dl %test Crews1.txt
    set %team $read(Teams1.txt)
    set %test $readn
    /write -dl %test Teams1.txt
    .timer 1 %time /msg #woc %team 0,1is for :
    .timer 1 %time1 /msg #woc ...
    .timer 1 %time2 /msg #woc ..
    .timer 1 %time3 /msg #woc .
    .timer 1 %time4 /msg #woc %crew
    .timer 1 %time5 /msg #woc _____________
    .timer 1 %time6 /msg #woc 
    .timer 1 %time6 /msg #woc 
    /write loting1.txt %team voor %crew
  }
} 


In the documents are the teams and crews specified.
But when I'd start the script there will be a strange draw, and when i'd like to make a huge draw like 20 teams and crews, i 've been kicked, with the reason Excess flood :S

Please help me

kind regards

Sagitarius

Last edited by Sagitarius; 18/10/05 09:27 PM.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
two things
(1) you cant actually set a timer to 1.5 seconds it well round down to 1, this is however a not a critical thing
(2) you only add 5 seconds to the timer for each time around the loop, but use 9 seconds of time, this over lap well cause multiple loops messages to appear inbetween each other and also cause the flood off.

I have rewritten the code, u well notice i used 1.5 seconds delay per message except for the last one, the same as yours. These as i said however well end up looking more like delays of 1,3,4,6,7,9,10,10 seconds, with the next loop starting 11.5 seconds later, you may need to change the last inc %time 0 to a inc %time 1.5 or you may still flood off, im not sure, try it.

Code:
draw {
  var %time = 0
  while ($read(Teams1.txt)) {
    var %team $read(Teams1.txt) | write -dl $+ $readn Teams1.txt
    var %crew $read(Crews1.txt) | write -dl $+ $readn Crews1.txt
    write loting1.txt %team voor %crew
    inc %time 1.5 | .timer 1 %time msg #woc %team 0,1is for :
    inc %time 1.5 | .timer 1 %time msg #woc ...
    inc %time 1.5 | .timer 1 %time msg #woc ..
    inc %time 1.5 | .timer 1 %time msg #woc .
    inc %time 1.5 | .timer 1 %time msg #woc %crew
    inc %time 1.5 | .timer 1 %time msg #woc _____________
    inc %time 1.5 | .timer 1 %time msg #woc 
    inc %time 0   | .timer 1 %time msg #woc 
  }
}

Joined: Oct 2005
Posts: 4
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Oct 2005
Posts: 4
First i'd like to thank you for your help, but there are some things i can't place!

Some numbers were draw double, but all the teams and crews have to be draw a single time.

I really hope you can fix this bug..

this is an example of a test-draw. not all the numbers and alphbetical characters have been taken!

2 voor c
4 voor j
4 voor f
5 voor h
8 voor i
9 voor d

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
A Small correction, not een sutre if its important, how ever I dont think it fixes what ever is causing your problem. If it does it does, however if it DOES NOT, then please supply a listing of the files
TEAMS1.TXT and CREWS1.TXT as without this i cant text it, (well i can but id rather have real test data)

Code:
draw {
  var %time = 0
  while ($read(Teams1.txt)) {
    var %team = $read(Teams1.txt) | write -dl $+ $readn Teams1.txt
    var %crew = $read(Crews1.txt) | write -dl $+ $readn Crews1.txt
    write loting1.txt %team voor %crew
    inc %time 1.5 | .timer 1 %time msg #woc %team 0,1is for :
    inc %time 1.5 | .timer 1 %time msg #woc ...
    inc %time 1.5 | .timer 1 %time msg #woc ..
    inc %time 1.5 | .timer 1 %time msg #woc .
    inc %time 1.5 | .timer 1 %time msg #woc %crew
    inc %time 1.5 | .timer 1 %time msg #woc _____________
    inc %time 1.5 | .timer 1 %time msg #woc 
    inc %time 0   | .timer 1 %time msg #woc 
  }
}

Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
You could inc %time 1500 and use the -m timer switch

inc %time 1500 | .timer -m 1 %time msg #woc ...

Last edited by mIRCManiac; 18/10/05 11:11 PM.
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
yeah i know, i thought about that, but then though, man using 1500 and a -m switch might start confusing the issue, and the help says its resource hungry using -m, and there woulr/could be quite a few, and really lastly I also thought, why bother, your at the mercy of the IRC server which may incure lag and your messages come out in bursts of 2 lines 5 lines even 22 lines (lol) at once.

I personally dont like running a bunch of times like this, would only do it for a single anouncment of a set of lines, rather than something im looping through.
I would have written some type of simple spool cache and a despool timer, dump em all in a hidden window, set off a -m timer sending 1 line every 1.5 seconds out untell the window emptied. But i thought that might be over kill for just fixing his script.

---

/me has nothing better to do at work today than write replys here.

Joined: Feb 2005
Posts: 681
M
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
Quote:
and the help says its resource hungry using -m


Actually it says that about the -h switch,
but I hear ya about confusing the issue smile

/me butts out .. sorry grin

Note: The -h switch creates a high-resolution multimedia timer. This
type of timer should only be used in critical timer situations since it
uses system resources heavily.

Last edited by mIRCManiac; 18/10/05 11:41 PM.
Joined: Oct 2005
Posts: 4
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Oct 2005
Posts: 4
the changes doesn't work.

teams1.txt has the folowing text:

1
2
3
4
5
6
7
8
9
10

Crews1.txt had the folowing text:

a
b
c
d
e
f
g
h
i
j


But it still doesn't work frown

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
The problem is with the data, I had assumed Team1.txt held team names (even after you showed me the output frown ),
becuase it has simple numbers, $read(filename) identifier well look at the first line in the file and consider it a special case, ie: it is the number of lines in the file. This confuses the randomality of it all, and can also cause it to abort before doing the 10 loops (as per your data)

the fix, I simply used $read(filename,t) which says treat line one as plain text, i placed this on all $read to be sure.

Code:
alias draw {
  var %time = 0
  while ($read(Teams1.txt,t)) {
    var %team = $read(Teams1.txt,t) | write -dl $+ $readn Teams1.txt
    var %crew = $read(Crews1.txt,t) | write -dl $+ $readn Crews1.txt
    write loting1.txt %team voor %crew
    inc %time 1.5 | .timer 1 %time msg #woc %team 0,1is for :
    inc %time 1.5 | .timer 1 %time msg #woc ...
    inc %time 1.5 | .timer 1 %time msg #woc ..
    inc %time 1.5 | .timer 1 %time msg #woc .
    inc %time 1.5 | .timer 1 %time msg #woc %crew
    inc %time 1.5 | .timer 1 %time msg #woc _____________
    inc %time 1.5 | .timer 1 %time msg #woc 
    inc %time 0   | .timer 1 %time msg #woc 
  }
}

Joined: Oct 2005
Posts: 4
S
Self-satisified door
OP Offline
Self-satisified door
S
Joined: Oct 2005
Posts: 4
It works!! many/much ?? (my english isn't very well.)

Many/much thanks for helping me!!

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Many laugh


Invision Support
#Invision on irc.irchighway.net
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Drat you i wanted Much thanks!


Link Copied to Clipboard