Browse Search Popular Register Upload Rules User list Login:
Search:
I have a Problem!

Image:
screenshot of the scene

Author: Nitrocide

Group: Default

Filesize: 21.03 kB

Date added: 2016-12-12

Rating: 5

Downloads: 380

Views: 183

Comments: 6

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

Everytime when i write a script on the laserbox, it discontinues it
and makes me frustrated. Can someone fix this? Thanks
Please log in to rate this scene
edit
Similar scenes
Title: Race complex... PLEASE HELP!!
Rating: 5
Filesize: 109.32 kB
Downloads: 397
Comments: 5
Ratings: 1
Date added: 2010/04/18 18:50:06
Made with: Phun
Rating: rated 5
download
Title: Breakable RX-8 V 3.1
Rating: 5
Filesize: 0.62 MB
Downloads: 1337
Comments: 0
Ratings: 1
Date added: 2009/03/22 18:07:39
Made with: Phun
Rating: rated 5
download
Title: I need help with a problem
Rating: 5
Filesize: 1.02 MB
Downloads: 248
Comments: 2
Ratings: 1
Date added: 2010/04/10 22:54:05
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: A VERY VERY MAJOR PROBLEM WITH ALGODOO
Rating: 5
Filesize: 385.15 kB
Downloads: 4539
Comments: 18
Ratings: 1
Date added: 2015/04/08 17:09:15
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Fan Marble Race - Part 2
Rating: 5
Filesize: 419.77 kB
Downloads: 540
Comments: 0
Ratings: 1
Date added: 2017/01/12 13:01:29
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Ocillation problem
Rating: 5
Filesize: 8.77 kB
Downloads: 263
Comments: 2
Ratings: 1
Date added: 2008/12/28 23:12:39
Made with: Phun
Rating: rated 5
download
Something > 5 ? {}:{}
you have to write it like that. What you wrote was
Something > 5 {}
and algodoo doesn't know what that is, so it added some () in order to see if it could fix your code, but nope.
Always be sure that your code isn't changed too much after you finish writing it and clck somewhere else. If parentheses appear on some places your code is bad.

To separate lines of your script you have to use ; like

Scene.my.ignition = true; scene.my.rpm < 300? {scene.my.throttle = 500}:{}

The {}:{} of the if statement mean that if what you're asking is true (like scene.my.rpm < 300 ?) the code on the first {} will be executed. If it isn't the code on the second one will be executed. You can leave one empty inside, but it has to be there!

Also you have to DECLARE your variables before using them, else every scene.my.thing that you wrote doesn't actually exist. Press F10 and write the names of your variables and the initial value you want them to have, like:

Scene.my.whatever = 0

Also if you write a script in the postStep of something, it will be executed no matter what, if the scene is running. so basically you're saying that scene.my.con = 13350 * scene.my.rpm, scene.my.con = 120000 and scene.my.con = 0 at the same time. You have to write that on each lasers' onLaserHit. This means that your script will be executed only when your laser hits something.

And to get scene.my.rpm, you should write scene.my.rpm = angVel * 9.54 on the postStep of the flywheel. This is because angVel is in radians per second, and 1 radian per second is 9.54 RPM
Last edited at 2016/12/12 18:40:05 by The Linkage
Your script does not work for a series of reasons:

First of all, your three lasers all edit the con variable at the same time every single frame, since every one of them has scene.my.con = xxx in their poststep. If you want keycontrolled changes, use keys.isDown("up") ? {} : {} instead. Lasers are a method, but using keys.isdown is more efficient.

Second of all, turning the lasers on has no effect to the scenes since theres neither a onLaserHit nor a onHitByLaser coded somewhere

Lastly, the scene.my.rpm variable is used nowhere, so changing it has no effect.
If you want to know some general thyme, look at this page created by me and someone else:

http://algodoo.wikia.com/wiki/Thyme

for your code to work, remove all code and put it in the hinge like this instead:

postStep: (e)=>{
keys.isDown("up") ? {
motorspeed = math.pi * [Write your RPS here, not RPM. You can also write the formula for it here];
} : {}

Depending on how you want to influence the motor speed or whatever you like to change, add more lines for calculation or whatever you like.


}
actually it would be nice if you didn't use a motor axle for an engine
The Linkage im not trying to.
goooood
I said that mainly cause of fra32's last comment tho
don't be mad at me