Problems with box text

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

Problems with box text

Postby PlanckBanck » Wed Dec 30, 2009 4:23 pm

Can I define for example the Y-Coordinate of an existing object as variable for further usage? (for example for an altimeter or something)
Something Like
Code: Select all
e.this.pos = [pos1 = pos1, pos2 = scene.myheight]


Thanks for help
Last edited by PlanckBanck on Wed Dec 30, 2009 5:46 pm, edited 1 time in total.
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: defining property as variable

Postby Versieon » Wed Dec 30, 2009 5:18 pm

yes you can, the format would be this

Code: Select all
scene.my.myheight = e.pos(1)


if you want the x coordinate, it woulf be

Code: Select all
scene.my.myheight = e.pos(0)


e.pos is the coordinates of the object in a matrix , and the 0 and 1 at the end tell which value you want to use in that matrix.
Last edited by Versieon on Thu Dec 31, 2009 5:12 am, edited 2 times in total.
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: defining property as variable

Postby PlanckBanck » Wed Dec 30, 2009 5:46 pm

Thanks a lot but here`s another question^^:
I want a box to have scene.my.height as text, but when I put {scene.my.height} into the text field in the script menu without the "", it displays it as correct, but then erases it.
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Problems with box text

Postby Versieon » Wed Dec 30, 2009 5:48 pm

it would be like this

Code: Select all
{"" + scene.my.myheight}
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: Problems with box text

Postby PlanckBanck » Wed Dec 30, 2009 5:57 pm

wow thanks
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Problems with box text

Postby KarateBrot » Wed Dec 30, 2009 6:26 pm

I also made a little "How To" in the Calculate distance using laser topic:
viewtopic.php?f=13&t=1048#p10474

With it you can display the real height above the ground. If you do it just with one laser you only get the height above the absolute null level (the x-axis of algodoo's coordinate system).
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests