Not a foldit bug. The problem is in your script. You have the equivalent of this code:
for i=1,get_band_count() do
band_delete(i)
end
Explaining: you deleted band #1, then told it to delete band #2, and so forth. But band #2 became band #1 when you deleted it, so you really skipped the original band #2. The range you are looping has changed the moment you delete the first band. This is a classic problem in programming.
There are several ways around this:
1) Just do band_delete() with no arguments. This will delete all bands, so you don't need a loop.
2) Use this code, which deletes band #1 until there are no more bands:
while get_band_count() > 0
band_delete(1)
end
3) Use this code, which starts with the last band and loops toward the beginning. This solves the issue that the count changes as the bands are deleted, since the band you are deleting will always be the last one:
for i=get_band_count(),1,-1 do
band_delete(i)
end
I closed this. If you disagree for any reason, feel free to re-open it.
Not a foldit bug. The problem is in your script. You have the equivalent of this code:
for i=1,get_band_count() do
band_delete(i)
end
Explaining: you deleted band #1, then told it to delete band #2, and so forth. But band #2 became band #1 when you deleted it, so you really skipped the original band #2. The range you are looping has changed the moment you delete the first band. This is a classic problem in programming.
There are several ways around this:
1) Just do band_delete() with no arguments. This will delete all bands, so you don't need a loop.
2) Use this code, which deletes band #1 until there are no more bands:
while get_band_count() > 0
band_delete(1)
end
3) Use this code, which starts with the last band and loops toward the beginning. This solves the issue that the count changes as the bands are deleted, since the band you are deleting will always be the last one:
for i=get_band_count(),1,-1 do
band_delete(i)
end
I closed this. If you disagree for any reason, feel free to re-open it.
Not a foldit bug. The problem is in your script. You have the equivalent of this code:
for i=1,get_band_count() do
band_delete(i)
end
Explaining: you deleted band #1, then told it to delete band #2, and so forth. But band #2 became band #1 when you deleted it, so you really skipped the original band #2. The range you are looping has changed the moment you delete the first band. This is a classic problem in programming.
There are several ways around this:
1) Just do band_delete() with no arguments. This will delete all bands, so you don't need a loop.
2) Use this code, which deletes band #1 until there are no more bands:
while get_band_count() > 0
band_delete(1)
end
3) Use this code, which starts with the last band and loops toward the beginning. This solves the issue that the count changes as the bands are deleted, since the band you are deleting will always be the last one:
for i=get_band_count(),1,-1 do
band_delete(i)
end
I closed this. If you disagree for any reason, feel free to re-open it.