It seems to be caused by
fix object scale. Removing that fixes the error but it exposes another which I can't explain: if brushsizex is an integer then the scale can't exceed 104, however if its a float then it works as expected.
sync on
sync rate 60
backdrop on
color backdrop rgb(0,0,0)
make object cube 1, 5
make object cube 2, 5
position object 1, 1,5, camera position z(0) + 5
position object 2, 8,5, camera position z(0) + 5
make object cube 3,5
position object 3, 5,5, camera position z(0) + 15
set object wireframe 3,1
do
brushsizex# = object scale x(3)
text 5,5, str$(brushsizex#)
if pick object(mousex(),mousey(),1,1) > 0
if mouseclick() = 1
sc = sc + 1
if sc = 2
` fix object scale 3
inc brushsizex#
scale object 3, brushsizex#, object scale y(3), object scale z(3)
endif
endif
endif
if pick object(mousex(),mousey(),2,2) > 0
sc2 = sc2 + 1
if sc2 = 2
` fix object scale 3
dec brushsizex#
scale object 3, int(brushsizex#), object scale y(3), object scale z(3)
endif
endif
if mouseclick() = 0
sc = 0
sc2 = 0
endif
control camera using arrowkeys 0, 1, 2
sync
LOOP
I also threw together a simplified version of your code in case you would like to take a look.
sync on
sync rate 60
backdrop on
color backdrop rgb(0,0,0)
make object cube 1, 5
make object cube 2, 5
position object 1, 1,5, camera position z(0) + 5
position object 2, 8,5, camera position z(0) + 5
make object cube 3,5
position object 3, 5,5, camera position z(0) + 15
set object wireframe 3,1
do
brushsizex# = object scale x(3)
text 5,5, str$(brushsizex#)
`get the mouse's current click status
Mclick=mouseclick()
`if the mouse click has changed since the last cycle
if Mclick<>oldMclick
`store the updated mouse click
oldMclick=Mclick
`if the left mouse button was pressed
if Mclick=1
`use pick object() to detect clicks on objects 1 and 2 simultaneously
ObjID=pick object(mousex(),mousey(),1,2)
`if an object was clicked
if ObjID>0
`if object 1 was clicked
if ObjID=1
`increase the object's scale
inc brushsizex#
`ELSE - object 2 was clicked
else
`decrease the object's scale
dec brushsizex#
endif
`apply the new scale to object 3
scale object 3,brushsizex#,object scale Y(3),object scale Z(3)
endif
endif
endif
control camera using arrowkeys 0, 1, 2
sync
LOOP