REM - HOPE THIS HELPS
REM - ALLOCATE MEMORY FOR THREE VECTORS REFERENCED BY THE
REM - INDICES 1,2, AND 3.
r1 = make vector3(1)
r2 = make vector3(2)
r3 = make vector3(3)
REM - *** NOTE ***
REM - I'm not really sure what the return value means
REM - but I suspect it's 1 if the allocation succeeded
REM - and 0(zero) if DB couldn't allocate the vector
REM - because e.g. you ran out of memory, or you've
REM - already allocated a vector to a particular number. REM - Therefore I check here and exit if any of the
REM - results is 0.
REM - ************
if r1 = 0 goto error
if r2 = 0 goto error
if r3 = 0 goto error
REM - INITIALIZE VECTORS 1 AND 2 WITH SOME VALUES
set vector3 1, 100.0, 200.0, 300.0
set vector3 2, 110.0, 220.0, 330.0
REM - SUBTRACT VECTOR 2 FROM VECTOR 1 AND STORE
REM - THE RESULT IN VECTOR 3
subtract vector3 3, 1, 2
REM - PRINT THE RESULT
print "("+ str$(x vector3(3)) +","+ str$(y vector3(3)) +","+ str$(z vector3(3)) +")"
error:
REM - DEALLOCATE THE VECTORS SO THAT YOU CAN REUSE
REM - 1, 2, AND 3 AGAIN LATER(?)
if r1 = 1 then r1 = delete vector3(1)
if r2 = 1 then r2 = delete vector3(2)
if r3 = 1 then r3 = delete vector3(3)