I know you've already figured it out, but you may be interested in the following:
`Set up screen and camera
sync on
sync rate 0
color backdrop rgb(0, 0, 0)
autocam off
position camera 0, 220, 600
point camera 0, 0, 0
`Make a new grid object and store the object's number in GridID
`Set it to 100x100 lines
GridID = makeGrid(100, 100)
do
`Turn the grid around in a circle
turn object left GridID, .01
set cursor 0,0: print screen fps()
sync
loop
end
function makeGrid(xSegs, ySegs)
`Make a new memblock
repeat: inc memID: until memblock exist(memID) = 0
make memblock memID, 12 + (xSegs * 32 * 3) + (ySegs * 32 * 3)
`write the first few bytes of object information
write memblock dword memID, 0, 274
write memblock dword memID, 4, 32
write memblock dword memID, 8, (xSegs * 3) + (ySegs * 3)
`Make some vectors to store x,y information
null = make vector2(1)
null = make vector2(2)
`Make the X aligned lines.
`Setting the x, z position for the start and end of a new line
for x = 0 to xSegs - 1
set vector2 1, -(xSegs * 10 / 2) + (x * 10), -(ySegs * 10) / 2
set vector2 2, -(xSegs * 10 / 2) + (x * 10) , (ySegs * 10) / 2
`setting the memblock pointer position
pos = 12 + (y * 96 * xSegs) + (x * 96)
`Write the first x, z vertex position of a triangle
`We offset it a bit so it points 'up'
`We do it here to keep the clockwise orientation of the new triangle.
write memblock float memID, pos, x vector2(2) + 0.1
write memblock float memID, pos + 8, y vector2(2)
`We don't necessarily need to setup the objects normals or UV coords, so we skip forward a lot in the memblock.
pos = pos + 32
`Write the second x, z vertex position of a triangle
write memblock float memID, pos, x vector2(1)
write memblock float memID, pos + 8, y vector2(1)
`Write the third x, z vertex position of a triangle
`We set the x, z coordinates to ~the same as the first so it is a reeeeeally skinny triangle.
pos = pos + 32
write memblock float memID, pos, x vector2(2)
write memblock float memID, pos + 8, y vector2(2)
next x
`Do the same as above for the Y aligned lines.
for y = 0 to ySegs - 1
set vector2 1, -(xSegs * 10) / 2, -(ySegs * 10 / 2) + (y * 10)
set vector2 2, (xSegs * 10) / 2, -(ySegs * 10 / 2) + (y * 10)
pos = pos + 32
write memblock float memID, pos, x vector2(1)
write memblock float memID, pos + 8, y vector2(1) + 0.1
pos = pos + 32
write memblock float memID, pos, x vector2(2)
write memblock float memID, pos + 8, y vector2(2)
pos = pos + 32
write memblock float memID, pos, x vector2(1)
write memblock float memID, pos + 8, y vector2(1)
next y
`Delete the vectors
null = delete vector2(1)
null = delete vector2(2)
`Make a new mesh, deleting the memblock
repeat: inc meshID: until mesh exist(meshID) = 0
make mesh from memblock meshID, memID
delete memblock memID
`Make a new object, deleting the mesh
repeat: inc objID: until object exist(objID) = 0
make object objID, meshID, 0
delete mesh meshID
`Turn on wireframe for the object
set object wireframe objID, 1
endfunction objID
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.