mIRC Home    About    Download    Register    News    Help

Print Thread
#65650 28/12/03 05:55 AM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
what im trying to do is i have a list of server in a file that lists like
irc.server1.net
irc.server2.com
server.server1.net

and so on and what i am trying to do is while through the thing and connect to the servers that part is easy but i am trying to make a protect that makes it so if there is all ready a status window open it does /server <server> and then goes to the next ones and does /server -m <server> any one know how i could go about doing this?
this is what i have all ready:

Code:
alias iswin { if ($window($active) == Status Window) { return $true | set %iswin 1 } }
on *:start: {
  var %a = 1
  while (%a &lt;= $lines(mircdirconnectionlist.txt)) {
    if ($window($active) == $iswin) &amp;&amp; (%iswin == 1) { server $read($mircdirconnectlist.txt,%a) | set %iswin 2 | inc %a 1 
      if (%iswin == 2) { server $read($mircdirconnectlist.txt,%a) | inc %a 1 }
      inc %a 1
    }
    inc %a 1
  }
}


any help would be soo nice yea its kinda late so i have no idea wtf im doing lol ~_~


Need amazing web design for low price: http://www.matrixn3t.net
#65651 28/12/03 08:19 AM
Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
might be easier than you had thought to do this.
you dont really need to check windows as on start your not connected to any servers anyway. just server for the first read then server -m for all the others.
Code:
on *:start: {  
  var %a = 1  
  while (%a &lt;= $lines(mircdirconnectionlist.txt)) { 
    if (%a == 1) { server $read(mircdirconnectionlist.txt,%a) }
    else { server -m $read(mircdirconnectionlist.txt,%a) }
    inc %x
  }
}

but checking the number of lines every loop is kind of slow, even if its a small file. Best to save the number of lines into a variable then use that in the loops condition, or do it the fastest way with:
Code:
on *:start:{
  .fopen serv mircdirconnectionlist.txt
  server $fread(serv)
  while (!$feof) {
    server -m $fread(serv) 
  }
  .fclose serv
}

As you see it justs uses /server the first read and then /server -m for all the others.

#65652 28/12/03 10:23 AM
Joined: Nov 2003
Posts: 228
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Nov 2003
Posts: 228
Just at a glance I can see one problem, you're missing the dollar sign from the 'mircdir' identifier. Also, just as a tip, you don't need to use $mircdir when a file is in the mIRC folder, $lines(connectionlist.txt) will have the same result as $lines($mircdirconnectionlist.txt)

But as mentioned, using the /fopen, /fclose, $fread and $feof will be alot quicker.

#65653 28/12/03 07:10 PM
Joined: Dec 2002
Posts: 397
A
ATMA Offline OP
Fjord artisan
OP Offline
Fjord artisan
A
Joined: Dec 2002
Posts: 397
when i used this script... nothing happend any way why should i use code i dont under stand? i made a simpler vr of that any way but it still doesnt work

Code:
on *:start: {
  var %a = 1
  server $read($mircdirconnectlist.txt,%a)
  inc %a
  while ($read($mircdirconnectlist.txt,%a)) {
    server -m $read($mircdirconnectlist.txt,%a)
    inc %a
  }
}


Need amazing web design for low price: http://www.matrixn3t.net

Link Copied to Clipboard