mIRC Home    About    Download    Register    News    Help

Print Thread
#81265 29/04/04 09:14 PM
Joined: Oct 2003
Posts: 306
J
Fjord artisan
OP Offline
Fjord artisan
J
Joined: Oct 2003
Posts: 306
alias loadserver {
var %in = 0
while %in < 255 {
set %datos $read($mircdirservers.dat,%in)
echo -a %in
inc %in
}

i made this for loading entire stuff of servers.dat ,but isnt work


mess with the best
#81266 29/04/04 09:31 PM
Joined: Apr 2004
Posts: 9
S
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
S
Joined: Apr 2004
Posts: 9
huh ?

anyways you might whanna start with %in at 1 ... (first line)

#81267 29/04/04 09:37 PM
Joined: Aug 2003
Posts: 325
W
Fjord artisan
Offline
Fjord artisan
W
Joined: Aug 2003
Posts: 325
What is the purpose of setting %datos to whatever you read in when you don't make use of the information after that?

That might help some.

#81268 30/04/04 01:14 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
you're missing a }


New username: hixxy
#81269 30/04/04 01:34 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

this will show you each line of servers.dat:
Code:
 
alias loadserver {
  var %in = 1
  var %file = $+(",$mircdir,servers.dat,")
  var %lines = $lines(%file)
  while %in &lt;= %lines { echo -a %in -&gt; $read(%file,%in) | inc %in }
} 


Now I know you don't want it shown, but I posted this code anyways, so that you can see which mistakes you made (forgot a brace, %in = 0, set %datos where you don't use %datos,...)

Note1: Use $lines instead of setting a constant like 255, cuz each time your file changes, you'll have to manually change your code as well.

Note2: You can also set variables in a single line like var %x = .., %y = .. but here I chose for a new line each time, for better overview.

Note3: If the order of loading for these servers doesn't matter, then you could also do the following:
Code:

var %in = $lines(%file)
while %in { .... | dec %in }
}  


However, you state in your first post that you want to 'load' the stuff from your servers.dat...but what do you mean by that? You do know that you were overwriting %datos with each iteration?

A tip for the future (I've seen numerous posts by you, where you simply paste some code without any explanation at all):

Tell us what you are trying to achieve...what it is for...maybe then people will be compelled faster to help you.

Now, if you want to have each server from that file to be stored in variables, that is possible, though I would simply recommend using hash tables.

/help hash tables

Greetz


Gone.

Link Copied to Clipboard