[Help] If statement.. continuously refreshing
5 posts • Page 1 of 1
[Help] If statement.. continuously refreshing
Hi to all! I'm new on this forum but I've been playing Algodoo and Phun(a long time ago) since 2-3 years(don't know exactely). I've just started to learn thyme scripting. I'm already facing a problem
so I hope that you, guys, would help me.
So here it is :
I want to change the collision layer depending by the angular velocity of a wheel. I decided to use an "if statement". I have a working statement :
Where:
-scene.my.boxangularvelocity is refreshed by gradyfitz's new method ( and I can get the correct value)
-scene.my.gear1 is the collision number that I want... for1=A first gear ..for 2=B second gear... and so on.
It works only ONCE when I put that statement in the console and press Enter. I need it to work every second of the simulation. So here is my question: How can I make that statement not only work once but every time(every one second or every 2 seconds) without putting that if statement in console and pressing Enter. Thanks for help!
So here it is :
I want to change the collision layer depending by the angular velocity of a wheel. I decided to use an "if statement". I have a working statement :
- Code: Select all
scene.my.boxangularvelocity < 10 ? {scene.my.gear1=1} : {scene.my.gear1=2}
Where:
-scene.my.boxangularvelocity is refreshed by gradyfitz's new method ( and I can get the correct value)
-scene.my.gear1 is the collision number that I want... for1=A first gear ..for 2=B second gear... and so on.
It works only ONCE when I put that statement in the console and press Enter. I need it to work every second of the simulation. So here is my question: How can I make that statement not only work once but every time(every one second or every 2 seconds) without putting that if statement in console and pressing Enter. Thanks for help!
Țăranul se uită la pământ și pământul la țăran..dacă are pământ, dacă nu, atunci nu!

- RpT
- Posts: 11
- Joined: Sun Oct 02, 2011 4:45 pm
Re: [Help] If statement.. continuously refreshing
create a laser and put your if-statement in the onlaserhit of the laser, should be continious.
for phun it would be a rotating box against an other geom for continious collision.
that way you dont have to enter anything anymore
for phun it would be a rotating box against an other geom for continious collision.
that way you dont have to enter anything anymore
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: [Help] If statement.. continuously refreshing
Thanks ! 
Also do you have any ideea how to make the refreshing rate a little bit lower... because it lags much and I cannot control anything. I tried by interrupting the laser beam with a rotating piece of wood but when the beam collides with the spinning wheel the wood's hinge stops working.
I need to interrupt somehow the refresher= the laser beam which goes to the spinning wheel.
Thank you for giving me your lost time
Also do you have any ideea how to make the refreshing rate a little bit lower... because it lags much and I cannot control anything. I tried by interrupting the laser beam with a rotating piece of wood but when the beam collides with the spinning wheel the wood's hinge stops working.
I need to interrupt somehow the refresher= the laser beam which goes to the spinning wheel.
Thank you for giving me your lost time
Țăranul se uită la pământ și pământul la țăran..dacă are pământ, dacă nu, atunci nu!

- RpT
- Posts: 11
- Joined: Sun Oct 02, 2011 4:45 pm
Re: [Help] If statement.. continuously refreshing
you could put the script on a the box which the laser hits, (onlaserhit) and then the interuptor will work,
will also work, where controlleracc>10 can be configured to any delay (higher for longer pause)
- Code: Select all
controlleracc>10 ? {scene.my.boxangularvelocity < 10 ? {scene.my.gear1=1} : {scene.my.gear1=2};controlleracc=0} : {controlleracc+1}
will also work, where controlleracc>10 can be configured to any delay (higher for longer pause)
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: [Help] If statement.. continuously refreshing
Thank you very much ! 
Țăranul se uită la pământ și pământul la țăran..dacă are pământ, dacă nu, atunci nu!

- RpT
- Posts: 11
- Joined: Sun Oct 02, 2011 4:45 pm
5 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest



