The Plugin Way
In my 'DBP Tips and Tricks' thread, CuCuMBeR posted and example of passing array name into a function and set its properties via IanM's plugin:
Type vec
x As Float
y As Float
z As Float
endType
Type object
num As Integer
pos As vec
endtype
DIM obj_Static(10) As object
DIM obj_Dynamic(10) As object
setArray( get arrayptr( obj_Static() ), 1, 1, 0.0, 10.0, 50.0)
setArray( get arrayptr( obj_Dynamic() ), 1, 1, 10.0, 50.0, 150.0)
Set Cursor 0, 0
Print "Static 1:"
Print "Number: "+Str$(obj_Static(1).num)
Print "Pos X: "+Str$(obj_Static(1).pos.x)
Print "Pos Y: "+Str$(obj_Static(1).pos.y)
Print "Pos Y: "+Str$(obj_Static(1).pos.z)
Print "Dynamic 1:"
Print "Number: "+Str$(obj_Dynamic(1).num)
Print "Pos X: "+Str$(obj_Dynamic(1).pos.x)
Print "Pos Y: "+Str$(obj_Dynamic(1).pos.y)
Print "Pos Y: "+Str$(obj_Dynamic(1).pos.z)
Wait key
end
Function setArray(ary As dWord, i As Integer, num As Integer, x As Float, y As Float, z As Float)
DIM tmp(0) As object
Link Array tmp(), ary
tmp(i).num = num
tmp(i).pos.x = x
tmp(i).pos.y = y
tmp(i).pos.z = z
Unlink Array tmp()
UNDIM tmp()
endFunction
Credits to CuCuMBeR for this, oh and IanM's wonderful plugin.
My thread btw:
DBP Tips and Tricks
A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.