I really do have no idea on how to do this, so I was hoping someone could show me. Is there a way to import/export savefiles from an ftp? I thought it over and think this is the best way to prevent any kind of editing.
I think Android's answer would be the best choice. I wrote some example code, try it.
mob verb Test() var/http = world.Export("http://members.byond.com/Audeuro/files/AFKBattle.zip") if( !http ) world << "No response" return var/content = http["CONTENT"] world << content
That downloads AFKBattle from my members files, and then asks if you want to run it. You can do the same with a savefile. Try something like this, to download test.sav from my files section:
If it's a savefile, you don't need to use file2text(). But using ImportText() is bad too, since it isn't text but a savefile.
I think you should do var/savefile/F=new(txt) for it to work.
Keep in mind that this is still limited to getting the savefile. There's no feasible way of sending the savefile over and replacing it, unless you're going to use a DMCGI application or PHP to write a new savefile (PHP would probably be limited to writing the text, so you'd have to ImportText() it). Also, the GET protocol is limited in the amount of data you can send, so if you have a big savefile (or even a moderate one) it won't send because of the enforced limit. The POST protocol does not have a known limit, and would be a better alternative. Unfortunatly, you can't use the POST protocol because BYOND doesn't support it, nor FTP.
Go ahead, downloading the savefile from my files section, I marked it as listed. It's in text format. I hand-wrote the file, which is why I used ImportText, and yes, file2text() is needed with ImportText().
So World.Export() doesn't actually Export anything from the server, but in fact fetches whathaveyou from another server? Or can it be used in multiple ways?
world.Export() can be used in cojunction with world.Import() and world.Topic() to send files to other worlds/games. The game can then act upon the information they receive and do something with the file. This method can be used to i.e. transmit savefiles from players from one server to another.
The only downside is that any BYOND world can do this, so you'll have to write your own safety protocols.
I've got a kind of a hunch that it won't work. world.Export() won't accept an ftp adress.