Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Multidimensional Arrays within AGK

Author
Message
anwserman
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 30th Sep 2011 06:32
Could someone provide a tutorial on how to use multidimensional arrays within AppGameKit? I had issues using them with DBPro - so I avoided them - but a project I'd like to hammer out in AppGameKit would benefit heavily from them.

Also, what limitations and constraints are there with multiple dimension arrays within AppGameKit?

Hi there. My name is Dug. I have just met you, and I love you.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 30th Sep 2011 07:33
http://www.appgamekit.com/documentation/principles/1_datatypes.htm

About midway down the page, has examples of multi-dimensional arrays.

LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 9th Oct 2011 03:57
A very simple implementation of a multidimensional array:

dim map[10,10]
do
map[5,5]=42
print(map[5,5])
sync()
loop

I drink tea, and in my spare time I write software.
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 10th Oct 2011 17:18
Tsk, tsk, Lee. You don't really want that assignment inside the loop, do you?

I mean, it works and all, but it's just taking up cycles.

XanthorXIII
AGK Gold Backer
13
Years of Service
User Offline
Joined: 13th May 2011
Location:
Posted: 10th Oct 2011 23:54
Lee,
I think you meant

dim map[10,10]
map[5,5]=42

do
print(map[5,5])
sync()
loop
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 15th Oct 2011 06:11
Nicely spotted! Never let a performance boost pass you by!

I drink tea, and in my spare time I write software.

Login to post a reply

Server time is: 2024-11-22 03:31:25
Your offset time is: 2024-11-22 03:31:25