I'm not sure what you have done, but when we create a button, we have to read if the mouse is over and if we are clicking mouse. Here is a quick example I made for you. Please don't laugh with the design, was just to show you. You will have to put that into function, and you will figure out how to decrease values as in this example, you only can increase values. Every time you click in "MAKE" one box will be created, and will be positioned in random places. Notice how to stop values control. I hope this clumsy code can show you how to achieve that.
ink rgb(150,150,150),0
box 0,0,100,480
ink rgb(100,100,100),0
box 20,2,40,20 :box 20,30,40,48:box 20,60,40,78: box 20,90,90,110
ink rgb(255,255,0),0
set cursor 0,0
print " X"
print
print " Y"
print
print " Z"
print
print " MAKE "
autocam off
sync on
set camera view 100,0,640,480
rem dumy
make object box 1000,0,0,0
XV=1
YV=1
ZV=1
position camera -50,50,-50
point camera 0,0,0
rem initial object
ob=1
do
ink rgb(150,150,150),0
box 50,0,90,80
ink rgb(255,0,0),0
set cursor 0,0
print " ",xv
print
print " ",yv
print
print " ",zv
rem X value #########################################################
if mousex()>20 and mousex()<38 and mousey()>1 and mousey()<18
if mouseclick()=1
v=v+1
if v=2 then xv=xv+1
else
v=0
endif
endif
rem y value ##########################################################
if mousex()>20 and mousex()<38 and mousey()>29 and mousey()<45
if mouseclick()=1
v2=v2+1
if v2=2 then yv=yv+1
else
v2=0
endif
endif
rem z value ##########################################################
if mousex()>20 and mousex()<38 and mousey()>59 and mousey()<75
if mouseclick()=1
v3=v3+1
if v3=2 then zv=zv+1
else
v3=0
endif
endif
rem MAKING OBJECT CUBE ################################################
if mousex()>20 and mousex()<98 and mousey()>89 and mousey()<107
if mouseclick()=1
m=m+1
if m=2
make object box ob,xv,yv,zv
position object ob,rnd(30),0,rnd(30)
color object ob,rgb(rnd(255),rnd(255),rnd(255))
inc ob
xv=1:yv=1:zv=1
endif
else
m=0
endif
endif
sync
loop
Cheers.
I'm not a grumpy grandpa
