Page 1 of 1

Another random?

PostPosted: Mon Apr 18, 2011 10:13 pm
by TC42
Code: Select all
geval("(cos(sim.time))")

Or is this bad for algodoo?

Re: Another random?

PostPosted: Tue Apr 19, 2011 2:44 pm
by Someone Else
What does geval do?
And did you try simultaneously spawning several circles with that set to vel? Methinks it would repeatedly spawn multiple circles with the exact same velocity.
And how do you turn that into a scene.my thingymabobber? I'm OK with this, because it can be used multiple times in a scene without failing.
And if I stick it into my config, will it automatically appear in every scene that I open?

And I suggest they add a math.random function!

Re: Another random?

PostPosted: Tue Apr 19, 2011 5:30 pm
by bozbez
Someone Else wrote:What does geval do?

geval is the same as eval, but in the global scope.

Someone Else wrote:And did you try simultaneously spawning several circles with that set to vel? Methinks it would repeatedly spawn multiple circles with the exact same velocity.

Yep :)

Someone Else wrote:And how do you turn that into a scene.my thingymabobber?

Code: Select all
scene.my.bla = {geval("(cos(sim.time))")}

Re: Another random?

PostPosted: Tue Apr 19, 2011 6:36 pm
by Someone Else
bozbez wrote:
Someone Else wrote:What does geval do?

geval is the same as eval, but in the global scope.


What's eval?
What's global scope?
Slightly off-topic, but what's the math.floor thing? TC42, you know what I'm talking about.

Re: Another random?

PostPosted: Tue Apr 19, 2011 8:15 pm
by bozbez
Someone Else wrote:
bozbez wrote:
Someone Else wrote:What does geval do?

geval is the same as eval, but in the global scope.


What's eval?
What's global scope?
Slightly off-topic, but what's the math.floor thing? TC42, you know what I'm talking about.

eval - evaluates the function in the current scope.
geval - evaluates the function from the root (root scope).
math.floor - same as in javascript, if you have a number like 45.678, if you do math.floor(45.678), (im guessing the syntax here) you will get 45, if you do math.floor(10.2) you will get 10. Basically it removes the decimal.

Re: Another random?

PostPosted: Wed Apr 20, 2011 1:51 am
by mold999
Define "evaluates the function in the current scope" and everything else you just said.

Re: Another random?

PostPosted: Wed Apr 20, 2011 10:24 am
by bozbez
evaluates the function in the current scope - does the function where it is (its country, or branch (of a tree) :))
evaluates the function from the root (root scope) - does the function from the globe or root (of that tree).

Re: Another random?

PostPosted: Wed Apr 20, 2011 5:47 pm
by mold999
I still have no idea what you are talking about.

Re: Another random?

PostPosted: Wed Apr 20, 2011 6:12 pm
by bozbez
oh...

Re: Another random?

PostPosted: Thu Apr 21, 2011 11:41 am
by Kilinich
There is no point to use geval or eval here. Just search "random" in script forum. There was a lot of examples.