|
ColorMover
About Truespace Archives
These pages are a copy of the official truespace forums prior to their removal somewhere around 2011.
They are retained here for archive purposes only.
ColorMover // Scriptorium
Post by Wigand // Nov 5, 2006, 11:08am
Wigand
Total Posts: 462
|
Just a small script.
If you move the sphere around, its color changes. "Player Mode" |
Post by trueBlue // Nov 5, 2006, 9:15pm
trueBlue
Total Posts: 1761
|
Very nice Wigland!
Not sure if you know this or not but the Scriptorum is hidden from the Community fourm. So if you wanted to share this with all tS7 users you could post your script there too if you wish. |
Post by Wigand // Nov 6, 2006, 1:17am
Wigand
Total Posts: 462
|
Very nice Wigland!
Not sure if you know this or not but the Scriptorum is hidden from the Community fourm. So if you wanted to share this with all tS7 users you could post your script there too if you wish.
Yes, I know. Maybe, I put it into the open forum.
But first, I thought I could get some critics or suggestions here. ;-)
I had some problems and questions with this script:
First, I tried to use an array for the color datas with no effort.
Is it the right way to manipulate the color of an object?
What is the right number-format of the RGBs, (I found several answers)? |
Post by Norm // Nov 6, 2006, 8:04am
Norm
Total Posts: 862
|
Color is between 0 and 1. So should be type "number".
I approached the scenario by creating a torus and painting it over on Model side with a plain transparency.
When I enter the object, down into Material Chunk, 1 object, here is what I found. So I exported DiffuseColor, Transparency and VertexColorStrength (no use ... yet, but could be adjusted). I exported these three items all the way to top level, where script can be hooked up. I attach script as well, to show how I generated some numbers and hooked it all in.
Trans is set for z value.
Using sine values and absolute math function to keep values within acceptable parameters.
Hope is helpful. |
Post by Wigand // Nov 6, 2006, 8:42am
Wigand
Total Posts: 462
|
Just looked at your script..
I think I understand it. But I really hoped, that it would be possible to
give an array directly to a function like:
dim arr(3)
arr(0)=1
arr(1)=2
arr(2)=3
arr(3)=4
a=function(arr()) |
Post by Norm // Nov 8, 2006, 12:09pm
Norm
Total Posts: 862
|
Just looked at your script..
I think I understand it. But I really hoped, that it would be possible to
give an array directly to a function like:
dim arr(3)
arr(0)=1
arr(1)=2
arr(2)=3
arr(3)=4
a=function(arr())
You would not require arr(), just use arr
Otherwise you are sending along empty container right? |
Post by Wigand // Nov 9, 2006, 4:27am
Wigand
Total Posts: 462
|
Yes you are right. :o I tried to send an array to a function, calculate something and return the result. It'all ok. then I tried to send an array from
one LE-Object to an other LE-Object. It do not work. I gave the input
and the output the "array" format. Do you need an example? |
Post by Norm // Nov 9, 2006, 12:58pm
Norm
Total Posts: 862
|
Yes you are right. :o I tried to send an array to a function, calculate something and return the result. It'all ok. then I tried to send an array from
one LE-Object to an other LE-Object. It do not work. I gave the input
and the output the "array" format. Do you need an example?
No need for example Wigand. I know it can not be done in ts7.11, but I am testing this feature in ts7.5 and it works ok. That is about all I could say at moment. I tried in vain to get same type scenario to work right long ago.
It is possible though perhaps, to instead of pass the values, to simply populate say an export connector with an array then call that export connector and access the array data. That could be a workaround for ts7.11. I would not imagine much extra code is involved, just some experimenting. |
|