Getting string data from integer variable

Non-platform specific questions.

Postby Sgt. Sparky » Wed May 23, 2007 2:37 pm

Yes. :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 23, 2007 4:42 pm

How can I use arrays?
I found nothing from the documentation, so I guess I don't understand it because my bad english. :roll:
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 24, 2007 3:51 am

when you make a variable put array to yes, then type in the max number of points of the integer.

or when you declare an array you can put the number of points in brackets,
example:
int myvariable[200];
that would allow 199 points(areas) to the array,
you can also make an array of arrays...
to declare 24 arrays of 199 points use
somthing like this in global code or when you use it in a code:
myvaraible[24][200];
:D

you can acces these points by using a code similar to this:
myvariable[123] = 100;
or myvariable[anothervariable] = someother variable or 100;
:D

that is pretty much it. :)
which language do you speak?(best)
I can use a translater but my gramar would not be that good. :(
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 » Fri May 25, 2007 5:26 pm

I speak Finnish so you can't find any online translator. :P

I'm now practising the arrays. They almost work. My program can save a file but it saves only to the place 0.
The loading works, because all loads give zero expect place 0 which gives the saved number.
:)
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 » Fri May 25, 2007 5:44 pm

in Finnish:
oi , I-KIRJAIN perustaa ainoa!:) hyvä te raivo asento se jotta pääsy aivan vaihde jos kohta , kuin ehtiä muuttuja , kokonaisluku vieras i-kirjain. apu somthing jäljessä te ahdata se kuin:
Code: Select all
 
for ( = 0; i joukko -lta järjestää vaihde ; i++) {
kaikki mikä muuttuja eli toimia ect. = sinun muuttuja [i];
}

:)
I-KIRJAIN jälkisäädös PM te tokko se valmis ei johtua rikki aivan.
I will PM it to you if it did not come out right.
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 » Fri May 25, 2007 8:19 pm

Sgt. Sparky wrote:in Finnish:
oi , I-LETTER found the only! :) good fury position so that access almost shift if soon , like have time to change, variable, integer guest i-letter. help somthing after you stow it like:
:)
I-LETTER will PM you whether it ready doesn't arise from broken quite.


:roll: As I said, finnish translators never work. :lol: :lol:
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 » Fri May 25, 2007 8:35 pm

xD...
I might just PM you then.
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 » Sat May 26, 2007 10:34 am

I didn't got your pm but however I managed to make the array work with integers.
How can I make it work for string data?
Here is what I tried to do:

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


tulostus-tulostus9 are actors which displays the saved data
I get error messages conserning line 1.
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 » Sun May 27, 2007 1:21 am

that first line just plainly does not work.
xD
that is not valid code in any language. :(
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 » Sun May 27, 2007 7:35 am

Ok, how can I make it work? Do you see what I'm trying to do?
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 » Tue May 29, 2007 3:55 pm

I do not see what you are trying to do. :(
(what are you trying to do in the first line?)
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 » Tue May 29, 2007 7:06 pm

Allright

Kirjasto[10] is my array variable

It's like
kirjasto[place.textNumber], input_data.textNumber

but with text. :wink:
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 » Tue May 29, 2007 7:31 pm

if kirjasto is an array of string:
make a varaible called ADD,
then,
Code: Select all
ADD = input_data.textNumber;
sprintf(kirjasto[place.textNumber], "%d", ADD);

: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 6:10 pm

I made this but it doesn't work.
Is there still mistakes?
Code: Select all
ADD = input_data.textNumber;
sprintf(kirjasto[place.textNumber], "%d", ADD);
saveVars("l33tfile", "l33tfile");
loadVars("l33tfile", "l33tfile");
strcpy(tulostus.text,kirjasto[0]);
strcpy(tulostus2.text,kirjasto[1]);
strcpy(tulostus3.text,kirjasto[2]);
strcpy(tulostus4.text,kirjasto[3]);
strcpy(tulostus5.text,kirjasto[4]);
strcpy(tulostus6.text,kirjasto[5]);
strcpy(tulostus7.text,kirjasto[6]);
strcpy(tulostus8.text,kirjasto[7]);
strcpy(tulostus9.text,kirjasto[8]);
strcpy(tulostus10.text,kirjasto[9]);


I still doesn't get the ADD here. Should I chance something in the srcpy lines?

EDIT: The only thing it makes; it replaces the tulostus slots with zero when I try to add string data. When I add numbers it works.
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 6:39 pm

tekdino wrote:I made this but it doesn't work.
Is there still mistakes?
Code: Select all
ADD = input_data.textNumber;
sprintf(kirjasto[place.textNumber], "%d", ADD);
saveVars("l33tfile", "l33tfile");
loadVars("l33tfile", "l33tfile");
ect.


did you make Add an integer?(you need to.)
but what is the Save then Load part of your text for?
(I see nothing that has to do with it in your code.)
EDIT:
also is kirjasto String or integer Array?(needs to be string)
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