Page 1 of 1

Floating Rounded numbers,. ?

Posted: Wed Apr 30, 2008 2:47 pm
by jph_wacheski
Not sure if I'm just not up on my terminology or what,. but why can I not figure out how to set a value from a ZExpresion for a "Float" ?

i.e;

Timer.RepeatCount=7;

when I try this i get an err response "Only float type properties can be used:"

also; while I am here, what is the best way to round values to whole numbers ? for when I would like to get a random whole number without all the messy decimal places,. round(random(4,2) ) => 2,3,4,5,6 ???

Thnks

Re: Floating Rounded numbers,. ?

Posted: Wed Apr 30, 2008 2:55 pm
by VilleK
jph_wacheski wrote: Timer.RepeatCount=7;
RepeatCount is of type "integer" and cannot be set from expressions. This is a limitation of the current script engine unfortunately.
jph_wacheski wrote:
what is the best way to round values to whole numbers ? for when I would like to get a random whole number without all the messy decimal places,. round(random(4,2) ) => 2,3,4,5,6 ???
//here is what I would do
Temp1=random(4,2);
Temp1-=frac(Temp1);

I'm busy fixing the decimal rounding problem when saving zgeproj-files, expect an ZGE update shortly.

Posted: Wed Apr 30, 2008 3:39 pm
by jph_wacheski
//here is what I would do
Temp1=random(4,2);
Temp1-=frac(Temp1);
Dang, you so smart ! that will work,. Thanks

Ok, I see about the repeatCount, I can just use a condition to limit it and leave the repeat count at -1,. np.