From: James C. W. <jfc...@ya...> - 2011-06-28 18:22:13
|
Thanks! I'm afraid I don't know what an array is, however...Could you explain if possible? Thanks, James From: Urs Holzer <ur...@an...> To: pip...@li... Sent: Tuesday, June 28, 2011 6:11 AM Subject: Re: Randomizing from a list of variables Hi James James C. Wilson wrote: > I don't suppose there's a way to randomly reference a variable, is > there? Suppose I had four sounds, each preloaded into a local > variable, perhaps named "local sound_1", local sound_2", etc, and > wanted to play one of them at random every six seconds? I can do this > by loading straight from the hard drive, but I'd like to be able to do > it via locals, if possible. Put them into an array instead. Say, the first sound in sound[1], the second one in sound[2] and so on. Then generate a random number, like that: rand = math.random[sound.maxn] Then you can use sound[rand] to get the sound you want to play. I hope this is what you need. Greetings Urs ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Pipmak-Users mailing list Pip...@li... news://news.gmane.org/gmane.games.devel.pipmak.user https://lists.sourceforge.net/lists/listinfo/pipmak-users |