Page 1 of 1

oncollide .other / .geom / ....

PostPosted: Sun Jun 12, 2011 5:11 pm
by -wvdw-
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!

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

PostPosted: Sun Jun 12, 2011 7:10 pm
by electronicboy
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

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

PostPosted: Sun Jun 12, 2011 9:20 pm
by TC42
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.

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

PostPosted: Sun Jun 12, 2011 11:49 pm
by electronicboy
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.

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

PostPosted: Mon Jun 13, 2011 12:02 pm
by -wvdw-
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

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

PostPosted: Mon Jun 13, 2011 1:23 pm
by TC42
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.