Page 1 of 1

Problem with Array[][][] RESOLVED...±

PostPosted: Mon Apr 27, 2009 12:31 pm
by equinox
HI at ALL,

in this code,

NOME[0][0][15] = sprintf(getclone2(A.name, 2)->text ,"m %s", NOME[0][rt + 2]);
,,,,,,but to print should be NOME[1][0][15],,,I do not understand where I am wrong.

and when print over the index..the GE no indicates error.


char NOME[2][2][15] = 2 ACTOR, with 2 ITEM--->15 char x name item !!


int rt = 0;
char NOME[2][2][15];

strcpy(NOME[0][0], "TIME A");
strcpy(NOME[0][1], "TIME b");

strcpy(NOME[1][0], " ITEM A");
strcpy(NOME[1][1], " ITEM B");

sprintf(getclone2(A.name, 0)->text ,"m %s", NOME[0][rt + 0]); <---print TIME A
sprintf(getclone2(A.name, 1)->text ,"m %s", NOME[0][rt + 1]);<---print TIME B
sprintf(getclone2(A.name, 2)->text ,"m %s", NOME[0][rt + 2]);<---print ITEM A
sprintf(getclone2(A.name, 3)->text ,"m %s", NOME[0][rt + 3]);<---print ITEM A

////////////////////////////
in 2 example NEW: I want alone printer NOME[][],,,, but prints also the STRING[][]. this is weird

strcpy(NOME[0][0], "TIME 1");
strcpy(NOME[0][1], "TIME 2");
strcpy(NOME[0][2], "TIME 3");
strcpy(NOME[0][3], "TIME 4");

strcpy(STRING[0][0], "TIME 55");

sprintf(getclone2(A.name, 0)->text ,"m %s", NOME[0][rt + 0]);// a
sprintf(getclone2(A.name, 1)->text ,"m %s", NOME[0][rt + 1]);// b
sprintf(getclone2(A.name, 2)->text ,"m %s", NOME[0][rt + 2]);// d
sprintf(getclone2(A.name, 3)->text ,"m %s", NOME[0][rt + 3]);// d

...and rt = 4--->print STRING[0][0], "TIME 55"); THis is weird!!

sprintf(getclone2(A.name, 4)->text ,"rt:%d", rt);// d

Re: Problem with Array[][][]

PostPosted: Tue Apr 28, 2009 12:34 am
by skydereign
Can you explain what you are trying to accomplish, and what you are getting as of now? Also, you did not include the data file holding verdana.TTF. I had to use another font and rename it.
Syntactically this is wrong, not sure if this was meant to be a part of your code or not.
Code: Select all
print STRING[0][0], "TIME 55");

Re: Problem with Array[][][]

PostPosted: Tue Apr 28, 2009 2:45 pm
by equinox
Well,

i create char NOME[2][10][8] = 2 Heroe x 10 ITEM x 8 len of string

NOME[0][0] = "ITEM 00" (HEROE 0
.....
NOME[1][0] = "WATER 00" (HEROE 1
.......

when print in video NOME[0][0] ....NOME[0][7] for HEROE 0,, IT OK..... But

...if I try to print over the limit arrays NOME[0][12........30], I print the values of the NOME[1][INDI], this is wrong,,,,

and indicates no error.
My example:

press 1 and 2 for create NOME[0][][] AND NOME[1][][]
press S for NOME[0][][],,press X print in video the val of NOME[0][][]....but when rt == 7....print val of NOME[1][][]:

this should not happen. at least by other editors would give this error.

Tnk1000 for reply.

Re: Problem with Array[][][]

PostPosted: Tue Apr 28, 2009 11:45 pm
by skydereign
Do you mean that when going beyond the arrays access, it will show random bits of memory instead of giving an error? Eventually gameEditor will terminate, depending on what is shown in memory. This only happens with char[]s... I think. If that was what you are talking about, just set a variable limit, so you cannot pass the desired array range.

Re: Problem with Array[][][]

PostPosted: Wed Apr 29, 2009 11:56 am
by equinox
...If that was what you are talking about, just set a variable limit, so you ....

exactly !!!

Tnk1000

score++