Hello, I got bored and while I've tried to avoid it(like many others

) I started working on an experimental Minecraft-type engine.
At this stage, I am just messing around with a single 8x8x8 chunk. I start by making an empty object, then I make a cube mesh. After that, I add a limb of the cube mesh to the previously empty model for each x, y, and x element for a total of 512 cubes.
I am using the DKSHOP plugin for picking limbs at the center of the screen. Right now, I got cube removal done with the right mouse button.
Now for the questions:
1) For some reason, the "dk pick limb" function doesn't seem to pick up a collision unless i am around 0.1 units away from said object or inside of it. Is there anyway to remedy this? I'd like to be able to delete the limb from any distance instead of having to be practically inside of them.
2) I've started working on cube creation but have removed it for now due to problems(EDIT: actually, I noticed the code I uploaded does include the broken "add cube" functionality). For the life of me, I can't add a limb to an existing model without it throwing an error saying that limbs have to be linked sequentially. I have tried to use the link limb function before and after the limb. If I use it before, I get an error that the limb doesn't exist. If I use it after, I get the linked limbs error again. So my second question is, how do you go about properly linking a new limb to an existing object?
And the source code so far:
// CubeEngine
set display mode 1024,768,32,0
sync on
sync rate 0
autocam off
set camera range 0.1,100
MakeEmptyMesh(1,1)
make object 1,1,1
delete mesh 1
make object cube 2,1
make mesh from object 2,2
delete object 2
global totalBlocks
totalBlocks = 8*8*8
limb = 1
load image "./brick.png",1
for z = 0 to 7
for y = 0 to 7
for x = 0 to 7
add limb 1,limb,2
texture limb 1,limb,1
offset limb 1,limb,x+0.5,y+0.5,z+0.5
inc limb
next x
next y
next z
set directional light 0, 0.5, -1.0, 0.5
position camera 4,4,4
yrotate camera -45
xrotate camera 45
global CamXRot#
global CamYRot#
CamXRot# = camera angle x()
CamYRot# = camera angle y()
move camera -16
do
block = 0
if mouseclick()=2
block = dk pick limb(0,mousex(), mousey(),1,1,totalBlocks)
if block > -1
remove limb 1,block
dec totalBlocks
endif
endif
// Part in question //
if mouseclick()=1
block = dk pick limb(0,mousex(), mousey(),1,1,totalBlocks)
if block > -1
add limb 1,totalBlocks+1,2
link limb 1,0,totalBlocks+1
offset limb 1, totalBlocks+1,dk get pick vector x(),dk get pick vector y(),dk get pick vector z()
dec totalBlocks
endif
endif
// End of part //
DoCam()
position mouse screen width()*0.5,screen height()*0.5
set cursor 0,0
print screen fps()
fastsync
loop
end
function MakeEmptyMesh(memblock, mesh)
if memblock exist(memblock) then delete memblock memblock
make memblock memblock, 4*3
pos = 0
write memblock dword 1,pos,338
inc pos, 4
write memblock dword 1,pos,36
inc pos, 4
write memblock dword 1,pos,0
make mesh from memblock mesh,memblock
delete memblock memblock
endfunction
function DoCam()
inc CamXRot#, mousemovey()*0.1
inc CamYRot#, mousemovex()*0.1
CamXRot# = wrapvalue(CamXRot#)
CamYRot# = wrapvalue(CamYRot#)
rotate camera CamXRot#, CamYRot#,0
if keystate(17) then move camera 0.1
if keystate(31) then move camera -0.1
if keystate(30)
turn camera left 90.0
move camera 0.1
turn camera right 90.0
endif
if keystate(32)
turn camera right 90.0
move camera 0.1
turn camera left 90.0
endif
endfunction
And since everyone likes screenies:
Thanks in advance for any and all help
Randy