ID:147325
 
Okay I'm making it so players can report bugs through an in-game verb and when the world closes it will make a new txt file that saves the variable. However my txt file is blank...

mob/verb
Report_Bugs(msg as message)
bugreport += "[usr]'s bug:
[msg]

"
world
New()
bootcount += 1
Del()
if(bugreport != null)
var/savefile/R = new ("Bug Report [bootcount].txt")
R >> bugreport

But when I tested this, "Bug Report 1.txt" was blank. I'm not too good at savefiles...what did I do wrong? =(
A <br> tag won't do you much good in a text file, and unless you're saving bootcount to a savefile, it's always going to be 1. Also, The way you have your code set up, it creates a new instance of the savefile R (which contains nothing), writes R to the bugreport variable, then any data that could have been there is lost when the world shuts down.

text2file() would probably work better in this case.
var/const/bugreport

mob
verb
Report_a_Bug(T as message)
if(!T) return
bugreport += {"[T]
-----"}


world
Del()
if(bugreport) text2file(bugreport,"Bug Report.txt")
In response to Mobius Evalon
okay I'll try that. That's much shorter than my code :-)

Also I forgot about the "if(!T)" line. I usually only thing of it on Say/Worldsay/Emote etc.