Thyme event values

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

Thyme event values

Postby FRA32 » Sun Aug 05, 2018 2:39 pm

I've been taking a look at the exact contents of the (e) value in each event, to see how many additional values besides e.this etc. existed. Here is a list of all values I found (e.this, e.other, e.geom and e.laser are left out)

Poststep:
float dt - The elapsed time since the last scene frame

Update:
float dt - The elapsed time since the last update;

OnCollide:
array normal: The collision normal
array pos: The point of collision
float soundGain: Appears to scale with collision impact force.

onClick:
array pos: Position of the cursor
int clickCount: how many clicks have occured in short succession
bool handled: still unsure about this


OnKey:
bool pressed: True when a key was pressed, false when released
string keyCode: The name of the key being held
string keyChar: The text symbol created by the key(If no symbol exists, i.e. arrow keys, this value does not exist either)
bool handled: Unsure about this

OnLaserHit:
array normal: normal of the hit surface
array pos: Point of hit

OnHitByLaser: Identical to above

OnDie: No additional values

OnSpawn: No additional values
FRA32
 
Posts: 227
Joined: Wed Dec 03, 2014 9:51 pm

Re: Thyme event values

Postby Xray » Thu Aug 09, 2018 6:57 am

Thanks, FRA32, for that list of event values! I already was familiar with many of them, but there are some new ones which might be very useful in a future project. I plan to experiment with them. :geek:

I am curious as to how you "found" those values. Did you reverse-engineer one of the Algodoo files?

Thanks again for your helpful information! :thumbup:
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Thyme event values

Postby FRA32 » Thu Aug 09, 2018 9:17 pm

I found those out while thinking about the algodoo "class" type, which is what algodoo complains about if you try making var={val1=x,val2=y} variables, which algodoo can't cast into classes. I wanted to see how exactly this looks like in existing classes, so I did scene.my.text = ""+e on all events and then displayed that, thus allowing me to see the exact structure and content without it being interpreted by thyme, which would cause it to error away(as you might know from storing entityByGeomId's in vars).
FRA32
 
Posts: 227
Joined: Wed Dec 03, 2014 9:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron