How can I create objects and modify them via script?
Hi,
I'd like to do the following:
1) create some objects, like e.g. points at random positions (possibly a few tens of them)
2) change their properties individually via scripting. For instance when a button is pushed the position and color of each object is changed.
I tried with lists of objects, but changing the properties of an item individually does not seem to be possible. That is, I can change the color of all the items to the same new color, but that's not what I want.
Instinctively I'd think of arrays, but I'm not sure of how I could use arrays in ggb scripts.
The only solution I can think of now is
1) manually introduce the points A, B, C, etc
2) write a very long list of instruction that go like "change the properties of A; change the properties of B; ...". That's very cumbersome, though, because the number of object is fixed and I cannot use a for cycle.
Is there a way of using a for cycle for changing the properties of many objects? Is it possible to create the objects from a script (like in ggbOnInit) ?
How should I go about this?
Thanks a lot for your help
Wait, maybe I got it.
Should I use the "Execute" command?
Ok, now I think I really got it.
I think that using javascript as in the example here will get me where I want.
This code in button 1 will create some points
This other code in button 2 changes their properties individuallyI'd still like to know whether it's possible to do the same with ggbscript.
Try with Execute(<generated string-list>)
.
.
Comments have been locked on this page!