Hello,
I’ve been looking for about an hour, and can’t find anything on this.
I have this problem, when I hit the “Generate Item” button, it writes it as a giant line, And I have so many lines, it would be crazy amount of work just to get it to write right.
(if I use individual “WriteLine ()” for each line) So is there anyway so when it see’s "
" it will write a new Line?
Any help would be much appreciated.
function Update () {
info = iname + itemname + n+ iid + itemid + n + iicon + itemicon + n + itype + itemtype + n + istack + itemstack + n + customfunction + n;
if (itemtypeInt == 6) info += "grenadetime=" + grenadetime + n + "grenadethrowforce=" + grenadethrowforce + n + "damage=" + tooldamage + n + "maxuses=" + tooluses + n;
if (itemtypeInt == 2||itemtypeInt == 3||itemtypeInt == 4||itemtypeInt == 5) info += "maxuses=" + tooluses + n + "armorname=" + armortexture + n;
if (itemtypeInt == 1) info += "healamount=" + healamount + n + "maxuses=" + tooluses + n;
if (doortypeInt == 0 && itemtypeInt == 7) info += "iddoor=" + iddoorblock + n;
if (doortypeInt == 1 && itemtypeInt == 7) info += "texturefilebottom=" + texturefilebottom + n + "iddropped=" + iddropped + n;
if (tooltypeInt == 1 && itemtypeInt == 0) info += "harvestblocks=pickaxe" + picktype + n;
if (infiniteair == true && itemtypeInt == 2||itemtypeInt == 3||itemtypeInt == 4||itemtypeInt == 5) info += "infiniteair=true" + n;
if (nofalldamage == true && itemtypeInt == 2||itemtypeInt == 3||itemtypeInt == 4||itemtypeInt == 5) info += "nofalldamage=true" + n;
if (noburning == true && itemtypeInt == 2||itemtypeInt == 3||itemtypeInt == 4||itemtypeInt == 5) info += "noburning=true" + n;
if (itemtypeInt == 0) info += "damage=" + tooldamage + n + "hitmob=damageitem(" + mobdamagetool + ")" + n + "blockdestroyed=damageitem(" + blockdamagetool + ")" + n + "efficiencyblocks=" + tooltype + n + "maxuses=" + tooluses + n;
}
function OnGUI () {
if (GUI.Button (Rect (625,205,150,50), "Generate Item")) {
info2 = "Creating Item";
Debug.Log (info);
fdir2 = fdir + ".item";
var sw : StreamWriter = new StreamWriter(fdir2);
info2 = "Writing To File";
sw.WriteLine(info);
info2 = "Saving";
sw.Close();
info2 = "Finished";
}
Thanks for the reply, But yeah, I have that in the code, the variable 'n' in the code is just the string 'backslash "\n"'. While it makes a newline in the debug console, it doesn't write a newline in the text file it creates.
– anon81049028Plain text doesn't recognize \n alone. You need to do \r\n.
– anon25104582Okay, sweet that worked, Thanks.
– anon81049028http://www.editpadpro.com/tricklinebreak.html
– jahroy