I don't know about everybody else, but I don't like the SCALE OBJECT command and the way that it uses percentages! So, I decided to make a SCALE OBJECT function that does not use percentages, but normal sizes like the SIZE SPRITE command does. The function itself uses Scale Object, but you don't need to write it. Here it is. It's called SizeObject:
function SizeObject(SQ_OBject,SQ_x#,SQ_y#,SQ_z#)
SQ_sx#=object size x(SQ_Object)
SQ_sy#=Object size y(SQ_Object)
SQ_sz#=Object size z(SQ_Object)
SQ_px#=100*(SQ_x# / SQ_sx#)
SQ_py#=100*(SQ_y# / SQ_sy#)
SQ_pz#=100*(SQ_z# / SQ_sz#)
Scale OBject SQ_OBject, SQ_px# , SQ_py# ,SQ_pz#
endfunction
The first parameter is the object number that you want to resize.
The second parameter is the X size.
The third parameter is the Y size.
The fourth parameter is the Z size.
The reason why all of the variables have a SQ_ in front of them is just to make those variables stand out. In DBPro, somebody may have already made X# a global variable for another purpose, as it is a common name. However, SQ_X# isn't a very common name. Why SQ? It sounds like Sixty Squares
Here's a simple example to toy with:
sync on
sync rate 60
Make object sphere 1,100
SizeOBject(1,20,20,20)
do
set cursor 0,0
print "The sphere was resized. Have a look."
sync
loop
end
function SizeObject(SQ_OBject,SQ_x#,SQ_y#,SQ_z#)
SQ_sx#=object size x(SQ_Object)
SQ_sy#=Object size y(SQ_Object)
SQ_sz#=Object size z(SQ_Object)
SQ_px#=100*(SQ_x# / SQ_sx#)
SQ_py#=100*(SQ_y# / SQ_sy#)
SQ_pz#=100*(SQ_z# / SQ_sz#)
Scale OBject SQ_OBject, SQ_px# , SQ_py# ,SQ_pz#
endfunction
and here the function is again in 1 line lol:
function SizeObject(SQ_OBject,SQ_x#,SQ_y#,SQ_z#) : SQ_sx#=object size x(SQ_Object) : SQ_sy#=Object size y(SQ_Object) : SQ_sz#=Object size z(SQ_Object) : SQ_px#=100*(SQ_x# / SQ_sx#) : SQ_py#=100*(SQ_y# / SQ_sy#) : SQ_pz#=100*(SQ_z# / SQ_sz#) : Scale OBject SQ_OBject, SQ_px# , SQ_py# ,SQ_pz# : endfunction