Page 1 of 1

Multidimensional Arrays

PostPosted: Mon Sep 11, 2006 12:18 pm
by irblinx
I want to create a two dimensional array and from what I can see there is no way of doing this from the variable editor, therefore I assume that I can just go ahead and use the global code section to declare it:

int levelData[2][4] = { {0, 1, 2, 4}, {3, 4, 5, 6} };

If this works in GE (?), how do I then assign this variable to a group so that it is included in the group save file?

PostPosted: Mon Sep 11, 2006 1:12 pm
by makslane
To save data not supported in the Variables panel, you need to use your own save function, by using the fopen, fwrite and other C functions.

PostPosted: Mon Sep 11, 2006 5:02 pm
by irblinx
ok thanks, can I add a request for 2 dimensional arrays on the interface then ;)

PostPosted: Mon Sep 11, 2006 6:43 pm
by makslane
In my task list

PostPosted: Mon Sep 11, 2006 10:11 pm
by irblinx
sweet :)

PostPosted: Mon Sep 11, 2006 11:34 pm
by Game A Gogo
irblinx wrote:sweet :)

i dont know why, but it sounde like sweat :)

PostPosted: Wed Sep 13, 2006 11:53 pm
by irblinx
Further to this, how do I actually get the variable declarations in global code to execute?

I can't put them in a function and call them as the need to be declared for other functions to work and therefore as far as I can tell this section of code never gets actioned.

PostPosted: Thu Sep 14, 2006 12:02 am
by makslane
Can you show me the code?

PostPosted: Fri Sep 15, 2006 6:28 am
by irblinx
Everything seems to be in place now and I've sorted a couple of typos and some scope problems created by me moving things around to try and fix the problem!!

Now the only problem left is that for some reason I seem to be getting very strange results reading the contents of the array back out, it is as if the column and row references are the wrong way around and that it is reading the column ref right to left rather than left to right. I can't help but feel I'm making some obvious mistake that I haven't spotted!

PostPosted: Fri Sep 15, 2006 12:06 pm
by makslane
Can you post a little example?

PostPosted: Fri Sep 15, 2006 1:52 pm
by irblinx
I'm just about to have another play and see if I can spot anything obvious, if I have no joy I'll email you an example

PostPosted: Thu Sep 21, 2006 7:19 am
by irblinx
And now fixed and working great, thanks to Makslane. :D

PostPosted: Sat Dec 02, 2006 11:07 am
by EasyViber
and now I still don't know how to make multidimensional array :)

ah... ok... I think i can solve my problem without md array :)