Page 1 of 1

Need Help...

PostPosted: Fri Sep 02, 2011 1:37 am
by RippeR7420
is it possible to save a score from one GED file(levelOne.exe). And load it into another GED(levelTwo.exe)? I've tried using saveVars/loadVars but I can't seem to get it to work.... please help!!!

Plus 1 to anyone who helps :D

Re: Need Help...

PostPosted: Fri Sep 02, 2011 2:18 am
by ikarus
It's easy, just make some variables and give them a group with the add variable dialog, and make sure they're all in the same group. Then use saveVar() to save the group to a file, like level.buf, whatever can be any name you wish and then in the next level use loadVars() to load the same group from the same file in the next level^-^

Re: Need Help...

PostPosted: Fri Sep 02, 2011 2:32 am
by RippeR7420
Iv'e been trying that but it isn't working...

this is what i've been doing:



In LVL1.exe i put this code in:
Code: Select all
saveVars("score.file", "nscore");
Score=SCORE.textNumber;




then in LVL2.exe I put this code in:
Code: Select all
loadVars("score.file", "nscore");


I'm not sure Where exactly I need to put the codes in at though...
Where would I need to put in my saveVars in LVL1.exe? and where would I put the loadVars in LVL2?

Thank you so much for your help :)

Re: Need Help...

PostPosted: Fri Sep 02, 2011 2:34 am
by RippeR7420
and the variables don't transfer .GED files... So I would have to make new ones in each game, with the same name(NAME: score GROUP: savescore) right?

Re: Need Help...

PostPosted: Fri Sep 02, 2011 3:12 am
by Jagmaster
Yes, you need them to be exactly the same in order for it to work. So what I like to do is actually copy and paste the variable names into the new ged to make sure there were no typos. (Or if it was a small project, I just save as, or merge into a new doc.)
Another thing, you need to reverse the order of your lvl1 script. If I understand correctly, you're trying save the textnumber to a global variable. Right now you have it so it will save the vars and then get the vars, but you'd probably want to get the var (from score textnumber) and then save the vars.
Hope this helped a little. :)

Re: Need Help...

PostPosted: Fri Sep 02, 2011 3:36 am
by ikarus
saveVars("score.file", "nscore");
Score=SCORE.textNumber;


Is that the actual code? You should probably set the variable before saving it. It looks like you're saving it then setting it

[edit]
Jagmaster beat me :P

Re: Need Help...

PostPosted: Fri Sep 02, 2011 4:41 am
by RippeR7420
oh, okay:)

When I put it in the First GED(LVL1.exe) where do I put it?
right now I have it set like this:

Player->Collision->any side of Exit Door->Reapeat(No)->Script Editor->
Code: Select all
hscore=SCORE.textNumber;
 saveVars("h.file", "nscore");



and then In the second GED(LVL2.exe) like this:


Score(text)->Create Actor->Script Editor:
Code: Select all
SCORE.textNumber = hscore;
 loadVars("h.file", "nscore");


and it still won't work...

Am I putting it in the wrong places? i.e( Collision, Create, etc...)

Thank you guys soooo much!!

Re: Need Help...

PostPosted: Fri Sep 02, 2011 4:46 am
by ikarus
SCORE.textNumber = hscore;
loadVars("h.file", "nscore");


Flip those two there to:

Code: Select all
loadVars("h.file", "nscore");
SCORE.textNumber = hscore;


See you're setting the score before you load it

Re: Need Help...

PostPosted: Fri Sep 02, 2011 6:12 am
by RippeR7420
ahhh!! Thank you SOOOO much! another +1!!!

:) :D :)

You just saved my life and didn't even know it! haha

Re: Need Help...

PostPosted: Fri Sep 02, 2011 2:22 pm
by Jagmaster
All things in any kind of programming are done in order form left to right and top to bottom. There is a little paragraph on inheritance in this article that might be interesting to you. http://game-editor.com/Advanced_programming_logic One can do many things with little script with the power of inheritance! :D

Re: Need Help...

PostPosted: Mon Sep 05, 2011 4:11 am
by RippeR7420
Awesome :D thanks Jag! Plus 1!