Stop and start a motor

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

Stop and start a motor

Postby RagtimeJoe » Sat Jan 09, 2010 5:02 am

Hello!
Does anyone know a script for stopping and starting a motor? Prefarabily upon colide of two other objects so that they can act like an external switch.

I thought perhaps it may be possible to make a script which pressed the key assigned to stop the motor upon collide of objects? Like a virtual keyboard key!
Any ways to turn a motor on and off that you chaps can come up for me will be useful! thankyou :)
RagtimeJoe
 
Posts: 3
Joined: Sat Jan 09, 2010 4:49 am

Re: Stop and start a motor

Postby standardtoaster » Sat Jan 09, 2010 6:09 am

It is not possible to simulate a key press. You can turn a motor on and off however.
Code: Select all
Scene.my.motor = false

Set up a switch like this:
Code: Select all
o\ o

In the left circle put:
Code: Select all
scene.my.motor = false

In the right circle put:
Code: Select all
scene.my.motor = true

Get the idea?
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Stop and start a motor

Postby Kilinich » Sat Jan 09, 2010 9:43 am

motors are capable to control with keys. what else you need? :wtf:
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Stop and start a motor

Postby Fujitsu » Sat Jan 09, 2010 1:08 pm

Isn't the toggle option there for a reason?
Image
Gimmie money.
User avatar
Fujitsu
 
Posts: 328
Joined: Tue Sep 01, 2009 12:28 am
Location: Canada

Re: Stop and start a motor

Postby RicH » Sat Jan 09, 2010 3:11 pm

He said upon colission of two other objects. He may be making a trigger or something.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
User avatar
RicH
[Funniest Person 2010]
 
Posts: 2043
Joined: Tue Sep 01, 2009 9:01 am

Re: Stop and start a motor

Postby RagtimeJoe » Sun Jan 10, 2010 1:13 am

RicH wrote:He said upon colission of two other objects. He may be making a trigger or something.

Exactly :) I don't want to press keys for this, It must be actuated by objects within the simulation!


Mr Standardtoaster, That looks perfect! I will give it a go now and see, thankyou very much :D

I just thought of one more thing, is it possible to specify a specific motor so that it doesn't turn all of them off?
RagtimeJoe
 
Posts: 3
Joined: Sat Jan 09, 2010 4:49 am

Re: Stop and start a motor

Postby standardtoaster » Sun Jan 10, 2010 1:18 am

Yes. For any motor that you want affected by Scene.my.motor, put {scene.my.motor} in the motor field of a motor. Sorry if that is confusing. ;)
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Stop and start a motor

Postby RagtimeJoe » Wed Jan 13, 2010 6:42 pm

That works perfectly! Thankyou!
RagtimeJoe
 
Posts: 3
Joined: Sat Jan 09, 2010 4:49 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 7 guests

cron