ID:270605
 
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.

Help please?
Heh, I've been curious of this too.

I've got a kind of a hunch that it won't work. world.Export() won't accept an ftp adress.
In response to Gumshoe (#1)
Friendly bump.
In response to Gumshoe (#2)
Another friendly bump.
BYOND has no built-in FTP support (yet). You can use HTTP, but that's limited to GET.
In response to Gumshoe (#3)
I'll bump it for you, because I want to be friendly.
In response to Rockinawsome (#5)
Rockinawsome wrote:
I'll bump it for you, because I want to be friendly.

Eh? I gave the answer, no need to bump this. Plus, you have no motive for doing so.
In response to Android Data (#6)
Android Data wrote:
Rockinawsome wrote:
I'll bump it for you, because I want to be friendly.

Eh? I gave the answer, no need to bump this. Plus, you have no motive for doing so.

I wish you would think about my feelings sometimes, geeze! AHHHHHH! Why can't we be friend's! Huh? Huh? Sheesh...

Consider yourself bumped....
In response to Rockinawsome (#7)
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:

mob
verb
Test()
var/http_res = world.Export("http://members.byond.com/Audeuro/files/test.sav")
if( !http_res )
return
var/txt = http_res["CONTENT"]
var/savefile/F = new
F.ImportText( "/", file2text(txt) )
world << F["world/Name"]


You can download test.sav yourself and look at it. I don't think you need file2text if it's not a plaintext savefile like mine is.

-edit-

I have test.sav listed now. I had to rush out the door.
In response to Audeuro (#8)
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.
In response to Android Data (#9)
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().
In response to Audeuro (#10)
Audeuro wrote:
It's in text format.

In that case, it would work. But keep in mind that it won't work if it's directly a savefile.

-- Data
In response to Audeuro (#8)
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?
In response to Rockinawsome (#12)
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.