ID:159092
 
How can I have it so that when a person selects a file, it can only be a wav file?

This is what I have :3.

        Play_Sound()
set category = "Chat"
S = input("What do you wish for us to hear, mate?","Select a Wav:") as null|sound
var/lol=S
if(lol!=null)
world << sound(S,0,volume=100)
world << "<font color=green>\icon[usr] [usr] plays sound \"<font color=blue>[S]<font color=green>\". (<a href=?Download>Download</a>)"
lol=null


but I want it so that only wav files appear when they try selecting a file.
That extra var is completely useless... just use the original S (and if(S) to check if it's true) everywhere. And that S may be declared somewhere it shouldn't be, too... usually it'd be simply a local var declared right there. Resetting local vars to null when the proc's gonna end is also useless.

Anyway, the file selection dialog is something standard you can't alter. So you can't make it show only an extension of your choice. You can however check the file's extension after it's chosen, and disallow it if it isn't what you want (this can also be done before the file is uploaded by overriding AllowUpload()), by checking the end of the filename.
Note that this may be easily fooled anyway though, as anyone can just rename a file and give it a different extension. I don't see why you'd even want to restrict it to just WAV files though. That's the hugest format... everyone's better off if you allow players to upload more compressed ones instead.
In response to Kaioken
how do I check the end of the filename? I'm noob so I dunno :3.

(Yeah, I have a play music option for mids and stuff, play sound is just for small sound effects to play quickly, but sometimes people will click play sound instead of play music accidentally and play another mid over a play music mid =X.)
In response to MartialArtistAbu
Music and sound aren't limited to specific formats. Certainly not to WAV or even MIDI... there are much better formats for music than that. But anyway...

MartialArtistAbu wrote:
how do I check the end of the filename? I'm noob so I dunno :3.

You can get a file's filename (in certain cases this includes the path) by embedding it in text:
filename = "[file]"

You can then use the copytext() and findtext() functions on the filename. To check for a given extension, you basically need to check if that string ends in ".EXT". This can be done by copying the last 4 characters of the string (use its length() to do that) and comparing it to the wanted extension (you can do a case-insensitive compare by using the cmptext() proc).
Look up any procs above that you're not familiar with, though the method above doesn't require using findtext(), which is less suitable here.