Changing Selected Object's Properties

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

Changing Selected Object's Properties

Postby phunHunger » Tue Apr 26, 2011 1:42 pm

Is it possible to change the currently selected object's properties with thyme?

If it is, hotkeys could be used to change an objects collideSet to 0 or an objects friction to 0 at the press of a button instead of going through the menus every time.
Noobs are the best ;)
User avatar
phunHunger
 
Posts: 31
Joined: Mon Apr 26, 2010 10:01 pm

Re: Changing Selected Object's Properties

Postby Someone Else » Tue Apr 26, 2011 7:42 pm

I don't think that's possible, but it certainly would be useful.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Changing Selected Object's Properties

Postby mold999 » Tue Apr 26, 2011 9:57 pm

Ok, let me get this straight :

:arrow: You want to be able to change the properties of an object with thyme
:arrow: You want to be able to use a key to do that

Ok, both are possible, if I understand you correctly.

:arrow: If you want to change the properties with thyme, then open the console, using F11 or tilde(~)
:arrow: Type the name of some scene.my.* variable. If you don't know what this is, it is basically just a variable in the form "scene.my.variable". It does not need to be called "variable", it can be anything from "pig" to "Switzerland".
:arrow: Then, type a value. it can be a number (which is known as an "integer", although it can be a decimal), a string (something like, [1, 5]), a boolean (true or false), or (crap, I can't remember the last one!).
:arrow: So, it should look something like this :

scene.my.pig = 4

:arrow: Now, go to the script menu of the object you want to alter
:arrow: Say you want to change density. In the density box of the object, type

{scene.my.pig}

MAKE SURE TO ADD THE CURLY BRACKETS!

:arrow: Now, this makes the density of the object 4, in this case
:arrow: Return to the console. now type "keys.bind("chose your letter",{your variable here = whatever your new value is})"

It should look like this :

keys.bind("f",{scene.my.pig = 10})

Now, when you press "f", it changes the density to 10.

I hope this helped!

I hope I didn't forget more then the last name of the value...

On an unrelated note, how does "[*]" and "[/*]" work? I know they make the arrows, but I can't get them to work.
Phundementalism?

Ain't nobody got
thyme fo dat.
User avatar
mold999
 
Posts: 225
Joined: Sun Jan 02, 2011 1:35 am
Location: [176436, 3763234]

Re: Changing Selected Object's Properties

Postby phunHunger » Tue Apr 26, 2011 10:19 pm

I understand what you're saying but I was wondering if there was a preset, global variable for the currently selected/highlighted object as in...

Selected.collideSet = 0

and so forth.

Selected being the object that you have just clicked on and have highlighted.
Noobs are the best ;)
User avatar
phunHunger
 
Posts: 31
Joined: Mon Apr 26, 2010 10:01 pm

Re: Changing Selected Object's Properties

Postby electronicboy » Tue Apr 26, 2011 10:55 pm

nope, there is no way of adressing a selected object.

Well, none that i've heard of?
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Changing Selected Object's Properties

Postby bozbez » Tue Apr 26, 2011 11:54 pm

mold999 wrote::arrow: Then, type a value. it can be a number (which is known as an "integer", although it can be a decimal), a string (something like, [1, 5]), a boolean (true or false), or (crap, I can't remember the last one!).

That sentence generally failed :)
I rewrite it for ya:
:arrow: Then, type a value. It can be a number of two sorts; an integer (45), or a float (45.57), it could be an array ([2,4,6,4]), it could be a string ("blablabla"), a Boolean (true), or a function ({sim.time < 10 ? 56 : 69}).

An improvement, I think, although it could be clearer :/ .
Image

Go here. Now. That's Now. Not in 5 minutes. Now.
User avatar
bozbez
 
Posts: 149
Joined: Tue Apr 12, 2011 7:01 pm

Re: Changing Selected Object's Properties

Postby Someone Else » Wed Apr 27, 2011 7:27 am

I think the proper syntax would be this:
Code: Select all
scene.selected.collideSet = 4
keys.bind("f", scene.selected.collideSet = 4)

Also, the [/*] is a lie. Just use [*] and it will work. But only in [list ]here.[/list] And remove the space in the {list}. I just added that so it wouldn't turn into
    this.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: Changing Selected Object's Properties

Postby bozbez » Wed Apr 27, 2011 5:10 pm

or scene.focus...
Image

Go here. Now. That's Now. Not in 5 minutes. Now.
User avatar
bozbez
 
Posts: 149
Joined: Tue Apr 12, 2011 7:01 pm

Re: Changing Selected Object's Properties

Postby Someone Else » Wed Apr 27, 2011 5:32 pm

Or that. It doesn't much matter to me. Just depends on what Emil thinks...
But I do think that scene.something is the right scope.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest