Random Songs On Start

By Bouncer on Mar 18, 2007

Using a piece of Snooop's coding in his Random Greet snippet that sets the variables for his random messaging I created this snippet to play a random song on start. I only coded it for three since I only had three songs I wanted it to choose from but more can easily be added. Simply replace the word filename with the title of the songs you want it to choose from.
Press alt+r and paste this into the remotes section of your Scripts Editor.
All comments are welcome.
P.S. I hope you don't mind that I used that piece of your coding Snooop. I will give you full credit for it in my script if you would like.

on *:START:{
  var %rander = $rand(1,3) 
  if (%rander == 1) {
    splay filename.mp3 
  }
  if (%rander == 2) {
    splay filename.mp3
  }
  if (%rander == 3) {
    splay filename.mp3
  }
}

Comments

Sign in to comment.
templar   -  Apr 21, 2007
on *:start: { 
    .splay $findfile(sounds,*,$rand(1,$findfile(sounds,*,0)))  
}
 Respond  
DarthReven   -  Mar 20, 2007

Agreed Acid a simple setting of a variable w/ $sdir would be best

 Respond  
Acid-Religion   -  Mar 18, 2007

It is also possible to allow the user to specify the music/mp3 directory, which I think would be the best way to do it...

 Respond  
RusselB   -  Mar 18, 2007

The same thing could be said about any drive or directory. It\'s possible (although unlikely) for someone to have no mp3 files on their system.

 Respond  
DarthReven   -  Mar 18, 2007

Cause we don\'t know if $+($mircdir,sound) has any files in it

 Respond  
Noutrious   -  Mar 18, 2007

Better not use what DarthReven said, replace C:\ with $mircdirsound - it would take more than 10 minutes to search all of my files in C:\ dir.

 Respond  
DarthReven   -  Mar 18, 2007

You can use this: \"on :start: { splay $findfile(C:\,.mp3,$r(1,$findfile(C:\,*.mp3,0))) }\" this will play a random mp3 file that resides on your C:\ Drive

 Respond  
Teh Maestro   -  Mar 18, 2007

Yeah pretty much, though I think it\'s be better to use /run [mp3], since that would open it with the users preferred program.

 Respond  
Bouncer   -  Mar 18, 2007

After studying it further I believe I fully understand what your code accomplishes and I see how it could cut down on lines of code. But one quick question. To make it work all they would have to do is literally title the songs in their mRIC folder song1.mp3, song2.mp3, song3.mp3 etc...?

 Respond  
Bouncer   -  Mar 18, 2007

Ty Teh Maestro but as I am self taught and still learning I only understand parts of the code you gave me and not all. But I appreciate the feedback and hope to submit better snippets that accomplish as much as possible with the least amount of code so please bear with me as I learn new ways to code. :P

 Respond  
Teh Maestro   -  Mar 18, 2007

A good way that would allow for someone to use even a list of a hundred .MP3s to choose from would be to name them in sequence like song1.mp3, song2.mp3, etc., and then doing something like:

on *:START:{
var %rander = $rand(1,100)
splay $+(song,%rander,.,mp3)
}

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.