mIRC Homepage
Posted By: TheWarlock while error - 06/12/07 05:17 AM
alias canales {
var %i = 1
while (%i > 10) {
set %con $readini(mirc.ini chanfolder n $+ %i }
.echo -a %con
inc %i
}

}
}

* /echo: insufficient parameters (line 5, script6.ini)

any help please thnx
Posted By: DJ_Sol Re: while error - 06/12/07 05:39 AM
$readini(mirc.ini chanfolder n $+ %i }

This is close, but n ot quite. Read the mirc help file on $readini and make sure you close any open brackets. That includes { }, [ ] & ( )

Also ... I dont know, maybe Im missing something, but you start with %i = 1.

then you say...

while (%i > 10) {
(while 1 is greater than 10)
1 isn't greater than 10 so I don't expect it would do much. If it did by chance get to 10, look out because you will get a recursive while loop.

Maybe you meant ...

while (%i <= 10) ?
Posted By: TheWarlock Re: while error - 06/12/07 05:54 AM
can you helpme with an example
thnx
Posted By: TropNul Re: while error - 06/12/07 07:00 AM
Test those different functions.
Code:
Alias Twhile.1 {
  Var %i = 1
  Echo -ast -> Variable i starts with value 1
  Echo -ast -> while i is smaller or equal to 10 ...
  While (%i <= 10) {
    Echo -ast -> in the while => %i
    Echo -ast -> incrementing i by 1 ...
    Inc %i
  }
}


Code:
Alias Twhile.2 {
  Var %i = 1
  Echo -ast -> Variable  i starts with value 1
  Echo -ast -> while i is greater than 10 ...
  While (%i > 10) {
    Echo -ast -> in the while => %i
    Echo -ast -> incrementing i by 1 ...
    Inc %i
  }
}


Code:
Alias Twhile.3 {
  Var %i = 1
  Echo -ast -> Variable  i starts with value 1
  Echo -ast -> while i is greater than 0 ...
  While (%i > 0) {
    Echo -ast -> in the while => %i
    Echo -ast -> incrementing i by 1 ...
    Inc %i
  }
}


Code:
Alias Twhile.4 {
  Var %i = 1
  Echo -ast -> Variable  i starts with value 1
  Echo -ast -> while i is smaller than 1 ...
  While (%i < 1) {
    Echo -ast -> in the while => %i
    Echo -ast -> incrementing i by 1 ...
    Inc %i
  }
}


Code:
Alias Twhile.5 {
  Var %i = 10
  Echo -ast -> Variable  i starts with value 10
  Echo -ast -> while i is greater than 10 ...
  While (%i > 10) {
    Echo -ast -> in the while => %i
    Echo -ast -> decreasing i by 1 ...
    Dec %i
  }
}


Code:
Alias Twhile.6 {
  Var %i = 10
  Echo -ast -> Variable  i starts with value 10
  Echo -ast -> while i is greater than 0 ...
  While (%i > 0) {
    Echo -ast -> in the while => %i
    Echo -ast -> decreasing i by 1 ...
    Dec %i
  }
}


etc... Now you must be able to make more example tests. smile

Note: If ever your mIRC freezes/crashes, it's only because in one of those examples, there is a bug which makes an infinite loop. That's also an example. And that will permit you to better understand why a loop tends to infinity when conditions are badly written.

Cordialement
Posted By: XTZGZoReX Re: while error - 06/12/07 08:19 AM
I took a look at your while loop, and I found a few things you might want to fix up.

This is your current script:

Code:
alias canales {
var %i = 1
while (%i > 10) {
set %con $readini(mirc.ini chanfolder n $+ %i }
.echo -a %con
inc %i
}

}
}


Here's one that should work (I didn't have possibility to check my mIRC help file for the $readini syntax):

Code:
alias canales {
  var %i = 1
  while (%i <= 10) {
    set %con $readini(mirc.ini,chanfolder,n $+ %i)
    echo -a %con
    inc %i
  }
}


Though, I'm 99% sure that the above works.
Posted By: TheWarlock Re: while error - 06/12/07 04:01 PM
thnx dude ,work just fine
Posted By: TheWarlock Re: while error - 06/12/07 04:04 PM
thank you so much for the effort ,preciate
Posted By: r34dm4n Re: while error - 11/12/07 08:55 AM
Originally Posted By: TheWarlock
alias canales {
var %i = 1
while (%i > 10) {
set %con $readini(mirc.ini chanfolder n $+ %i }
.echo -a %con
inc %i
}

}
}

* /echo: insufficient parameters (line 5, script6.ini)

any help please thnx


lol there is a missin parenthesis dude...gotta read carefully when making scripts...

$readini(mirc.ini chanfolder n $+ %i } <<-- there is no closin one

also... $readini(filename, [np], section, item) <<--thats the syntax...forgot the commas too?
© mIRC Discussion Forums