list with repeats spaced apart

Mark Smith mark at maseurope.net
Thu Jul 14 05:27:01 EDT 2005


Untested, and probably rather slow on very long lists:

sourceList would be a list such as the example you gave.

function makePlayList sourceList
   repeat until sourceList is empty
     put random(the number of lines in sourceList) into nextLine
     put word 1 of line nextLine of sourceList & cr after playList
     subtract 1 from word -1 of line nextLine of sourceList
     if word -1 of line nextLine of sourceList = 0 then delete line 
nextLine of sourceList
   end repeat
   return char 1 to -2 of playlist
end makePlayList



cheers,

Mark

On 14 Jul 2005, at 10:00, sims wrote:

> I am stumped...argh.
>
> I have a list of short movie files, the movies are to be played in 
> rotation.
>
> Each movie followed by a tab and then a number. The number is the 
> number of
> times it is to be placed (repeated) in the list (shown in a rotation).
>
> 0099ts2729bs.mov 5
> 0085ts1316bs.mov 1
> 0091ts0918bs.mov 2
> 0077ts0913bs.mov 1
> 0032ts2930bs.mov 3
> 0089ts2126bs.mov 1
> 0075ts0919bl.mov 1
> 0076ts0919br.mov 4
> 0001ts0313bs.mov 1
>
>
> The real list will probably be close to 100 different movies, I am 
> using
> the list shown above as an example. Each movie will be played somewhere
> between 1 to 5 times in the rotation.
>
> Ideally I would like to have all repeated movies separated as much as 
> possible
> so they do not play (repeat) too closely in the rotation. In other 
> words it would
> be nice if repeated movies are spaced as far apart as possible.
>
> I need a script which will take such a list as shown above and then
> provide me with a rotation list as described.
>
> Any ideas on how to do this?
>
> ciao & thanks,
> sims
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list