another script

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

another script

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

there might already be a post of this out i didnt check but to the point.
i know u can put varibles in objects but i dont know how to change or read them in another object is it. first i am wondering is it possible for another object to read it without touching it? second i am wondering can u change those object variables by touching them? i am working on a scene for a PHUNLET that needs a varable but it cant be a scene variable
crigger61
 
Posts: 5
Joined: Mon Oct 26, 2009 9:22 pm

Re: another script

Postby RicH » Wed Oct 28, 2009 12:03 pm

All of that's possible.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
User avatar
RicH
[Funniest Person 2010]
 
Posts: 2043
Joined: Tue Sep 01, 2009 9:01 am

Re: another script

Postby Mystery » Wed Oct 28, 2009 1:29 pm

For this example the variable will be test
To create an internal variable in that objects scripting menu in the bottom there is a black space type in
Code: Select all
test := 0

To create an internal variable.
To edit this oncollide treat this variable like any other variable oncollide
Code: Select all
e.other.test = 4

Do do this with out touching use a system variable unique to that geometry create a system variable by opening the console (~) And typing in
Code: Select all
Scene.my.test := 1
To edit this oncollide is a bit different
Code: Select all
Scene.my.test = scene.my.test - 5

To make the internal variable equal to the external variable in the oncollide on the object type in
Code: Select all
e.this.test = scene.my.test

To make the external variable the same as the internal reverse the code
Code: Select all
scene.my.test = e.this.test

To do this with them touching each other
Code: Select all
e.this.test = e.other.test


If you have a phunlet that requires an external variable It is best not to use internal variable as an alternative instead create the external variable oncollide Like so
Code: Select all
scene.my.test := 1

As soon as the scene starts now scene.my.test will be created. This will generate error codes if it is hit more then once.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests

cron