Automatic gearbox: help with scripting ?

About advanced scenes, and the Thyme scripting language used in Algodoo.

Automatic gearbox: help with scripting ?

Postby PhunWars » Thu Jan 19, 2012 5:28 pm

Hi all, I have built a long time a go a spring engine and I would like to build an automatic gearbox that selects a gear depending on rpm...I've already done the gearbox: 6 gears in the classical circles that collide if one not collides with water or not "hetero collides" (the type of gearbox I'm talking about is very similar to this which is not mine anyway:
Rating: rated 6.8
Filesize: 102.96 kB
Comments: 8
Ratings: 5
download
)
How can I do ? I've tried with some mechanical things and kilinich's probe but it's too complicated
What I would like to do is: when engine reaches 300 rad/s the gearbox chooses a higher gear and when it reaches 20 rpm it chooses a lower gear
Image
User avatar
PhunWars
 
Posts: 78
Joined: Wed Dec 30, 2009 11:01 pm

Re: Automatic gearbox: help with scripting ?

Postby monstertje3 » Thu Jan 19, 2012 5:56 pm

Code: Select all
circle := readable(owner);
    v := circle.vel;


directly copied from one of kilinichs scripts :), you can use this to check the velocity and such.
go to script menu and then the bottom, you will there see wich attributes you can acces with readable
then you can do something with a if statement for your gearbox
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.
User avatar
monstertje3
 
Posts: 343
Joined: Sat Sep 05, 2009 4:29 pm
Location: N-H, NL

Re: Automatic gearbox: help with scripting ?

Postby PhunWars » Thu Jan 19, 2012 11:37 pm

Hmm where can I learn this something ? And where should I put that code ? If I got what you said should be something like "If x > 300 rpm" and it changes gear isn't it ?
Image
User avatar
PhunWars
 
Posts: 78
Joined: Wed Dec 30, 2009 11:01 pm

Re: Automatic gearbox: help with scripting ?

Postby monstertje3 » Fri Jan 20, 2012 8:33 am

you can put it in the onlaserhit of a box, and then put a laser against it so it constantly refreshes
then you use if statements
circle.vel>10 ? {your gearbox variables}:{what to do when vel is below 10}
ofcourse the gearbox variables would be scene.my, wich you put then on your gears/gearing system
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.
User avatar
monstertje3
 
Posts: 343
Joined: Sat Sep 05, 2009 4:29 pm
Location: N-H, NL

Re: Automatic gearbox: help with scripting ?

Postby PhunWars » Sun Jan 22, 2012 1:29 pm

Sorry for my ignorance, but what should I put in your gearbox variables ? The collision set ? And what in "What to do when rpm is below 10" ?
Image
User avatar
PhunWars
 
Posts: 78
Joined: Wed Dec 30, 2009 11:01 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests