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.

Newcomers DBPro Corner / multi dimensional arrays

Author
Message
catman
18
Years of Service
User Offline
Joined: 10th Dec 2005
Location:
Posted: 30th Dec 2005 18:48
could some body help i know this is prob a daft question but does any body know where i can find any details on setting up multi dimensional arrays and understanding them
SirFire
19
Years of Service
User Offline
Joined: 4th Apr 2005
Location: North America
Posted: 31st Dec 2005 07:42 Edited at: 31st Dec 2005 07:43
"dim a(4,4)" would give you a 25 block peice of data with 5 rows and 5 columns. (counting 0 of course)
So you would have

So if you said "a(2,4)=69" this would happen:

And if you said "FOR X=0 TO 4:FOR Y=0 TO 4:a(X,Y)=X*Y:NEXT Y:NEXT X" then you would get this:

You can also use more than 2 dimensions like "dim a(4,4,4)" which would give you a 125 block peice of data. (5x5x5)

catman
18
Years of Service
User Offline
Joined: 10th Dec 2005
Location:
Posted: 31st Dec 2005 23:33
sorry mate thanks but this is the type of array i mean if you would be so kind im sorry i cant quite get my head around it.
so any help would be greatly appreciated
catman
18
Years of Service
User Offline
Joined: 10th Dec 2005
Location:
Posted: 1st Jan 2006 01:05
type characterObject
object as integer
selected as integer
moving as integer
targetX as float
targetZ as float
life as integer
kind as integer
group as integer
rotation as float
endtype

dim character(TOTAL_CHAR_AMOUNT) as characterObject

type characterStatsObject
name as string
maxLife as integer
armor as integer
dmg as integer
range as integer
icon as integer
speed as integer
endtype

dim characterStats(4) as characterStatsObject

characterStats(1).name = "Peasant"
characterStats(1).maxLife = 30
characterStats(1).armor = 0
characterStats(1).dmg = 2
characterStats(1).range = 0
characterStats(1).icon = 5
characterStats(1).speed = 2
characterStats(2).name = "Swordsman"
characterStats(2).maxLife = 45
characterStats(2).armor = 2
characterStats(2).dmg = 6
characterStats(2).range = 0
characterStats(2).icon = 6
characterStats(2).speed = 2
characterStats(3).name = "Bowman"
characterStats(3).maxLife = 40
characterStats(3).armor = 1
characterStats(3).dmg = 4
characterStats(3).range = 5
characterStats(3).icon = 7
characterStats(3).speed = 2
characterStats(4).name = "Knight"
characterStats(4).maxLife = 60
characterStats(4).armor = 4
characterStats(4).dmg = 10
characterStats(4).range = 0
characterStats(4).icon = 8
characterStats(4).speed = 4
Chewy
18
Years of Service
User Offline
Joined: 1st Jan 2006
Location:
Posted: 3rd Jan 2006 02:34
mate do u mean like so:



is that the sort of thing ur after mate?

Chewy
catman
18
Years of Service
User Offline
Joined: 10th Dec 2005
Location:
Posted: 3rd Jan 2006 20:19
sorry mate doesnt matter now got it sorted cheers

Login to post a reply

Server time is: 2024-11-27 07:44:51
Your offset time is: 2024-11-27 07:44:51