|
|
Joined: Dec 2006
Posts: 3
Self-satisified door
|
OP
Self-satisified door
Joined: Dec 2006
Posts: 3 |
I was happily scripting when a friend ask for a "little help". No problem, I said. But, actually, I've a little one. Look this script: alias list {
var %ß 1
while ($readini(%file,$ini(%file,%ß),chan)) {
var %£ 1
while ($gettok($v1,%£,44)) { echo -a $v1 | inc %£ }
inc %ß }
} ... and it's ini's file: [FirstNetwork]
chan=#chanone,#chantwo,#chantree
[SecondNetwork]
chan=#chan1,#chan2,#chan3,#chan4
It should list all chans of all networks. But it's echo only the first chan of each network ):. Does anybody know why? (if u can't understand me 'cuz damn pro english just find nemo, i mean, the error -.-)
|
|
|
|
Joined: Dec 2002
Posts: 43
Ameglian cow
|
Ameglian cow
Joined: Dec 2002
Posts: 43 |
I think your use of $v1 is confusing mIRC. Try this:
list {
var %B 1
var %chans = $readini(%file,$ini(%file,%B),chan)
while (%chans) {
var %L 1
while ($gettok(%chans,%L,44)) {
echo -a $v1
inc %L
}
inc %B
var %chans = $readini(%file,$ini(%file,%B),chan)
}
}
(Browser didn't handle utf8 right, had to change var names)
|
|
|
|
Joined: Sep 2005
Posts: 2,881
Hoopy frood
|
Hoopy frood
Joined: Sep 2005
Posts: 2,881 |
$v1 works fine that way, but you're correct in thinking that his logic is incorrect. After the first loop, $v1 will be $gettok($v1,%£,44) from the first loop. -- OP, try this:
alias list {
var %ß = 1, %£, %v1
while ($readini(%file,$ini(%file,%ß),chan)) {
%£ = 1
%v1 = $v1
while ($gettok(%v1,%£,44)) {
echo -a $v1
inc %£
}
inc %ß
}
}
Btw, out of curiosity, why do you use such undescriptive variable names? It's only going to cause you some confusion if you go and look at a script after some time of not modifying it.
|
|
|
|
|
|