Floating Rounded numbers,. ?

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Floating Rounded numbers,. ?

Post 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
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2382
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Floating Rounded numbers,. ?

Post 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.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post 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.
iterationGAMES.com
Post Reply