Page 1 of 2
problem with saving high score name on GE
Posted:
Sun Mar 26, 2006 3:52 am
by frodo
I am able to save the high score itself, but am having trouble saving the name that goes with the high score. Can anyone help?
Thanks
Posted:
Sun Mar 26, 2006 4:19 am
by makslane
Can you send me the game?
Posted:
Mon Mar 27, 2006 4:21 am
by frodo
should I export the game before uploading it?
last time I uploaded something it had an error with loading the animations.
Posted:
Mon Mar 27, 2006 12:56 pm
by plinydogg
Frodo,
Quick question: are you using strcpy()? I had problems saving the name associated with a high score a little while back and they all stemmed from the fact that I wasn't using strcpy().
Just thought I'd ask.
Posted:
Mon Mar 27, 2006 3:59 pm
by frodo
No, I'm not using strcpy. do you know how I can save it?
Posted:
Mon Mar 27, 2006 5:36 pm
by frodo
I tried to upload it, and it won't work.
Posted:
Mon Mar 27, 2006 11:57 pm
by plinydogg
This may not be what your problem is, but this is how I did it:
strcpy(Score01Name, TextActor.text);
Score01Level = level;
Score01Score = score;
saveVars("game.sav", "high scores");
Score01Name is a global string variable. TextActor is a text actor that has the holds the name of the high scorer. I copy the contents of TextActor into Score01Name with the strcpy() command. The other two are saved just like you normallly save global integer variables. Hope this helps a little bit.
Posted:
Tue Mar 28, 2006 5:07 am
by frodo
it didn't work.
Posted:
Tue Mar 28, 2006 4:48 pm
by plinydogg
Are you sure that your high score name variable is both GLOBAL and a STRING variable?
Posted:
Tue Mar 28, 2006 4:52 pm
by frodo
yes
Posted:
Tue Mar 28, 2006 8:30 pm
by plinydogg
Okay. What exactly are you doing?
Posted:
Tue Mar 28, 2006 9:10 pm
by frodo
here's what I'm doing:
save=name.text;
saveVars("game.sav","scores");
I don't need to save the score; I can do that. I have my high score, and there should be a name with it.
for example, A guy named Jon makes a high score. He puts his name in,"Jon". The next person that plays the game should be able to see the high score, and see Jon's name by it.
Thanks for your patience with a little guy like me!
Posted:
Tue Mar 28, 2006 10:43 pm
by plinydogg
Instead of this:
save = name.text;
Use this:
strcpy(save, name.text);
This copies the contents of name.text into the save variable. You can't do it the same way that you assign a number value to a variable (which is in effect what you're doing by using the code save = name.text;).
As far as I know, every time you want to do anything with strings, you have to use strcpy(). Examples:
strcpy(save, name.text); //copies the contents of name.text into save
strcpy(name.text, save); //copies the contents of save into name.text
I hope this helps solve your problem. And you don't have to thank me for my patience. I had the exact same problem you're having and others were patient enough to help me, so it's the least I can do....I just hope that it works!
Posted:
Wed Mar 29, 2006 3:50 pm
by frodo
When you make the save variable, what do you you put in the save group?
Thanks
Posted:
Wed Mar 29, 2006 11:17 pm
by Fuzzy
You name the save group whatever you want.