PDA

View Full Version : Add for loop count to variable


Jocose
10-05-2010, 07:56 PM
I want to make a for loop that takes the current loop count and adds it to a string name. So somthing like this:


for i = 1 to multiSubCount do
(
local theBitmap = bitmaptexture filename:"dummyPath"'"+i"'

)

How would I go about doing this? Basically I want the variable to equal bitmaptexture filename:

bitmaptexture filename:"dummyPath1"

bitmaptexture filename:"dummyPath2"

bitmaptexture filename:"dummyPath3"

...and so on depending on the count of the for loop.

PiXeL_MoNKeY
10-05-2010, 08:08 PM
You would need to convert the number to a string to add it to the string needed for the filename.for i = 1 to multiSubCount do
(
local theBitmap = bitmaptexture filename:("dummyPath"+(i as string))
)-Eric

Jocose
10-05-2010, 08:09 PM
Thanks for the reply, that works great :)

CGTalk Moderation
10-05-2010, 08:09 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.