Help - Search - Members - Calendar
Full Version: Download From File
Game Maker Community > Working with Game Maker > Advanced Users Only
RedFalcon
Okay, I'm making a media player prog, and I need two things for it.

I want to set a URL in the prog itself so it downloads a music file into itself and plays, not something that finds the file and pops up a "Do you wish to download this"

And, the second this is pretty much the same as the first, only I want the prog to download a text file and display the text onscreen.

I posted this in novice, but I guess it's a little advanced for that topic. I'm not good at discerning those things..

Anyway, thanks for any help!
ragarnak
QUOTE (RedFalcon @ Apr 28 2006, 07:03 AM)
I want to set a URL in the prog itself so it downloads a music file into itself and plays
*
Do you think that is a good idea ?

It (downloading something without the user being asked or aware of it) might be considered intrusive to the users privacy (and ofcourse a security-risk) ....

But if you really want to do it, I think you will have more success looking in the "Extending Game Maker" -forum, where all sorts of DLL's are posted.
ShadowChad
ok, so you're trying to load a song into your program, correct?

easy and simple,dood happy.gif

//Adds the sound
global.loaded_sound = sound_add(get_open_filename("MP3 format files(.mp3)|*.mp3|Midi files(.mid)|*.mid|[whatever type of music file it is]|*[file extension (i.e. .mp3, .wav)]),1,false)

dry.gif ok, i'll break it down for ya

*We're gonna assign a variable to the new song
global.loaded_sound =

*sound_add(fname,kind,preload) Adds a sound resource to the game. fname is the name of the sound file. kind indicates the kind of sound (0=normal, 1=background, 2=3d, 3=mmplayer) preload indicates whether the sound should immediately be stored in audio memory (true or false). The function returns the index of the new sound, which can be used to play the sound. (-1 if an error occurred, e.g. the file does not exist).

*get_open_filename(filter,fname) Asks the player for a filename to open with the given filter. The filter has the form 'name1|mask1|name2|mask2|...'. A mask contains the different options with a semicolon between them. * means any string. For example: 'bitmaps|*.bmp;*.wmf'. If the user presses Cancel an empy string is returned.

now, just combine em.. laugh.gif
RedFalcon
Will this work?

CODE
//Adds the sound
global.loaded_sound = sound_add(get_open_filename("mysite.com/music/mymusic.mp3,1,false)
yODUDE!
no. he doesn't get it. there are some dll's in the extending forum that let you transfer stuff through http so you could do that and then load it in. smile.gif
RedFalcon
Oh, thanks. I've never used DLLs, so this might be fun
Krisando
Not good breeched music copyright laws
and getting a server to host all those files with people with broadband
are the only ones who can play the music...

Just use winamp media player for this!
ShadowChad
mad.gif
ok, forget what they said..

you had it right

//Adds the sound
global.loaded_sound = sound_add(get_open_filename(blah,blah,blah),1,fals
e)
make sure the 'fname' part of it isn't really filled out)
RedFalcon
What do you mean, "make sure the 'fname' part of it isn't really filled out) " ? and every time I put in something like "www.mysite.com" it says "Unknown variable 'www'"
ragarnak
QUOTE (RedFalcon @ Apr 29 2006, 05:35 PM)
What do you mean, "make sure the 'fname' part of it isn't really filled out) " ? and every time I put in something like "www.mysite.com" it says "Unknown variable 'www'"
*
GM's commands are for the local computer (or at most your local network), not for internet-connections.

That is why I said you need a DLL (to download the file first).

By the way : have you ever tried to "just open" a file somewhere on the web on your own computer ? And ? What happened ? smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.