Ambrosia Garden Archive
    • Jukebox


      Hi,

      I was wondering if anyone has made a good system for playing random music scores? You know like, you have five scores and it plays a random one after the last one ended. Is this even possible?

      Thanks

      This post has been edited by Ledorax : 03 October 2004 - 03:37 PM

    • Yes, here's the event:

      Set a global to a random number 1-5;
      If global = 1, play some song (NOTE: You have to use play sound and have it play the whole thing before proceeding);
      If global = 2, play some other song;
      If global = 3, play some other song;
      If global = 4, play some other song;
      If global = 5, play some other song;
      Have this event call itself (recursion, sort of...);

      That should work, though I haven't tested it.

    • 0 is also a number when you set a random global. So add

      If global = 0, play some song

      At the BEGINNING of the event, however, you need to Set Globals

      gb_random set to 0

      Then do the conditional array below. It will work.

      (edit) I'm not sure you need to play sound. If you play through the entire thing before proceeding, everything will stop until it does. It should work on music just fine.

    • Doesn't work, I'll just have to put all scores into one.

      Thanks for trying, anyway :blink:

    • I use random global quite a lot. It works quite well this way. It does not make sense that it will not work for you. I hope you can figure out what's wrong with your array.

    • The global works, it's just that it repeats the same song over and over again. In the beginning, it chooses a random one, but after it is done playing, it doesn't choose a new one.

    • add another event: jukebox02
      In that event, call your original event.

      At the end of your original event, call jukebox02

      round and round she goes!

      Humm, this might happen so fast that it will not work properly for you though. You could try the Wait feature, but that might make everything wait. If it doesn't work, you might want to try placing your music in an animation. Just make a white image.

      Or, better yet, use Stray's timer array. So the call to jukebox02 would be timed via a conditional. You can do with conditionals for every music score you call. Just make a global for every music score. When the timer reaches the end of the time of the music score, call jukebox02. Just make sure you reset your music score global to 0.

    • Debra, I don't think you can have an event wait for a song...

      Leddy, try using a sound instead of music. Also make sure you set the global to a random number at the beginning as Debra and I mentioned.

      P.S. Can't you have recursion with CS where an event calls itself?
      P.P.S. I think using waits and timers would probably eat up waaaay too many resources for just playing some music... Then again, if it's really important. 😉

    • CI-Ia0s, on Oct 4 2004, 08:31 PM, said:

      Debra, I don't think you can have an event wait for a song...

      Sure it will. There's a wait feature in the event box. I use it twice so far within an event. Once, I fade out, wait, then fade back in to indicate a passage of time. I use it again to place a series of items or stamps one after the other, so I use wait in between each one. You could use wait in an event before you call another event.

      However ........

      If I were to do a jukebox sort of thing, I would place the play music as another event. As part of that, then, I'd place a timer in the event to determine when to call jukebox, as long as the music. With the timer, via a conditional, I'd call jukebox at the end of the event instead of calling jukebox2. (There would be no jukebox2 as there would be no need now for jukebox2.) The global random in the jukebox event would then call the music events. And I might have to place the music in sound if needed, and then NOT have a timer.

    • Using Wait stops the game, and I meant by checking a little box in the "Play Music" panel. In the "Play Sound" panel, you just check a box and it'll wait till the sound is done before continuing on with the event.