Changing single array value

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

Changing single array value

Postby SyntaxError » Sun May 01, 2011 10:22 pm

I've tried to change a single value of an array like this:

Code: Select all
scene.my.sample_array = [1,1,1,1];
scene.my.sample_array(1) = 0;


Did not work.

I know instead I could type:

Code: Select all
scene.my.sample_array = [1,0,1,1]


But with an array 50 values long this takes time.


So isn't there a shorter way?
User avatar
SyntaxError
 
Posts: 11
Joined: Sat Apr 30, 2011 9:00 pm

Re: Changing single array value

Postby TC42 » Sun May 01, 2011 11:08 pm

No.
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: Changing single array value

Postby bozbez » Sun May 01, 2011 11:23 pm

The first one should work?!
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 single array value

Postby Someone Else » Sun May 01, 2011 11:42 pm

Here, Grady tries to explain the closest thing possible to what you want.
Or, maybe you want something more like:
Code: Select all
scene.my.sampleArray = [scene.my.sampleArray0, scene.my.sampleArray1, scene.my.sampleArray2, scene.my.sampleArray3]


But I support the suggestion!
color(3) = 0
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 single array value

Postby SyntaxError » Mon May 02, 2011 3:26 pm

Here, Grady tries to explain the closest thing possible to what you want.


:wtf:

Thats pretty complicated. I would have started to try this myself.... Maybe for hours :crazy: - so thx!

I don't have to understand it, if I know how to use it.

Every single programming language is able to handle this problem in a simple way.... but thyme :?:
User avatar
SyntaxError
 
Posts: 11
Joined: Sat Apr 30, 2011 9:00 pm

Re: Changing single array value

Postby hiltropper » Mon May 02, 2011 5:08 pm

color(3)=0
is not possible. you must type in the whole array, even when it looks like
color=[color(0),color(1),color(2),0]
then
(what is the same as color(3)=0)
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: Changing single array value

Postby Someone Else » Tue May 03, 2011 2:27 pm

As I said, I support the suggestion!
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 single array value

Postby hiltropper » Tue May 03, 2011 10:24 pm

do you mean for upcoming versions?
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: Changing single array value

Postby Someone Else » Thu May 05, 2011 4:07 pm

That's the only place a suggestion can actually happen, isn't it?
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 single array value

Postby hiltropper » Thu May 05, 2011 11:07 pm

i was confused because thats not the suggestion forum
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany

Re: Changing single array value

Postby Someone Else » Thu May 05, 2011 11:42 pm

When somebody asks how to do something that is impossible, I always like to turn that topic into a suggestion, as you have just seen.
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 single array value

Postby hiltropper » Fri May 06, 2011 3:58 pm

nice idea
yup yup
yuuuuuuup
yupyupyupyupyupyupyupyupyyyuuuup
hm... signatures...
hiltropper
 
Posts: 85
Joined: Mon Dec 20, 2010 12:02 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests