Erm, yeah, I think you are mis-understanding things.
First:
For obj =1 to 3
Next (or Next obj) - I've never heard of using Next obj+1???
I personally never use Next obj, as you should structure your programs so that you know what For is matched with what Next, but that is just me. i.e.
For a=1 to 3
For b=1 to 3
`Blah
Next b
Next a
seems redundant to me and I use:
For a=1 to 3
For b=1 to 3
`Blah
Next
Next
The For...Next loop automatically increases by 1 each time through the loop, unless you use STEP to change this as in:
For obj = 1 to 10 step 2
Next
which would count up in twos, looping 5 times in total.
Second:
You need to use the value of obj when calling the progress bar function, other wise it won't increase.
Try:
Progress("Loading Objects:",obj*1/3.0)
Then when obj is 1, Progress is called with 1/3, when obj is 2, 2/3 and finally on the last loop, obj=3 and Progress is called with 1 (i.e. full)
Third:
This is where you are getting the error, and shows a little lack of understanding which hopefully I can help yo with. You are looping three times, and each time you are trying to load three objects:
Load object "Alpha.x",1
Load object "Beta.x",2
Load object "Gamma.x",3
Thing is, after the first loop, they all exist already... Object 1 is alpha.x, object 2 is beta.x and object 3 is gamma.x. So when the loop runs again (obj=2) it trys to recreate object 1 and you get an error.
You could either try without a loop:
Progress("Loading Objects:",1/3.0)
Load object "Alpha.x",1
Progress("Loading Objects:",2/3.0)
Load object "Beta.x",2
Progress("Loading Objects:",3/3.0)
Load object "Gamma.x",3
end
`t$=Text to display, prog#=0.0 - 1.0
FUNCTION Progress(t$,prog#)
prog_x=(screen width()/2)-128
prog_y=(screen height()/2)
ink rgb(255,255,255),0
center text prog_x+128,prog_y-16,t$
ink rgb(16,16,16),0
box prog_x-1,prog_y-1,prog_x+257,prog_y+17
ink rgb(255,16,16),0
box prog_x-1,prog_y-1,prog_x+1+(prog#*256),prog_y+17
sync
ENDFUNCTION
Or with a loop and use an array:
Dim ObjectNames$(3)
ObjectNames$(1)="Alpha.x"
ObjectNames$(2)="Beta.x"
ObjectNames$(3)="Gamma.x"
For obj=1 to 3
Progress("Loading Objects:",obj*1/3.0)
Load object ObjectName$(obj),1
Next obj
`t$=Text to display, prog#=0.0 - 1.0
FUNCTION Progress(t$,prog#)
prog_x=(screen width()/2)-128
prog_y=(screen height()/2)
ink rgb(255,255,255),0
center text prog_x+128,prog_y-16,t$
ink rgb(16,16,16),0
box prog_x-1,prog_y-1,prog_x+257,prog_y+17
ink rgb(255,16,16),0
box prog_x-1,prog_y-1,prog_x+1+(prog#*256),prog_y+17
sync
ENDFUNCTION
Hope this all helps!