Big Script

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

Big Script

Postby crigger61 » Mon Oct 26, 2009 9:31 pm

i am a basic thyme scripter and dont even know if this is possable but i want a script that says if the object the script is in collides with another object it will stick no matter what and i mean glue together not magnatism
crigger61
 
Posts: 5
Joined: Mon Oct 26, 2009 9:22 pm

Re: Big Script

Postby Sniperkasa » Mon Oct 26, 2009 9:49 pm

It is possbile.. but you need to have globalID if i remember right.. wait for gradyfitz or some thyme god to reply :D
But it should be possible.
If you have a question, have a dollar and call somebody that cares.
No really just PM me if you have a problem :)
User avatar
Sniperkasa
 
Posts: 493
Joined: Tue Sep 01, 2009 5:34 pm
Location: The bottom of a lake.

Re: Big Script

Postby niffirg1 » Mon Oct 26, 2009 10:18 pm

Fairly easy use New Method to figure the geomID of the first oject and the GeomID of the second then you do this code
Code: Select all
scene.addfixjoint ({geom0 := (GeomID of the first); Geom1 := (GeomID of Second); World0pos := e.pos})
That will spawn a fixate and will stick the two objects together.
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: Big Script

Postby RA2lover » Mon Oct 26, 2009 10:50 pm

that would need 2 collisions, right?
Jrv wrote:
TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.


GTFO newfgt
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: Big Script

Postby crigger61 » Tue Oct 27, 2009 12:06 am

i get what ur saying but i mean an object that hits any not a certain object it will glue to and could keep doing this untill no more area will collide
crigger61
 
Posts: 5
Joined: Mon Oct 26, 2009 9:22 pm

Re: Big Script

Postby niffirg1 » Tue Oct 27, 2009 12:10 am

Uhmm hmm......... you would need to use a custom variable and have like an invisible circle around the object you wanted to glue that reads the GeomID of an object before it hits the object you want and that invisible circle puts that GeomID into the custom Variable and then you use that custom variable instead of the Geom1 thing in the code. Just an Idea i haven't a clue if it works. I will upload a picture of what i said on second
User avatar
niffirg1
 
Posts: 376
Joined: Mon Aug 31, 2009 10:31 pm
Location: The Great American South!

Re: Big Script

Postby Versieon » Tue Oct 27, 2009 1:58 am

Yes, you need the geomId of both things, but only works with spawning unless you use the New Method.

Heres a scene using spawning. it does what you are saying, but only with spawned objects.

Rating: rated 5.6
Filesize: 4.97 kB
Comments: 2
Ratings: 2
download
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: Big Script

Postby gradyfitz » Tue Oct 27, 2009 8:38 am

crigger61 wrote:i am a basic thyme scripter and dont even know if this is possable but i want a script that says if the object the script is in collides with another object it will stick no matter what and i mean glue together not magnatism

The script:
Code: Select all
(e)=>{e.this.geomID = 1; e.other.geomID = 2; App.step;App.undo;Scene.addFixjoint {geom0 = e.other.geomID;geom1 = e.this.geomID;};e.this.onCollide = (e)=>{}}

Is that what you want? It uses New Method :D. Place this code in the object you want to stick to the other objects.

Hopefully it helps :D .
Mechanisms: 18 Mechanisms.
Thyme: Tutorial - Variables/Commands List.
Thymechanic
gradyfitz
 
Posts: 174
Joined: Tue Sep 01, 2009 8:33 am
Location: Victoria, Australia

Re: Big Script

Postby crigger61 » Tue Oct 27, 2009 10:07 pm

gradyfitz wrote:
crigger61 wrote:i am a basic thyme scripter and dont even know if this is possable but i want a script that says if the object the script is in collides with another object it will stick no matter what and i mean glue together not magnatism

The script:
Code: Select all
(e)=>{e.this.geomID = 1; e.other.geomID = 2; App.step;App.undo;Scene.addFixjoint {geom0 = e.other.geomID;geom1 = e.this.geomID;};e.this.onCollide = (e)=>{}}

Is that what you want? It uses New Method :D. Place this code in the object you want to stick to the other objects.

Hopefully it helps :D .


that actually works well i just would want one more thing. could it be possable to make it keep on sticking to more and more objects without having to reput the script in every time?
crigger61
 
Posts: 5
Joined: Mon Oct 26, 2009 9:22 pm

Re: Big Script

Postby KarateBrot » Tue Oct 27, 2009 10:16 pm

crigger61 wrote:that actually works well i just would want one more thing. could it be possable to make it keep on sticking to more and more objects without having to reput the script in every time?


You just have to delete "e.this.OnCollide = (e) => { }"
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany

Re: Big Script

Postby crigger61 » Wed Oct 28, 2009 7:13 am

thanks that helped
crigger61
 
Posts: 5
Joined: Mon Oct 26, 2009 9:22 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests

cron