ID:176294
 
how would I go about taking a savefile and converting it to a text document in DM? I need a verb that would do this in order check some things with my early testing for my upcomming game and I have no clue how to do it. Can someone that knows how please show me how to do this?

thanks,
-=Ken=-
Nadrew knows.
var/atom/A = new()
A.Read(savefile)
for(var/V in A.vars)
text2file(V,"savefile.txt")

Might work, might not.
In response to Garthor
It didn't work, hmmm.

-=Ken=-
mob
verb/DG_FText(E as file)
set name="File -> Text"
var
T=input("As what filename?")as text
savefile/F=new(E);Ftxt=file("[F.dir]/[T].txt")
F.ExportText("/",Ftxt)
//This will save it with the appropriate filename and I believe it should save it in the same folder as the file.


Your newbie friend has surpassed you Ken.

Lance
...Guardian of Dragons...
In response to Dragon Guardian
Dragon Guardian wrote:
mob
> verb/DG_FText(E as file)
> set name="File -> Text"
> var
> T=input("As what filename?")as text
> savefile/F=new(E);Ftxt=file("[F.dir]/[T].txt")
> F.ExportText("/",Ftxt)
> //This will save it with the appropriate filename and I believe it should save it in the same folder as the file.
>

Your newbie friend has surpassed you Ken.

Lance
...Guardian of Dragons...

I didn't see you in school today and you missed the second part of the english regents. Also, thanks but I already figured it out last night thanks to nadrew's reference, but yours is alot neater. as the comment goes, you havent surpassed me yet, you just got lucky with this one.

-=Ken=-

P.S:just wondering why this was moved to newbie central I thought I used the right forum place.
In response to NeoHaxor
This is more appropriate in Newbie Central because it's a "how do I do this" type of question. Design Philosophy is more for theoretical discussions (such as "what method for doing such-and-such is fastest?"), rather than "how do I code/program this?" questions.