[Thyme][1.5.61]Thyme Command/Variables List

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

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby xplane80 » Sat Feb 06, 2010 1:11 pm

You can get the density of the object from e.geom/e.other .density
The Mass, I am not as sure. If you know the area of the object, then just multiply the area with the density and then you get the mass.
Image<- Designed by PhysicsGuy
User avatar
xplane80
 
Posts: 498
Joined: Mon Aug 31, 2009 7:28 pm

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby TimTheOne » Thu Feb 11, 2010 10:23 pm

xplane80 wrote:You can get the density of the object from e.geom/e.other .density
The Mass, I am not as sure. If you know the area of the object, then just multiply the area with the density and then you get the mass.


Yea i already knew the Density thing, however density is something else.

but how can you know the area? lol
TimTheOne
 
Posts: 40
Joined: Tue Jan 12, 2010 9:22 pm

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Thu Feb 11, 2010 11:34 pm

SizeX * SizeY = area. Though you can't access the sizes via e.other/geom.size :problem:
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby KarateBrot » Thu Feb 11, 2010 11:38 pm

Rideg wrote:SizeX * SizeY = area. Though you can't access the sizes via e.other/geom.size :problem:

Unfortunately it's not just x*y. That's just the area of a rectangle. If you have unreguar polygons you have difficult calculations to solve.
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Thu Feb 11, 2010 11:45 pm

forgot that srry :P , It's not impossible but then I think you would have to mutiply all the surfaces am I right??
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby KarateBrot » Thu Feb 11, 2010 11:52 pm

I don't know how they do it in algodoo. For geometries with an infinite amount of surfaces you have to integrate many parts and then add / substract them from each other so that in the end you get the overall area. With polygons like in algodoo with a finite amount I think you can use the trapezium algorithm. Because there can be so much surfaces it's only possible with a computer. To calculate it yourself would take forever :D
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby gradyfitz » Fri Feb 12, 2010 9:21 am

KarateBrot wrote:I don't know how they do it in algodoo. For geometries with an infinite amount of surfaces you have to integrate many parts and then add / substract them from each other so that in the end you get the overall area. With polygons like in algodoo with a finite amount I think you can use the trapezium algorithm. Because there can be so much surfaces it's only possible with a computer. To calculate it yourself would take forever :D

Overlap would be difficult to calculate i assume, but area of a single surface is a relatively straightforward function.

Code: Select all
Scene.my.For100In = (a, r, c)=>{
Scene.my.For10In(a,((r + 10) > (c + 10) ? {c + 10} : {c}),(c - (c % 10)));
((c + 10) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 10 + 10) ? {c + 20} : {c + 10}),(c + 10 - (c % 10)))} : {};
((c + 20) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 20 + 10) ? {c + 30} : {c + 20}),(c + 20 - (c % 10)))} : {};
((c + 30) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 30 + 10) ? {c + 40} : {c + 30}),(c + 30 - (c % 10)))} : {};
((c + 40) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 40 + 10) ? {c + 50} : {c + 40}),(c + 40 - (c % 10)))} : {};
((c + 50) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 50 + 10) ? {c + 60} : {c + 50}),(c + 50 - (c % 10)))} : {};
((c + 60) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 60 + 10) ? {c + 70} : {c + 60}),(c + 60 - (c % 10)))} : {};
((c + 70) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 70 + 10) ? {c + 80} : {c + 70}),(c + 70 - (c % 10)))} : {};
((c + 80) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 80 + 10) ? {c + 90} : {c + 80}),(c + 80 - (c % 10)))} : {};
((c + 90) < (r + 10)) ? {Scene.my.For10In(a,((r + 10) > (c + 90 + 10) ? {c + 100} : {c + 90}),(c + 90 - (c % 10)))} : {};
((c + 90) < (r + 10)) ? {Scene.my.For100In(a,r,(c + 100))} : {}};

