Computer Science Canada Folder Picture Output |
Author: | kartikitrak [ Wed Jan 12, 2011 2:48 pm ] |
Post subject: | Folder Picture Output |
How do you output all the pictures in a specific folder? Basically I want to show a list of all my maps that are in a folder, however I don't know how. It's like Call of Duty when you are selecting a map. If possible, just a list of all the filenames are good,too. Also the folder may be updated at anytime and I would like to keep the list updated. |
Author: | Tony [ Wed Jan 12, 2011 2:54 pm ] |
Post subject: | RE:Folder Picture Output |
I think familiarizing yourself with dirmodule is a good starting point |
Author: | kartikitrak [ Wed Jan 12, 2011 3:35 pm ] |
Post subject: | RE:Folder Picture Output |
you have made me feel like an idea... THANK YOU! : ) |
Author: | kartikitrak [ Wed Jan 12, 2011 3:42 pm ] |
Post subject: | RE:Folder Picture Output |
I have tried using the dirmodule however I am just wondering if it will allow you to output all the pictures in the folder. |
Author: | Tony [ Wed Jan 12, 2011 3:44 pm ] |
Post subject: | RE:Folder Picture Output |
It provides the tools for you to find out what all the files in the folder are. You can use file name endings to figure out if those files are pictures or not, and once you have the name of the pictures, you can do whatever you want with them. |
Author: | kartikitrak [ Wed Jan 12, 2011 3:51 pm ] |
Post subject: | RE:Folder Picture Output |
i still don't really get it. So how to i get the pic.draw feature to use the filenames listed in the screen |
Author: | Tony [ Wed Jan 12, 2011 3:56 pm ] |
Post subject: | RE:Folder Picture Output |
before you use Pic.Draw you need to use Pic.FileNew, which requires a filename, which you just got ![]() |
Author: | kartikitrak [ Wed Jan 12, 2011 3:57 pm ] |
Post subject: | RE:Folder Picture Output |
but does filename represent only one file or the whole list if it represents one how would you pic.filenew the others also if it represents the whole list would u just need pic.filenew (filename) |
Author: | Tony [ Wed Jan 12, 2011 4:00 pm ] |
Post subject: | RE:Folder Picture Output |
No, Pic.FileNew take one name at a time. To go over all of the names, you'd need some sort of a loop. |
Author: | kartikitrak [ Wed Jan 12, 2011 4:01 pm ] |
Post subject: | RE:Folder Picture Output |
anyway..i tried with just one picture but i gives me a illegal picture id number 0 var streamNumber : int var fileName : string var dir : string dir := Dir.Current + "/usermaps" streamNumber := Dir.Open (dir) assert streamNumber > 0 loop fileName := Dir.Get (streamNumber) var pic : int := Pic.FileNew (fileName) exit when fileName = "" put fileName Pic.Draw (pic, 0, 0, picCopy) end loop Dir.Close (streamNumber) |
Author: | Tony [ Wed Jan 12, 2011 4:03 pm ] |
Post subject: | RE:Folder Picture Output |
What is the fileName that it tries to open? Is there such a file in the _current_ directory? |
Author: | kartikitrak [ Wed Jan 12, 2011 4:05 pm ] |
Post subject: | RE:Folder Picture Output |
My current directory /Game listprogram.t(this is the program) /usermaps/pic1,pic2 |
Author: | kartikitrak [ Wed Jan 12, 2011 4:05 pm ] |
Post subject: | RE:Folder Picture Output |
Do you have an msn. So we can talk via msn. |
Author: | Tony [ Wed Jan 12, 2011 4:06 pm ] |
Post subject: | RE:Folder Picture Output |
Yes. When you get the illegal picture ID error, what value does fileName have at that time? |
Author: | kartikitrak [ Wed Jan 12, 2011 4:07 pm ] |
Post subject: | RE:Folder Picture Output |
if you didn't get the folder... the directory that everything is in is: Gane in that folder there is one folder named usermaps and the turing file. the turing file is trying to read and output the pictures in the usermaps folder. |
Author: | kartikitrak [ Wed Jan 12, 2011 4:08 pm ] |
Post subject: | RE:Folder Picture Output |
idk... when the pic.draw is not there it reads the files in the folder...couldn't use just give the full code to read and output the things. |
Author: | Tony [ Wed Jan 12, 2011 4:11 pm ] |
Post subject: | RE:Folder Picture Output |
"illegal picture id number 0" means that the file you asked for could not be loaded, likely because it was not found. Alternatively, looking at the docs, it seems that Quote: The fileNameparameter must give the format of the file |
Author: | kartikitrak [ Wed Jan 12, 2011 4:12 pm ] |
Post subject: | RE:Folder Picture Output |
Full Code: or example: |
Author: | Insectoid [ Wed Jan 12, 2011 8:53 pm ] |
Post subject: | RE:Folder Picture Output |
Nope. |