ID:155416
 
Is there any way in the DM language to directly edit a text file? thanks!
In response to Prf X
text2file&file2text don't return exactly what I want, experimenting with shell.

any specific command I should use w/ shell?
In response to Gigimoi
How are you wanting to edit the file?
In response to Prf X
Replace all text within it with my own.
In response to Gigimoi
Why not just delete it and recreate it then?
In response to Gigimoi
Did you try to delete the file & write a new file with the same name?
In response to Pyro_dragons
I'm not trying to write a new file, I want the text in the file to be my input.
In response to Gigimoi
I don't thank you can only rewrite a file,
only del(old) and write(new)
In response to Gigimoi
var/file_text = file2text("myfile.txt")
var/new_text = input("New text here","New text",file_text) as null|message
if(!new_text) return
fdel("myfile.txt") // to prevent appending as opposed to writing.
text2file(new_text,"myfile.txt")


file2text() and text2file() were exactly what you were looking for, I don't see how you thought otherwise.
In response to Nadrew
Thank you very much!
Final Code
        fdel("myfile.txt")
fdel("launch.bat")
text2file("@ echo off","myfile.txt")
text2file("start /MAX C:\\MMDS\\src\\minecraft\\net\\minecraft\\src\\[verb_name]","myfile.txt")
usr<<shell("REN.bat")
sleep(5)
usr<<shell("launch.bat")
fdel("myfile.txt")
fdel("launch.bat")