ID:1484404
 
Code:
            var/dmb_file = world.Export(Host + FileDir+"/"+ Game.DMBName)
var/rsc_file = world.Export(Host + FileDir+"/"+ Game.DMBName)
if(!dmb_file["CONTENT"] || !rsc_file["CONTENT"])
UpdateError("DMB or RSC couldn't be reached.")
return -1;
fcopy(file(dmb_file["CONTENT"]), Game.Path +"/"+ FileDir + Game.DMBName)
fcopy(file(dmb_file["CONTENT"]), Game.Path +"/"+ FileDir + Game.RSCName)
PastUpdates += FileDir

Game.ReplaceFiles()


Problem description: Hey there, I do not usually post on here, but when I do, it's truly a headache!
I am working on Server Manager 2.0, and I made an auto-updater. It will search for updates at a specified webserver, if found, it will fetch the files, and replace the files after a reboot is done, and after which another reboot is done.

I am wondering how would someone fetch a .dmb and .rsc file placed in an external webserver.
I have attempted the above code, I haven't tried it yet because I don't have one as of now, somehow I am positive I am doing it wrongly.

Has anyone attempted this before?
If so, what were the results?
Is this even possible without having any external script to act, like PHP?

AFAIK it's not possible to initiate a binary download over HTTP with BYOND like that.

It MAY be possible if you write a (PHP) script to generate a BYOND savefile with the file data embedded within. This may allow you to read the content as a savefile and copy the file from that.

If you don't have that then it'd still be possible by writing a DLL file to update the game for you. However you'll have to be proficient in C/C++.
In response to Sir Lazarus
Sir Lazarus wrote:
AFAIK it's not possible to initiate a binary download over HTTP with BYOND like that.

It MAY be possible if you write a (PHP) script to generate a BYOND savefile with the file data embedded within. This may allow you to read the content as a savefile and copy the file from that.

If you don't have that then it'd still be possible by writing a DLL file to update the game for you. However you'll have to be proficient in C/C++.

I have to disagree with you.
I have actually got this to work, here's the final snippet:
        if ((world.time < LastRetry)&&!Forced) {return}
if (FileDir in PastUpdates && !Forced) {return}
if (time2text(world.realtime, "Day") in UpdateDay || Forced)
var/dmb_file = world.Export(Host + FileDir+"/"+ Game.DMBName)
var/rsc_file = world.Export(Host + FileDir+"/"+ Game.RSCName)
if(!dmb_file["CONTENT"] || !rsc_file["CONTENT"])
UpdateError("DMB or RSC couldn't be reached.")
return -1;
fcopy(file(dmb_file["CONTENT"]), Game.Path +"/"+ FileDir + Game.DMBName)
fcopy(file(rsc_file["CONTENT"]), Game.Path +"/"+ FileDir + Game.RSCName)
PastUpdates += FileDir

Game.ReplaceFiles()
LastRetry = world.time + ((600 * 60) * UpdateRetryTimeout)
Nice! I didn't know it was possible to download binary data like that.