Page 1 of 1
Way to save textNumbers and variables in .sav file?
Posted:
Sat Mar 23, 2013 9:46 pm
by bat78
Hello, it wasn't explained so far a bit more clean, so i was wondering does someone know, how i can save my own variable's values and textNumbers values.
Re: Way to save textNumbers and variables in .sav file?
Posted:
Sun Mar 24, 2013 10:57 am
by MrJolteon
You can do it with saveVars.
*Waits for someone to come with a much better way to do it.*
Re: Way to save textNumbers and variables in .sav file?
Posted:
Sun Mar 24, 2013 12:36 pm
by bat78
I Know right this command, but not sure how to use it. Do not know the syntax. And does i have to define the text Numbers like variables?
Re: Way to save textNumbers and variables in .sav file?
Posted:
Sun Mar 24, 2013 6:07 pm
by skydereign
bat78 wrote:And does i have to define the text Numbers like variables?
You can't save textNumbers directly, so you need to create variables for them anyway. You should be doing this already, as relying on textNumber is a bad idea. As for the syntax of saveVars, you can search it on this page.
http://game-editor.com/docs/script_reference.htm
Re: Way to save textNumbers and variables in .sav file?
Posted:
Sun Mar 24, 2013 10:09 pm
by bat78
well, i just declared the number like a variable and i made it to auto save/load the numbers and the amount of actor's xvelocity. I had to think a little.
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 3:02 am
by Hblade
you can use the FILE method like so:
- Code: Select all
void SaveInfo(char*FNAME)
{
FILE* file=fopen(FNAME, "wr");
if(file!=NULL)
{
fprintf(file, "First text here, use %d to make a var", var1);
}
fclose(file);
}
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 7:48 am
by bat78
Looks Complicated a bit. I am not sure but:
- Code: Select all
void SaveInfo(char*FNAME) <- custom function accepting 2 parameters?
{
FILE* file=fopen(FNAME, "wr"); <- does i have to point the file name using fname first, must be relative to game directory too?
if(file!=NULL) <- does ! is operator for "Is NOT"
{
fprintf(file, "First text here, use %d to make a var", var1); -> does fprintf, fclose, fname.. adds "f" with will mean format?
}
fclose(file);
}
It gives me two errors:
- Code: Select all
Error line 2: Illegal function definition in ex213744816069441
Error line 10: Expected ;
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 8:04 am
by Hblade
yes it stands of is not, and on FILE * you can replace "FNAME" with what ever you want for the file extention, example: "MySomething.file" with quotes
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 8:19 am
by bat78
Can u give me an example, using custom names already, it keeps return me those errors.
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 6:04 pm
by Hblade
look at AME (advanced Map Editor) or SME
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 7:09 pm
by bat78
Only completely silly person that don't spend decent time on game-editor wouldn't understand the saving for that time, thanks
:p
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 7:45 pm
by lcl
bat78 wrote:Only completely silly person that don't spend decent time on game-editor wouldn't understand the saving for that time, thanks
:p
That was irony I presume?
Re: Way to save textNumbers and variables in .sav file?
Posted:
Mon Mar 25, 2013 8:10 pm
by bat78
lmao It's a matter fact yea!
Re: Way to save textNumbers and variables in .sav file?
Posted:
Tue Mar 26, 2013 11:15 pm
by Hblade
lol sorry