Files

Non-platform specific questions.

Files

Postby 4erv' » Sat Dec 19, 2009 10:44 pm

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
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Files

Postby Rux » Sun Dec 20, 2009 4:47 am

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).
I'm not good at coming up with signatures...
User avatar
Rux
 
Posts: 645
Joined: Sun Apr 29, 2007 9:26 pm
Location: Sitting on your moniter invisable.
Score: 35 Give a positive score

Re: Files

Postby makslane » Sun Dec 20, 2009 7:03 am

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
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Files

Postby 4erv' » Sun Dec 20, 2009 9:15 pm

Thanks for so quick answer :)
So, it is imposible to, for example, get a .midi file and play it with PlayMusic function? :(
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Files

Postby 4erv' » Sun Dec 20, 2009 9:59 pm

And what means
Code: Select all
FILE * pFile;
? It creates a variable? :D (i'm currently learning c#, so i'm new to C++)
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Files

Postby 4erv' » Sun Dec 20, 2009 10:48 pm

And is there any way to get all file names from game folder? :)
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Files

Postby 4erv' » Wed Dec 23, 2009 9:49 pm

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? :)
Gold Basketball 2008 - the first basketball game made with game editor.

User avatar
4erv'
 
Posts: 188
Joined: Sat Jul 07, 2007 10:52 am
Location: in Recycle Bin
Score: 10 Give a positive score

Re: Files

Postby skydereign » Wed Dec 23, 2009 9:57 pm

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.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron