Page 1 of 1

Change precedence of variable ranges

Posted: Wed Jul 20, 2011 2:04 am
by jrh5312
In the build gallery of http://image.weather.com/images/maps/fo ... map_wkpln_[period([0-1])][1-10;1]_3uswc_enus_600x405.jpg with
var words=["day","night"];
return words[arguments[0]];

Is there an easy way to sequence the function period before the variable [1-10;1] so that I receive

day1.jpg
night1.jpg
day2.jpg
night2.jpg
day3.jpg
night3.jpg
...
day10.jpg
night10.jpg

instead of the current output:

day1.jpg
day2.jpg
day3.jpg
...
day10.jpg

then
night1.jpg
night2.jpg
night3.jpg
...
night10.jpg

Thank you for your help!

Re: Change precedence of variable ranges

Posted: Wed Jul 20, 2011 1:16 pm
by Giorgio Maone
No, because order usually does not matter if you aim to download everything.
However you could try something like

Code: Select all

[period([0-39])][halve([$0])]
where period() would be

Code: Select all

return ["day", "night"][arguments[0] % 2]
and halve() would be

Code: Select all

return Math.floor(arguments[0] / 2);
Notice that [$n] is a backreference to the nth range expression.