
-----------------------------------
Zeeshan
Mon Jan 01, 2007 3:25 pm

Arrays help or someother way
-----------------------------------
I wanted to use an array to use a name of a file iam importing. But i cant figure it out. I want the file name 2 be a variable or something so i can add 1 to it in a loop it makes a movie that way. Can anyone tell me how to use an array for this or make it a variable

var pic : int
var name: int := 1

for t :1..30
name := Pic.FileNew ("1")%--------- i want this to be a variable (name) so i could do this [name:=name+1]
Pic.Draw (pic, 200, 200, picCopy)
delay (500)
pic := Pic.FileNew ("20.bmp")
Pic.Draw (yoshi, 200, 200, picCopy)
end for[/code]

-----------------------------------
Clayton
Mon Jan 01, 2007 3:35 pm


-----------------------------------
look at the string manipulation tutorial in the Turing Walkthrough for how to do this. Specifially look for the functions intstr() and strint() to aid you.

-----------------------------------
Zeeshan
Mon Jan 01, 2007 3:48 pm


-----------------------------------
i do know how to use a function and strings but can u use function and strings to save a file name as a variable i still cant figure it out. i need more help. plzzz

-----------------------------------
Zeeshan
Mon Jan 01, 2007 4:18 pm


-----------------------------------
like no1 noes how to do this 
come onnnnnnnn 
u guys are smart 
sum1 HELP!!! plzzzzzz
 :(

-----------------------------------
CodeMonkey2000
Mon Jan 01, 2007 4:36 pm


-----------------------------------
I think you are looking for something like:
var p : string
var pic : array 1 .. 5 of int
for x : 1 .. 5
    p := "Run" + intstr (x) + ".bmp"
    put "Pic(", x, ")=", p
    pic (x) := Pic.FileNew (p)
end for


-----------------------------------
Hackmaster
Mon Jan 01, 2007 8:37 pm


-----------------------------------
arrays are declared like this:



var foo: array 1..30 of int



you can replace int with any type of variable.

ok? easy stuff.

-----------------------------------
Zeeshan
Tue Jan 02, 2007 10:26 am


-----------------------------------
Hey spearmonkey2000 could you maybe explain what you did there i think that what i want as well buh i don understand it. 

i have 255 bmp files i want 2 load into turing but dont want to waste my time doing each one at a time so i thought i could do it in a loop or sumthing. Thats wht i want i noe i wasnt clear b4. So does anyone know how to do that. if u do kindly help.

thanks

-----------------------------------
Prince Pwn
Tue Jan 02, 2007 12:51 pm


-----------------------------------
This is what he did:

var p : string % Variable used to store file name
var pic : array 1 .. 5 of int % Five being the number of pictures. (each picture stored in the array)
for x : 1 .. 5
    p := "Run" + intstr (x) + ".bmp" % sets 'p' to the picture file "Run1.bmp" through "Run5.bmp"
    put "Pic(", x, ")=", p
    pic (x) := Pic.FileNew (p) % puts the picture in an array
end for 


You could also scan the directory for .bmp files but that is a bit for confusing, this way should work fine.

-----------------------------------
Zeeshan
Tue Jan 02, 2007 12:58 pm


-----------------------------------
But that doesnt display my pictures it just display text on the output screen. how can i display pictures like that. i have my pictures name 1,2,3...255. could anyone change that code so it open pictures by those names. 1 through 255

thanks again

-----------------------------------
Clayton
Tue Jan 02, 2007 1:04 pm


-----------------------------------
ok, so you have your array of pictures now right? That's all you need.


Pic.Draw (x, y, p(n), picCopy)


really, put some thought into this, we're not into the habit of doing your homework for you here.

-----------------------------------
Zeeshan
Tue Jan 02, 2007 3:04 pm


-----------------------------------
ayo freakshow i wuznt tellin no1 to do my homework. its not evn homework i wuz doin jus checkn sumthin. buh i figured it out. so.........
it don matterr

-----------------------------------
Prince Pwn
Tue Jan 02, 2007 5:59 pm


-----------------------------------
Most people on these forums I noticed with a high post count easily get angered when someone asks for help that can't spell or doesn't describe their problem using many "technical" terms. They mistake lots of people here with low post counts for students wanting someone else to do their homework for them. That's how I see it anyways, and in many ways is true, but sometimes it gets out of hand.

I used to be mistaken for one of those "please do my homework types", even though I work on Turing mostly at home and not for school. I find the best way to learn Turing is to practice at home, and not just do it for school. I find the biggest reason why they think you are the "please do my homework types" is because of your spelling that makes you sound 1337.

We were showing you how to gather all of the pictures into an array. Once that information was stored in the array, just draw it back on the screen. Just because you store the data inside the array doesn't mean they will magically "open" on the screen. The data is there, then you "Draw" it on the screen with another command.

-----------------------------------
Zeeshan
Tue Jan 02, 2007 6:58 pm


-----------------------------------
yo thanks prince i got it all figured out.
