btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2017
08:21 PM
Pass variable to translation
Trying to pass a calculated value in a variable to the transition of a rectangle. I have something like the following
The above will not work, nothing shows up and I suspect it has to do with the "" that are absent around the array. I can't seem to get the quotations or [] to work. Always get an error or warning. Is there a special way to pass a variable in array format?
y=250
for i=0 to 5 step 1
y=y+100
x=0
m.bground.translation="[x,y]"
end for
The above will not work, nothing shows up and I suspect it has to do with the "" that are absent around the array. I can't seem to get the quotations or [] to work. Always get an error or warning. Is there a special way to pass a variable in array format?
3 REPLIES 3

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2017
09:42 PM
Re: Pass variable to translation
Not sure how your background system works, but passing a variable should be straightforward, just consider the variable IS what it stands for, in this case, an integer.
You wouldn't put quotation marks in there or else you're creating a string.
But what is m.bground.translation? Is it already an array with two elements that you simply want to redefine here?
In your example, the For loop is pointless, since it will just run six times. You might as well simply set
m.bground.translation=[0, 850]
since that's all you end up with anyway. So I suspect what you have going on and what you really want to do is not set up right way.
m.bground.translation=[x,y]
You wouldn't put quotation marks in there or else you're creating a string.
But what is m.bground.translation? Is it already an array with two elements that you simply want to redefine here?
In your example, the For loop is pointless, since it will just run six times. You might as well simply set
m.bground.translation=[0, 850]
since that's all you end up with anyway. So I suspect what you have going on and what you really want to do is not set up right way.
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2017
01:42 AM
Re: Pass variable to translation
"Komag" wrote:
You wouldn't put quotation marks in there or else you're creating a string.
But what is m.bground.translation? Is it already an array with two elements that you simply want to redefine here?
He's probably doing RSG. All visual Nodes descend from Group and as such have a .translation property.
The quoting confusion is understandable because when describing scene in XML, properties have to be spec'd in quoted like so
<blah deblah='7' translation="[0, 0]"/>
Numbers are strings, arrays are strings, dictionaries... everybody is a string! Yes, XML sucks. Now that we got that of the way - after a scene is loaded in memory, the node field values are proper data (no more quotes!). If you think assigning a wrong type (string) to a field of type array would cause an error, then you sir clearly don't know RSG 😛 - it is silent but deadly.
In your example, the For loop is pointless, since it will just run six times. You might as well simply set
m.bground.translation=[0, 850]
since that's all you end up with anyway. So I suspect what you have going on and what you really want to do is not set up right way.
Quite. To do RSG animations, one has to use sdkdoc/Animation+Markup
btpoole
Channel Surfer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2017
04:50 AM
Re: Pass variable to translation
Thanks for both looking over. The m.bground is a rectangle. I am attempting to draw stripes across the screen to make a markupgrid area look different from just a black backgroud. I guess I could create 5 different rectangles using 5 diffent translations.
Unless there is a way to set a background color of a markupgrid.
Unless there is a way to set a background color of a markupgrid.