Scene.my.For10In = (a, r, c)=>{
((c < r)) ? {a(c);} : {};
((c + 1) < r) ? {a(c + 1);} : {};
((c + 2) < r) ? {a(c + 2);} : {};
((c + 3) < r) ? {a(c + 3);} : {};
((c + 4) < r) ? {a(c + 4);} : {};
((c + 5) < r) ? {a(c + 5);} : {};
((c + 6) < r) ? {a(c + 6);} : {};
((c + 7) < r) ? {a(c + 7);} : {};
((c + 8) < r) ? {a(c + 8);} : {};
((c + 9) < r) ? {a(c + 9);} : {};
((c + 9) < r) ? {Scene.my.For10In (a,r,(c + 10))} : {}};

Scene.my.Pro02CheckSize = (name)=>{TEMParray := name ++ ["THISISTHEENDOFTHEARRAYHERE"];Found := false;Size := 0;Scene.my.For100In((x)=>{found ? {} : {(((TEMParray(x)) + "") == "THISISTHEENDOFTHEARRAYHERE" ? {Found = true} : {};Size = x}},(100),0);(Size - 1)};

Scene.my.Area = (aoxy)=>{Scene.my.AreaIn(aoxy,0,0.0,Scene.my.Pro02CheckSize(aoxy))};
Scene.my.AreaIn = (aoxy,c,a,s)=>{c <= s ? {Scene.my.AreaIn(aoxy,(c + 1),(a + (aoxy(c)(0) * ((aoxy((c + 1) % (s + 1))(1)) - (aoxy(((c - 1) < 0 ? (s) : (c-1)))(1))))),s)} : {a/2.0}};


Working out multi-surface polygon area is not particularly easy to do if you don't know which are negatives and which are positives, but if you do (I suppose it wouldn't be too difficult), it's not too hard to do, by just subtracting negatives and adding positives.
Mechanisms: 18 Mechanisms.
Thyme: Tutorial - Variables/Commands List.
Thymechanic
gradyfitz
 
Posts: 174
Joined: Tue Sep 01, 2009 8:33 am
Location: Victoria, Australia

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rrobba » Sun Apr 18, 2010 1:12 pm

Very helpful when it comes to my scripting and nice that you've listed everything together.
Image
I don't suffer from insanity. I enjoy every minute of it.
User avatar
Rrobba
[Best Sig 2010]
 
Posts: 1480
Joined: Mon Aug 31, 2009 6:01 pm
Location: Gibraltar

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby mbartelsm » Thu May 27, 2010 6:05 am

I need help, the tracers don't spawn
Code: Select all
(e)=>{
    scene.addcircle({
        radius := 0.06;
        density := 12;
        pos := e.pos;
        color := [1.0, 0.9763333, 0.29000002, 1.0];
        drawcake := false;
        attraction := -10000;
        collideset := 64;
        onhitbylaser := ((e)=>{attraction = 0})
    });
    scene.addpen({
        size := 0.11;
        color := [0.8580386, 0.8580386, 0.8580386, 0.175];
        fadetime := 1.0
    });
    scene.addpen({
        size := 0.1;
        color := [1.0, 0.8333333, 0.0, 0.735];
        fadetime := 0.4
    });
    scene.addpen({
        size := 0.09;
        color := [0.8580386, 0.8580386, 0.8580386, 0.37];
        fadetime := 0.6
    });
    scene.addpen({
        size := 0.08;
        color := [0.8580386, 0.14300644, 0.0, 0.682];
        fadetime := 0.1
    })
}
mbartelsm
 
Posts: 9
Joined: Tue May 25, 2010 2:57 am

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Matten » Thu May 27, 2010 3:38 pm

Maybe adding the pos will help?
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
User avatar
Matten
 
Posts: 435
Joined: Mon Apr 05, 2010 2:03 pm
Location: The Netherlands

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Fri Jun 04, 2010 9:47 pm

