Computer Science Canada

help with picture filename (combining words) (nevermind)

Author:  who cares? [ Wed Oct 13, 2004 5:12 pm ]
Post subject:  help with picture filename (combining words) (nevermind)

ok, i got a problem...

i have 10 pictures in a folder... each one named planet1, planet2, planet3, planet4, etc... up to 10

and i have a loop with a counter variable..

what i want to do is to be able to display each image every time the loop runs, so, first i display planet1, then planet2, then planet3, etc.

this is what i have made:

code:

loop
counter := counter + 1
counter_s := intstr (counter)
var planetPic : int := Pic.FileNew ("planet" + counter_s + ".jpg")
Pic.Draw (planetPic, 270, 200, picCopy)
exit when counter = 10
end loop


i get an error, cause it can't read the planet file name... can anyone help me please?

counter has alredy been initialized outside the loop for value 0 and counter_s, as you can see is a string...

thanks for the help! Smile

Author:  wtd [ Wed Oct 13, 2004 5:16 pm ]
Post subject: 

Since you know the range of numbers you're looping over, you'd be better off writing this as a for loop.

code:
for counter : 1 .. 10

Author:  who cares? [ Wed Oct 13, 2004 5:17 pm ]
Post subject: 

wtd wrote:
Since you know the range of numbers you're looping over, you'd be better off writing this as a for loop.

code:
for counter : 1 .. 10


yeah, sure... i could do that... thanks

but i still have the problem with the file name... and i dont know why...

cause i did it last year with another file, i concatinated (is that how you spell it?) 2 numbers with an underscore and it worked...

anyone know what's wrong?

Author:  who cares? [ Wed Oct 13, 2004 5:20 pm ]
Post subject: 

NEVERMIND!

i'm a moron....

i forgot to add the subfolder to the path.. Embarassed

delete this stupid thread please... Embarassed

Author:  fmy [ Wed Oct 13, 2004 6:41 pm ]
Post subject: 

hahahahaha, i was just about to mention that.


: