oncollide .other / .geom / ....

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

oncollide .other / .geom / ....

Postby -wvdw- » Sun Jun 12, 2011 5:11 pm

hi!

i tried to find it, but i cant find it.

when do i have to use e.other, or e.geom, and what doe it means??
and what does the e. means?

thanks for helping!
-wvdw-
 
Posts: 5
Joined: Sun Jun 12, 2011 5:07 pm

Re: oncollide .other / .geom / ....

Postby electronicboy » Sun Jun 12, 2011 7:10 pm

e means event.

I have a post somewhere that explains what it all means, if I find it I will quote or link it.

----EDIT----
--------------
I cant find that post.

the layout for thyme commands thats affect variables:
e.<address>.<variable>


----adressing----
---------------------

This is a list of the "adresses" and what they do:

Other - used on geometry colisions (oncollide) - this is used to adress the OTHER object in a collision (not the one with the code on)

THIS - used on geometry collisions (oncollide) - this is used to adress THIS object (the object with the code on)

Geom - used in laser hits (onlaserhit) - this is used to adress the geometry in a laser collision

laser - used in laser hits (onlaserhit) - this is used to adress the laser in a laser collision

----object variables----
-----------------------------

The next part is to "address" to a variable.
To see these variable just create an object and look at the script menu ;)
Or check THIS POST of [Thyme][1.5.61]Thyme Command/Variables List
----examples----
--------------------

E.other.density = 5

this Means,
Set the density of the OTHER object (one without the code) to 5

If you need any more help with this, just ask, I or others may be willing to answer
Or even check
[Tutorial]Thyme Tutorial - With explanations at every step
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: oncollide .other / .geom / ....

Postby TC42 » Sun Jun 12, 2011 9:20 pm

Electronicboy, you forgot that sometimes you don't use an 'address', for example, density = 42; has the same meaning as e.this.density = 42;, or was that intentional...?

And also, notice that oncollide = (e)=>{} is a function (definition of a function: ()=>{}), and you can replace it with another function. For example, (a, b) => {a + b). If you called it with another object (using oncollide = scene.my.sum=e.other.oncollide( 5, 3)), scene.my.sum would return the sum of the two variables A and B, or in this case, 5 and 3 or 8.
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: oncollide .other / .geom / ....

Postby electronicboy » Sun Jun 12, 2011 11:49 pm

TC42 wrote:Electronicboy, you forgot that sometimes you don't use an 'address', for example, density = 42; has the same meaning as e.this.density = 42;, or was that intentional...?

It was fairly intentional... :D he was asking about the 'adresses' so i told him about them :D

I was writing on a mobile with is kinda horriable...
(which is why the 'ascii 'art'' proberbly sux...)
Also, i left links to topics that will give advice with thyme related to this and even more, which are somewhat good for beginners.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: oncollide .other / .geom / ....

Postby -wvdw- » Mon Jun 13, 2011 12:02 pm

electronicboy wrote:e means event.

I have a post somewhere that explains what it all means, if I find it I will quote or link it.

----EDIT----
--------------
I cant find that post.

the layout for thyme commands thats affect variables:
e.<address>.<variable>


----adressing----
---------------------

This is a list of the "adresses" and what they do:

Other - used on geometry colisions (oncollide) - this is used to adress the OTHER object in a collision (not the one with the code on)

THIS - used on geometry collisions (oncollide) - this is used to adress THIS object (the object with the code on)

Geom - used in laser hits (onlaserhit) - this is used to adress the geometry in a laser collision

laser - used in laser hits (onlaserhit) - this is used to adress the laser in a laser collision

----object variables----
-----------------------------

The next part is to "address" to a variable.
To see these variable just create an object and look at the script menu ;)
Or check THIS POST of [Thyme][1.5.61]Thyme Command/Variables List
----examples----
--------------------

E.other.density = 5

this Means,
Set the density of the OTHER object (one without the code) to 5

If you need any more help with this, just ask, I or others may be willing to answer
Or even check
[Tutorial]Thyme Tutorial - With explanations at every step



thanks! but i see people using thing like pos, scene, addpen, etc.
whats is that all:o
-wvdw-
 
Posts: 5
Joined: Sun Jun 12, 2011 5:07 pm

Re: oncollide .other / .geom / ....

Postby TC42 » Mon Jun 13, 2011 1:23 pm

Pos is exactly what it says--position. e.pos is the position property of an event. Scene is the operator that refers back to the scene that is open. Scene.my.insertvariablenamehere is a scene specific variable that is saved with the scene. You can use variables without the scene.my, but these are not saved with the scene. Scene.my variables are not saved when objects are saved as phunlets, so a phunlet with many scene.mys won't work unless you declare those variables in the console first, which is a pain in the ... you get the idea. The way around this is to use properties of objects to store values--controlleracc is almost always used to store values. Other properties of scene.my are add and loadscene. These do exactly what they say they do. If you read through the Thyme Commands and Variables list and some of the posts below it, you should find out what those do.
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 7 guests

cron