Not logged in
Register | Login

Menu:

Game Maker Extensions Menu:

av. 7/10 | Who rated

Credit to David Szepesvari

Downloads: 1260

Tags:

Get a refer button for this extension!

BBcode

html [example]
download
[download]

3D array

Posted by szepi on April 24, 2007

An extesnion that lets you create 3 dimensional arrays for your games. Help file included! The values can only be numbers.

New in v1.2:
Bug fixed
1 New function


» Add a Screenshot


Functions:

ar_create(width, height, zheight, init value)

Creates a new 3D array with the parameters width, height and depth. It also requires an initial value to store. The function return the id of the the 3D array that is needed to use other functions.

Returns id of array

ar_set_value(id,x,y,z,value)

Assigns the value value to the x, y, z place of the 3D array: id.

Returns if error occured

ar_get_value(id, x, y, z)

Returns the value of the x, y, z place of the 3D array: id.

Returns needed value, if error occcured

ar_get_string(id)

Creates a string containing the information of the 3D array: id. Returns -1 if there is no such id that has been passed to the functions.

Returns string, if error occcured

ar_create_fromstring(string)

Creates a 3D array from the string string and returns the id of the new array.

Returns id of new array

ar_replace_fromstring(string)

Replaces the already existing 3D array whose id is id with the information stored in the string string. Returns -1 if there is a size mismatch.


Returns -1 in case of size mismatch





You not logged on! It is recommended you logon before commenting so we can tell who you are!

Comments:

6:19pm, 24 Apr 2007
Jonah

Aww, dude, you even defined the functions! I'm siked!

11:10pm, 24 Apr 2007
Schyler

This isnt all that great. I give it a 3.

11:55pm, 24 Apr 2007
Schyler

code:
x[0] = 0
y[0] = 0
z[0] = 0
n[0] = 0

caller:
x[argument0] = argument1
etc.

3:40pm, 25 Apr 2007
szepi

[qoute]
code:
x[0] = 0
y[0] = 0
z[0] = 0
n[0] = 0

caller:
x[argument0] = argument1
etc.
[/qoute]
what do you mean?
that I should use the name[index]=value format? That's not possible with extensions

9:08pm, 25 Apr 2007
szepi

[quote]
code:
x[0] = 0
y[0] = 0
z[0] = 0
n[0] = 0

caller:
x[argument0] = argument1
etc.
[quote]
sorry for mispelling quote

9:09pm, 25 Apr 2007
szepi

[quote]
code:
x[0] = 0
y[0] = 0
z[0] = 0
n[0] = 0

caller:
x[argument0] = argument1
etc.
[/quote]
I guess I got it work now..or it doesn't?

9:09pm, 25 Apr 2007
szepi

sorry for bumping..I'll stop it

11:31pm, 25 Apr 2007
Schyler

I made my own testing that method.

6:51am, 26 Apr 2007
szepi

And it's not working? or what is the problem..I thought I tested it in every way..

11:01pm, 26 Apr 2007
Schyler

The variables can be called:

x[0] = bla
etc.

Then in scr_store:
x[0] = argument0

then in scr_get_x
return x[argument]

Thats the shortcut method... :)

3:47pm, 27 Apr 2007
szepi

Sorry..I don't really understand it..you mean this is a shortcut to make a 3D array?

12:04am, 28 Apr 2007
Schyler

Yeah. A faster too.

10:53am, 28 Apr 2007
szepi

How does it work?
Please tell me an example for at least 2D array, where we want to "array[x,y]=val".
how do you do this with your method?

9:24pm, 28 Apr 2007
Schyler

Okay. The easy way where there is an inbuilt grid already there. I cant be bothered doing an example of creating different data structs.

Anyway: here is the code you need to run first:

var_data_x[0] = 0
var_data_y[0] = 0

Then to store:

var_data_x[argument0] = argument1
var_data_y[argument0] = argument2

Then to get the data:

return var_data_x[argument0]

You would also need to screw around with the arrays to turn it into a table grid and add some other stuff but thats a basic preset one.

Now to show you a 3d one where you can create grids.

Hmmmmmmm.

I'll copy and paste some code later for you...

Schyler.

12:33am, 29 Apr 2007
szepi

so is argument0 the value that is set to argument1 and 2?

6:48am, 3 May 2007
szepi

no...I guess not..but i don't get it then

11:05pm, 3 May 2007
Schyler

argument0 is the array index number thing and argument1 & 2 are the values:

set_values(pos,x,y)

10:05pm, 4 May 2007
Schyler

szepi?

12:05am, 12 May 2007
szepi

ok..
but in my version you define 3 indexes and set only one value.
so they are different.

Anyways, sorry, I forgot about this page for a while :)

10:03pm, 12 May 2007
Schyler

I cant really be bothered explaining how to munipulate this anymore but you get the idea. right?

6:35pm, 13 May 2007
szepi

yeah, but yours is not the same as mine..right?
so you have 1 index, and as many values as you want.
I have 3 indexes and 1 value..like the arrays.

11:22pm, 14 May 2007
Schyler

Actually you can change that!

9:29pm, 15 Jun 2007
Guest

only post something that works.

5:58am, 28 Jun 2007
IamCalle

I would really like to see functions like "get_value_x","get_value_y" & "get_value_z", as well as "set_value_x/y/z" -functions. ;) :)

12:33am, 17 Jul 2007
szepi

x,y,z is the place of a value in the array. So you cannot set x,y and z.

2:07pm, 21 Sep 2007
Guest

well i can only go up to about 30,30,30 after that it says an array is bigger than 32000. lets hope thats in the next version of 7.x

3:41pm, 21 Sep 2007
szepi

okay..that might be a problem..
I made this extension a long time ago, and I've found an error after that and I'm not sure if I fixed t or not and whether I've uploaded it here..
I guess I did, 'coz the error was that the reading the 3D array from a file didn't work above 9 :) I'l check it..