ID:154656
 
(See the best response by DarkCampainger.)
I want to view a txt document that is not a save file. For example, if I want to view the bugs in my game, it will go into this file by the users:

BugLog.txt

Now is there a way I can make it so that I can read the file in the game instead of the host having to upload it and send it to me?
Best response
I think that will open a file on the user's computer, not the host's.

This should open the file "BugLog.txt" in the game's directory. You could also output it to an output control, ftp() it to the user, ect.

    var/filename = "BugLog.txt"
var/contents
if(fexists(filename))
contents = html_encode(file2text(file(filename)))
else
contents = "<b>File Not Found</b>"
src<<browse("<pre>[contents]</pre>")
Well, assuming the Buglog file is on the same file as the host files, I hope this helps.
mob/verb/TextfileView()
var/BugLog=({"<br><b>Textfile</b>"}
var/ISF=file2text("BugLog.log")
BugLog+=ISF
usr<<browse(BugLog,"window=Log;size=300x450")
src << browse(file(whatever)) should be enough and just fine no extra parsing or changing needed iirc
You could alternately use mob << run() (Which I learned very recently to have people without byond running to be prompted to install)

mob/verb
View_TXT()
usr << run('File.txt')