mIRC Home    About    Download    Register    News    Help

Print Thread
while error #191264 06/12/07 05:17 AM
Joined: Nov 2007
Posts: 117
T
TheWarlock Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
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

Re: while error [Re: TheWarlock] #191266 06/12/07 05:39 AM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
$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) ?

Re: while error [Re: DJ_Sol] #191267 06/12/07 05:54 AM
Joined: Nov 2007
Posts: 117
T
TheWarlock Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
can you helpme with an example
thnx

Re: while error [Re: TheWarlock] #191270 06/12/07 07:00 AM
Joined: May 2007
Posts: 89
T
TropNul Offline
Babel fish
Offline
Babel fish
T
Joined: May 2007
Posts: 89
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


tropnul
Re: while error [Re: TheWarlock] #191273 06/12/07 08:19 AM
Joined: Sep 2007
Posts: 65
X
XTZGZoReX Offline
Babel fish
Offline
Babel fish
X
Joined: Sep 2007
Posts: 65
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.


GamerzWoW
The Official GamerzPlanet WoW Server
Re: while error [Re: XTZGZoReX] #191321 06/12/07 04:01 PM
Joined: Nov 2007
Posts: 117
T
TheWarlock Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
thnx dude ,work just fine

Re: while error [Re: TropNul] #191322 06/12/07 04:04 PM
Joined: Nov 2007
Posts: 117
T
TheWarlock Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2007
Posts: 117
thank you so much for the effort ,preciate

Re: while error [Re: TheWarlock] #191548 11/12/07 08:55 AM
Joined: Dec 2007
Posts: 16
R
r34dm4n Offline
Pikka bird
Offline
Pikka bird
R
Joined: Dec 2007
Posts: 16
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?