little help plz(Reorder ini section) - 11/02/03 04:21 AM
hey, am workin on something, and there is an option to delete an item from an ini file, items are set in the ini file like this:
1=this
2=that
3=these
4=those
5=etc
now, i am trying to delete one of those items, then reorder the remaining items so they are still in order of 1,2,3,4 etc...tried a whole bunch of stuff, still dont work, always something wrong, lol this is what i am up to now :S
$ncenc and /ncenc are simple alias to write and read from the ini file "ncenc.isu", ir $1 == -r it will remini $2-
thanks for any help in advance, and that code was smaller, and i tried MANY different ways, but i either end up with two words the same, or skiping a number, 1 2 4 5 6...
1=this
2=that
3=these
4=those
5=etc
now, i am trying to delete one of those items, then reorder the remaining items so they are still in order of 1,2,3,4 etc...tried a whole bunch of stuff, still dont work, always something wrong, lol this is what i am up to now :S
Code:
var %a = 1 while ( $ncenc(keys,%a) ) { if ($ifmatch == $2-) break inc %a } var -s %b = 1, %d = $ini(ncenc.isu,keys,0) while ( $ini(ncenc.isu,keys,%b) ) { var %c = $ifmatch if (%c == %a) { ncenc keys %b $ncenc(keys,$calc(%c + 1)) inc %b continue } ncenc keys %b $ncenc(keys,%c) inc %b } while ( $ini(ncenc.isu,keys,%d) ) { ncenc -r keys $ifmatch inc %d }
$ncenc and /ncenc are simple alias to write and read from the ini file "ncenc.isu", ir $1 == -r it will remini $2-
thanks for any help in advance, and that code was smaller, and i tried MANY different ways, but i either end up with two words the same, or skiping a number, 1 2 4 5 6...