Code: Select all
(e)=>{
    scene.addcircle({
        radius := 0.06;
        density := 12;
        pos := e.pos;
        color := [1.0, 0.9763333, 0.29000002, 1.0];
        drawcake := false;
        attraction := -10000;
        collideset := 64;
        GeomID := 1;
        onhitbylaser := ((e)=>{attraction = 0})
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.11;
        color := [0.8580386, 0.8580386, 0.8580386, 0.175];
        fadetime := 1.0
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.1;
        color := [1.0, 0.8333333, 0.0, 0.735];
        fadetime := 0.4
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.09;
        color := [0.8580386, 0.8580386, 0.8580386, 0.37];
        fadetime := 0.6
    });
    scene.addpen({Geom := 1;relPoint := [0.0, 0.0];
        size := 0.08;
        color := [0.8580386, 0.14300644, 0.0, 0.682];
        fadetime := 0.1
    })
}
This will solve your problem. I never use pos, just grown to use to use geomIDs. ;)
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby xplane80 » Sat Jun 05, 2010 11:12 am

geomIDs are ok but for beginners, I would recommend using pos because it's easier to learn.
Image<- Designed by PhysicsGuy
User avatar
xplane80
 
Posts: 498
Joined: Mon Aug 31, 2009 7:28 pm

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Sat Jun 05, 2010 12:20 pm

It's not a big difference plus if you spawn a circle with a tracer inside an other object then the pen might stick to the object that wasn't spawned.
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Matten » Sat Jun 05, 2010 4:45 pm

Hmmm..
Maybe something to try, you can spawn hinges far away from the object, is this also possible with tracers?
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
User avatar
Matten
 
Posts: 435
Joined: Mon Apr 05, 2010 2:03 pm
Location: The Netherlands

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Sun Jun 06, 2010 2:09 am

nope ;) they always need to be on the object..
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Mon Jun 07, 2010 5:16 pm

Quick question: Is there a way to set custom default collision group for lasers? :?:

Like draw a laser with "g" as a collision group?
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby xplane80 » Mon Jun 07, 2010 5:30 pm

Same as you would with an object, set the collideset to whatever number is needed.
Image<- Designed by PhysicsGuy
User avatar
xplane80
 
Posts: 498
Joined: Mon Aug 31, 2009 7:28 pm

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Mon Jun 07, 2010 6:21 pm

No I mean is there a way to access the default collision groups through the console so when I draw a laser it will have 64 as a collision group.
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby xplane80 » Mon Jun 07, 2010 7:52 pm

no
Image<- Designed by PhysicsGuy
User avatar
xplane80
 
Posts: 498
Joined: Mon Aug 31, 2009 7:28 pm

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Mon Jun 07, 2010 7:54 pm

damn, Hope they can implement it ;)
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Matten » Mon Jun 07, 2010 8:15 pm

Good idea! You can change the deafault values and you can save the "defaults" just like the skins right now.
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
User avatar
Matten
 
Posts: 435
Joined: Mon Apr 05, 2010 2:03 pm
Location: The Netherlands

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Chronos » Mon Jun 07, 2010 8:36 pm

Or you can just stop being lazy and change it manually.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Matten » Mon Jun 07, 2010 9:22 pm

But I mean the defaults for when the scene is running. Example:
You made a machine and you need to input geoms with collideSet CE, it's not handy if everytime you make a new geom for the machine, you put it on the ground and change the collideSet. So if you make the default collision group CE, you can just work normal.
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
User avatar
Matten
 
Posts: 435
Joined: Mon Apr 05, 2010 2:03 pm
Location: The Netherlands

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Chronos » Mon Jun 07, 2010 9:46 pm

Chronos wrote:stop being lazy
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: [Thyme][1.5.61]Thyme Command/Variables List

Postby Rideg » Mon Jun 07, 2010 11:00 pm

I almost never use lasers with 127 as a collision group.
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

PreviousNext

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron