mIRC Homepage
Posted By: yamaz Random sound and sound browser - 21/08/04 07:10 PM
Hi there,
I always use sound requests with my friends, and I like to have a command that requests a RANDOM sound among the wavs on the sound directory. How can I do?

And how could I do to have a visual "browser" for the sounds? They are more than 600 and it's difficult to remember them and uncomfortable to let the directory open.

Thanks a lot
Posted By: Zyzzyx26 Re: Random sound and sound browser - 21/08/04 08:07 PM
Usage is: /listsounds
It should open a dialog with all your .wav files listed. (Untested)
Code:
alias ListSounds {
 var %i = $findfile([color:green]"c:\directory of files"[/color],*.wav,0)
 while (%i) {
  hadd -m SoundList $nopath($findfile([color:green]"c:\directory of files"[/color],*.wav,%i))
  dec %i
 }
 dialog -m Sounds Sounds
}
on *:DIALOG:Sounds:init:*: {
  var %x = $hget(SoundList,0).item
  while (%x) { 
   did -a Sounds 1 $hget(SoundList,%x).item $hget(SoundList,%x).data
   dec %x
  }
  hfree SoundList
}
dialog Sounds {
  title "Sounds"
  size -1 -1 167 170
  option dbu notheme
  list 1, 4 4 159 149, vsbar size sort
  button "Close", 2, 128 156 32 12, ok
}
You must just replace with the correct directory of the wavs

I am not sure I got the random request matter straight. I understood that you wanted to send a random .wav file when someone request it.. so the code that follows should do that.
Code:
on *:TEXT:[color:blue]!random sound*[/color]:[color:red]#[/color]: {
 var %y = $findfile([color:green]"c:\directory of files"[/color],*.wav,0)
 dcc send $nick $findfile([color:green]"c:\directory of files"[/color],*.wav,$rand(1,%y))
} 
Replace with the correct directory of the wavs. You can also change the trigger command and the channel (specific chan or all).

I hope these work smile

Zyzzyx.

Note: I edited the code because it had a little mistake. You should copy the code that has this message under it!
Posted By: yamaz Re: Random sound and sound browser - 21/08/04 08:42 PM
thanks A LOT but how can I do to double click the sound on the list and make it request?

and: I didnt want to play a random sound on a request, I'd need a command that requests a random sound to another user.

Example: I type /randomsound in the "john" query window and it sends a request of a random sound in the sound directory to john
Posted By: Zyzzyx26 Re: Random sound and sound browser - 21/08/04 08:47 PM
Hmm.. wierd, works without messages here. Try running it again and see if it appears then smile
Posted By: yamaz Re: Random sound and sound browser - 21/08/04 08:50 PM
I edited the message above smile Read it now please
Posted By: Zyzzyx26 Re: Random sound and sound browser - 21/08/04 08:58 PM
You lost me on the request thing. :P These sounds that are listed in the dialog are the ones inside your computer. You cannot list the songs that are on someone else's HD.

" I type /randomsound in the "john" query window and it sends a request of a random sound in the sound directory to john" - When you say 'sends a request in the directory to John', you mean you want to GET a wav FROM John? Or SEND a wav TO him?

Same question goes for the double click thing? You want to SEND or GET?

BTW, if you want to get that song, it would require for the other person so send it to you. You can't simply download it from someone without their knowledge.
Posted By: yamaz Re: Random sound and sound browser - 21/08/04 09:15 PM
it's to send a request to make play the sound I want on John's OC smile john is supposed to have exactly the same sounds as me smile

The sound are just stupid quotes from movies and stuff like that......it's just for fun
Posted By: Zyzzyx26 Re: Random sound and sound browser - 21/08/04 09:36 PM
Oh, I see now.. smile Try this:
Code:
alias ListSounds {
 var %i = $findfile([color:red]"c:\directory of files"[/color],*.wav,0)
 while (%i) {
  hadd -m SoundList $nopath($findfile([color:red]"c:\directory of files"[/color],*.wav,%i))
  dec %i
 }
 dialog -m Sounds Sounds
}
on *:DIALOG:Sounds:init:*: {
  var %x = $hget(SoundList,0).item
  while (%x) {
   did -a Sounds 1 $hget(SoundList,%x).item $hget(SoundList,%x).data
   dec %x
  }
  hfree SoundList
}
on *:DIALOG:Sounds:dclick:1: sound $active $did(1).seltext
dialog Sounds {
  title "Sounds"
  size -1 -1 167 170
  option dbu notheme
  list 1, 4 4 159 149, vsbar size sort
  button "Close", 2, 128 156 32 12, ok
}

Code:
alias [color:blue]randomsound[/color] {
 var %y = $findfile([color:red]"c:\directory of files"[/color],*.wav,0)
 sound $active $findfile([color:red]"c:\directory of files"[/color],*.wav,$rand(1,%y))
}
In both you must change the file directory. In the 2nd code you can also change the alias name (change "randomsound" for whatever you want)
Posted By: yamaz Re: Random sound and sound browser - 22/08/04 09:22 AM
I really don't know how to thank you....it works perfectly....thank you VERY much smile
Posted By: Zyzzyx26 Re: Random sound and sound browser - 22/08/04 11:50 AM
Awesome! Have fun wink
© mIRC Discussion Forums