mIRC Homepage

help on this

Posted By: jacksparrow2

help on this - 29/04/04 09:14 PM

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
Posted By: slartibartfast

Re: help on this - 29/04/04 09:31 PM

huh ?

anyways you might whanna start with %in at 1 ... (first line)
Posted By: Wolfie

Re: help on this - 29/04/04 09:37 PM

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.
Posted By: tidy_trax

Re: help on this - 30/04/04 01:14 PM

you're missing a }
Posted By: FiberOPtics

Re: help on this - 30/04/04 01:34 PM


this will show you each line of servers.dat:
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:

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

© 2020 mIRC Discussion Forums