Page 1 of 1

Files

PostPosted: Sat Dec 19, 2009 10:44 pm
by 4erv'
It's time for me to start learning. First of all, I want to know is it available to open/create/delete/move/copy etc. files with GE? And if it is, how to do it? :D

Re: Files

PostPosted: Sun Dec 20, 2009 4:47 am
by Rux
4erv' wrote:It's time for me to start learning. First of all, I want to know is it available to open/create/delete/move/copy etc. files with GE? And if it is, how to do it? :D


The only options you can do are open and create.

Create = saveVars("savename", "savegroup");
Open = loadVars("file that was saved", "savegroup");

These options save all the variables with the same save group.

You can also load text, by saving it as a text file.

IF you were thinking of opening up third party files, MOST of them you can't affect at all.
The only file I think you can effect are text files, for strings (I think).

Re: Files

PostPosted: Sun Dec 20, 2009 7:03 am
by makslane
You can use:

fopen
fclose
fread
fwrite
fscanf

But you can create files only in the game folder.
Look all available functions here:
http://game-editor.com/docs/script_reference.htm

Re: Files

PostPosted: Sun Dec 20, 2009 9:15 pm
by 4erv'
Thanks for so quick answer :)
So, it is imposible to, for example, get a .midi file and play it with PlayMusic function? :(

Re: Files

PostPosted: Sun Dec 20, 2009 9:59 pm
by 4erv'
And what means
Code: Select all
FILE * pFile;
? It creates a variable? :D (i'm currently learning c#, so i'm new to C++)

Re: Files

PostPosted: Sun Dec 20, 2009 10:48 pm
by 4erv'
And is there any way to get all file names from game folder? :)

Re: Files

PostPosted: Wed Dec 23, 2009 9:49 pm
by 4erv'
Okay, fast replies ended fast too. Or maybe I'm asking too much questions.. :D
So, here's another:
I have the code:
Code: Select all
FILE* fp = fopen("all files, "r");
if (fp) {
    nnn.textNumber = 11;
    fclose(fp);
}

How can I replace that "all files" to let him try to open every file in the directory? is there any way? :)

Re: Files

PostPosted: Wed Dec 23, 2009 9:57 pm
by skydereign
Well, you can't read all of the files in the directory, the only way to do this is to have a file that knows all other files within the directory. You can use this to read off the file names, which might be what you want. This would work if the directory is only going to get new files from within the gameEditor game, that way you can keep the file with the names up to date.