Getting string data from integer variable

Non-platform specific questions.

Postby Troodon » Wed May 30, 2007 6:42 pm

All variables are string exept Add which is integer.

Wait, I'll write a post in a minute
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Troodon » Wed May 30, 2007 6:46 pm

Sparky are you still here?
It saves the array. Then it loads it so that it's always connected with the l33t file in my desktop.
The tulostus are showing the saved and loaded data.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Sgt. Sparky » Wed May 30, 2007 7:29 pm

Gotchya'.
sorry,
I was busy making a Fighting Demo. :(
Are the tulostus actors text actors?(preset text, like a 0 for example?)
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Troodon » Wed May 30, 2007 7:31 pm

Yeah. As I said they work with number values.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Sgt. Sparky » Wed May 30, 2007 7:32 pm

oh,
then you must use sprintf(tulostuswhatever.text, "%d", kirjasto[whatever]);
:D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Troodon » Wed May 30, 2007 7:39 pm

Just a sec, I'll try that.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Troodon » Wed May 30, 2007 7:43 pm

Did you meant like this?
Code: Select all
ADD = input_data.textNumber;
sprintf(kirjasto[place.textNumber], "%d", ADD);
saveVars("l33tfile", "l33tfile");
loadVars("l33tfile", "l33tfile");
sprintf(tulostus.text, "%d", kirjasto[0]);
sprintf(tulostus2.text, "%d", kirjasto[1]);
sprintf(tulostus3.text, "%d", kirjasto[2]);
sprintf(tulostus4.text, "%d", kirjasto[3]);
sprintf(tulostus5.text, "%d", kirjasto[4]);
sprintf(tulostus6.text, "%d", kirjasto[5]);
sprintf(tulostus7.text, "%d", kirjasto[6]);
sprintf(tulostus8.text, "%d", kirjasto[7]);
sprintf(tulostus9.text, "%d", kirjasto[8]);
sprintf(tulostus10.text, "%d", kirjasto[9]);


Now it replaces all the saved data with weird numbers starting with 44...
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Sgt. Sparky » Wed May 30, 2007 7:48 pm

xD
kirjasto needs to be an Integer to store number values.(an integer from of string is what it is printing now, try changing kirjasto to an integer array. :D
(sorry for the delay. :( )
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Troodon » Wed May 30, 2007 7:52 pm

No problems with the delay. Only I will go soon sleep so if I will not answer to a post, I'm sleeping. :lol:

That didn't work. I had to remove the line to because it was "suspicous pointing"
How should I modify the line two?
sprintf(kirjasto[place.textNumber], "%d", ADD);

EDIT: Just to be sure, here is the whole code again:

Code: Select all
ADD = input_data.textNumber;
sprintf(kirjasto[place.textNumber], "%d", ADD);
saveVars("l33tfile", "l33tfile");
loadVars("l33tfile", "l33tfile");
sprintf(tulostus.text, "%d", kirjasto[0]);
sprintf(tulostus2.text, "%d", kirjasto[1]);
sprintf(tulostus3.text, "%d", kirjasto[2]);
sprintf(tulostus4.text, "%d", kirjasto[3]);
sprintf(tulostus5.text, "%d", kirjasto[4]);
sprintf(tulostus6.text, "%d", kirjasto[5]);
sprintf(tulostus7.text, "%d", kirjasto[6]);
sprintf(tulostus8.text, "%d", kirjasto[7]);
sprintf(tulostus9.text, "%d", kirjasto[8]);
sprintf(tulostus10.text, "%d", kirjasto[9]);
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Sgt. Sparky » Wed May 30, 2007 9:33 pm

just accept the suspicous pointer,
I there is one in my login Demo. (it is just suspicous, nothing usually wrong with that.)
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Troodon » Thu May 31, 2007 9:06 am

But it's wrong with my code. The string saving isn't working.
:(

EDIT: When I try to save any data in any slot it crashes.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Sgt. Sparky » Thu May 31, 2007 4:17 pm

hmmm.
I do not know about the crashing but all the numbers Are going to be zero if it loads then saves. so switch the positions of load and save. :D

Thought but not an Edit:
okay!
I know what is wrong! :D
but first:
what is kirjasto exactly?
is is string or integer or real?
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Troodon » Thu May 31, 2007 4:47 pm

Well, it was a string but now it's integer.
If you want, I can send you the ged and data.
I can't die, I already tried
~on the forums since GE 1.3.3~
User avatar
Troodon
 
Posts: 1539
Joined: Thu Jan 12, 2006 3:29 pm
Location: HELL
Score: 56 Give a positive score

Postby Sgt. Sparky » Thu May 31, 2007 4:52 pm

Code: Select all
kirjasto[place.textNumber] = input_data.textNumber;
saveVars("l33tfile", "l33tfile");
loadVars("l33tfile", "l33tfile");
tulostus.textNumber =  kirjasto[0])
tulostus2.textNumber = kirjasto[1];
tulostus3.textNumber = kirjasto[2];
tulostus4.textNumber = kirjasto[3];
tulostus5.textNumber = kirjasto[4];
tulostus6.textNumber = kirjasto[5];
tulostus7.textNumber = kirjasto[6];
tulostus8.textNumber = kirjasto[7];
tulostus9.textNumber = kirjasto[8];
tulostus10.textNumber = kirjasto[9];

and it i33file a variable?
if so your code will work,
but when using the save var function you must use:
saveVars("your variable name", "your variable's save group");
same with loadVars. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Sgt. Sparky » Thu May 31, 2007 4:53 pm

tekdino wrote:Well, it was a string but now it's integer.
If you want, I can send you the ged and data.

only send it if my code does not work. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest