Search - User list
Full Version: Hscript Output Even Only
Root » Work in Progress » Hscript Output Even Only
MathiasJ
Made my first hscript which only allows parameter output of even numbers and just wanted to share it in case anyone else could use it.

if ((($OV + 1) % 2), $OV, $OV+1)

Used it to control the number of sides on a gear HDA so the spokes would always have a gap between them. Not super useful but a fun challenge for my first hscript and adds a bit of user friendliness.

Can it be optimized? Would it be better to write it in VEX or Python maybe?
Image Not Found
FDX3245
Well if you change it to:
if(($OV%2), $OV + 1, $OV)
that would be one calculation fewer I suppose.
I wouldn't worry about efficiency for such simple things; Python is not as quick as Vex but it can allow you to do things Vex can't do (File IO, creation of nodes, starting sub processes, &c.), and only when you are doing things multiple times over would you worry about such things.
tamte
safer would be something like this
rint($OV*.5)*2
especially if you allow float numbers as your input
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB