Page 3 of 3

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Mon Sep 05, 2011 9:41 pm
by Chronos
cocolover76 wrote:Is there a command that crashes algodoo, and only works in algodoo? (i wanna make a scene for people that like phun)

Go the fuck away. Seriously. We already dealt with that shit when Algodoo was new, we're not doing it again, understood? That's a banable offense.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Mon Sep 05, 2011 10:47 pm
by TC42
There is system.exit, I think, and there is also a way to tell what they are using to open the scene, but I'm not too sure on that. Or something like that. But you'll be banned anyway if you try that. Chronos already beat me to the yelling part.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Mon Sep 05, 2011 11:13 pm
by electronicboy
Chronos wrote:
cocolover76 wrote:Is there a command that crashes algodoo, and only works in algodoo? (i wanna make a scene for people that like phun)

Go the fuck away. Seriously. We already dealt with that shit when Algodoo was new, we're not doing it again, understood? That's a banable offense.


yeah... Posting something like that on algobox WILL get you ATLEAST one weeks ban....
Ask Mr. crash about his scene....

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Thu Sep 08, 2011 1:14 am
by cocolover76
electronicboy wrote:
Chronos wrote:
cocolover76 wrote:Is there a command that crashes algodoo, and only works in algodoo? (i wanna make a scene for people that like phun)

Go the fuck away. Seriously. We already dealt with that shit when Algodoo was new, we're not doing it again, understood? That's a banable offense.


yeah... Posting something like that on algobox WILL get you ATLEAST one weeks ban....
Ask Mr. crash about his scene....


Can I make it make the scene blank if its algodoo?
If not, spawn a big square?
Anything?
Make fireworks disactivate?
Move everything underground?
Anything?
Change text in a box?
FOR GODS SAKE, WHAT CAN I DO TO DISACTIVATE THE SCENE AND IT LETS ME PUT ON ALGOBOX?
IF I CANT MAKE A PHUN MEMORIAL, I WILL CLOSE ALL OF MY ACCOUNTS, AND THAT IS 1 LESS
MEMBER FOR YOU.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Thu Sep 08, 2011 1:30 am
by Chronos
cocolover76 wrote:IF I CANT MAKE A PHUN MEMORIAL, I WILL CLOSE ALL OF MY ACCOUNTS, AND THAT IS 1 LESS
MEMBER FOR YOU.

Bye bye! :)

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Fri Nov 04, 2011 7:39 pm
by InfinityPlayer
I haven't read all the comments, but i'd like to know if there's an updated version of this lot for the new version of Algodoo, v2.0?

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Tue May 01, 2012 3:17 am
by martixy
Hm... er... that's one of the most "unique" tutorials I've seen in a long time(and I don't mean this in a nice way either).

Is there a normal tutorial somewhere around here(you know, something more like "this is used to achieve that and works like this", not "type this, then that and you're done, moving on...")?

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Fri Jun 29, 2012 11:22 pm
by tadietz
Newbie question here - I am building a sim where I want to gradually increase the motorSpeed of two motors in a synchronous manner on two wheels within my scene. I managed to sort of crudely do this by just selecting the two motors, bringing up the options menu on the selected motors, and gradually moving the slider to the right to increase motor speed on both selected motors at once.

This gives me roughly the capability I desire, but I would like to have the motors speed up (and also possibly slow down) more smoothly than I seem to be able to control in the above manner, so I thought a Thyme script would do the trick.

Unfortunately, though I have done a fair bit of scripting and programming in other environments, I cannot seem to find sufficient documentation to help me locate the names of the two motor objects I want to control. Also, the discussions in the tutorial regarding using scripting menus for setting values on individual objects don't seem to fit what I want to do.

Any help is appreciated. Wonderful tool, by the way. I am really glad I found Algodoo - it is helping me greatly in thinking out some concepts in an invention I want to check out some different configurations and parameters of before physically constructing it.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Sat Jun 30, 2012 4:48 pm
by Nxdt
Its quite easy;

Create a varible in the console, use ~/` key to open.
Write,
scene.my.motorspeed = 0

Press enter.

Then make two lasers, one to increase speed, one to decrease. Set them so you can activate with a key press.

In the scripting menu, onlaserhit section. This code increases or decreases the value.
For the Increasing laser
Code: Select all
(e)=>{scene.my.motorspeed = scene.my.motorspeed + 0.5}

For the Decreasing laser
Code: Select all
(e)=>{scene.my.motorspeed = scene.my.motorspeed - 0.5}


Then in the motors scripting menu, under motor speed write
Code: Select all
{scene.my.motorspeed}

This links the motors rpm to the varaible scene.my.motorspeed.

Here is an example scene.

Smoothspeed.phz
(11.39 KiB) Downloaded 155 times

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Mon Jul 02, 2012 6:20 pm
by tadietz
Nxdt,

Thanks, your approach worked well for what I wanted to do.

Now, however, I may need to 'upgrade' to the educational version because I really want to chart a lot of the data coming out of my sim, and the version I bought (very reasonable for what it does) does not seem to provide for that, unless one can do charts with Thyme without having the educational version? That'd be nice...

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Fri Jul 27, 2012 11:48 pm
by tadietz
Next question - is there a way to write a script to automatically increase motor speed to match the angular velocity of another object, say a circle/disk rolling down an angled ramp or something similar?

Also, can you find the angle of the tangent line on a circle/disk at a given point, say the point of contact with another object?

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Sat Jul 28, 2012 3:07 am
by TC42
tadietz wrote:Next question - is there a way to write a script to automatically increase motor speed to match the angular velocity of another object, say a circle/disk rolling down an angled ramp or something similar?

Also, can you find the angle of the tangent line on a circle/disk at a given point, say the point of contact with another object?


Yes, there is a way to write a script like that, but how you write it will be entirely dependent on how obsessive you are about it being accurate. You will _probably_ want a PID controller, but I only know how to write a PI controller, and I've never _exactly_ done that before.

And yes, you _can_ do almost any trig you wish since algodoo is based off of coord plane. You just have to have enough data to complete the calculation.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Sun Jul 29, 2012 2:00 am
by Nxdt
What you suggested is entirely possible, you can read almost all information about an object with thyme, including normals and points of contact. You just need a big equation to work it all out.

The point of contact is e.pos and the normal of this contact is e.normal. You can read other stuff using readable, but I have forgotten how to do that.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Fri Sep 06, 2013 5:54 pm
by leroidangleterre
Hello everyone,

I'm quite new at scripting with Thyme, and I have a problem with the syntax. I am having fun with the "onCollide" function (which is cool, I also built a water source), and I would like to create sort of a "speed controller"; it would be an object (like a box, or a circle), and whatever object that would hit that box would have its speed set to a specific value.

My question is: how do you change the speed of the other object when a collision occurs?

I tried this:
Scene.addBox {
<code about the size, the color or the position of the box>
onCollide = (e)=>{e.other.vel:=[1, 0];}
};
and it doesn't work.

Obviously, I something is wrong in my code but the object is still loaded and collides with other objects (so it means the computer understands what I tell him to do, except it is not what I want it to do...)

If you know how to do that, it would be great! Thanks!

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Mon Nov 25, 2013 6:21 am
by Someone Else
leroidangleterre wrote:Hello everyone,

I'm quite new at scripting with Thyme, and I have a problem with the syntax. I am having fun with the "onCollide" function (which is cool, I also built a water source), and I would like to create sort of a "speed controller"; it would be an object (like a box, or a circle), and whatever object that would hit that box would have its speed set to a specific value.

My question is: how do you change the speed of the other object when a collision occurs?

I tried this:
Scene.addBox {
<code about the size, the color or the position of the box>
onCollide = (e)=>{e.other.vel:=[1, 0];}
};
and it doesn't work.

Obviously, I something is wrong in my code but the object is still loaded and collides with other objects (so it means the computer understands what I tell him to do, except it is not what I want it to do...)

If you know how to do that, it would be great! Thanks!


I think you're on the right track- try swapping the "=" and ":=".
Also, Scene.addBox is a function, so you need parentheses around its argument, which is itself surrounded by curly braces.

Thus, this untested code
Code: Select all
Scene.addBox({
    //commented code about the size, the color or the position of the box
    onCollide := (e)=>{e.other.vel = [1, 0]} //You also don't need a semicolon immediately before a right brace
})

should spawn a box that sets the velocity of anything that touches it to 1 meter per second to the right. Try increasing the values in the array- you may not even see this happen.

Thyme has two assignment operators, "=" and ":=". Generally, they work the same, but you have found one instance where they don't.

":=" is normally used for creating variables- it will always create a variable if one of the appropriate name doesn't exist in the exact location where the := exists- so, in spawning scripts, it is used to set inintial values of variables in the object being spawned.

"=" works similarly, but (to my experience- correct me if I'm wrong) seems to look around a little before creating variables. This is no problem when the variable already exists, but if you try to use "=" to set a value in an object in the process of being spawned, it will instead go to whatever's doing the spawning.

Thus, your script will not actually set any properties of the box being spawned, but instead mess with the thing spawning it.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Thu Feb 20, 2014 5:52 am
by stephane.savanah
Hi Grady,
Thanks for your hard work on the tutorial. I wonder if you add/clarify some information in it:
> How to Read and Write to files (I got some info already from Kilinich and e-boy on separate post, but it would be good to add to the Tute)
> Clarify how to save and edit code. I know how to pull down the console (~) and write code there, but I don't understand how to edit that code later. (Sorry if it's obvious and I missed it!)
Cheers...

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Wed Mar 26, 2014 5:39 am
by Someone Else
stephane.savanah wrote:Hi Grady,
Thanks for your hard work on the tutorial. I wonder if you add/clarify some information in it:
> How to Read and Write to files (I got some info already from Kilinich and e-boy on separate post, but it would be good to add to the Tute)
> Clarify how to save and edit code. I know how to pull down the console (~) and write code there, but I don't understand how to edit that code later. (Sorry if it's obvious and I missed it!)
Cheers...

As for messing with files, I can't help you there- I didn't even know Thyme could do that! Seems that I haven't touched Algodoo in entirely too long.
As for saving code, well, that's a little easier. So long as you prefix all your global variable names (i.e. those that you type into the console) with "scene.my." (i.e. scene.my.variable, scene.my.function), they will be saved with the scene. So, in a scene where you've defined "scene.my.variable = 5", you can come back at any time and type "scene.my.variable = 6" to change it.

Re: [Tutorial]Thyme Tutorial - With explanations at every step

PostPosted: Tue Apr 08, 2014 7:21 pm
by mitko99
Very useful man! Thank you!