How can you make your script remember what you did?
-
I wrote a script a while ago to purchase something but i scrapped this script because i could not find out how to make the script remember that i bought this.
-
@M8T do u mean permanently, as in saved to disk, or just for the current session, as in saved in memory and/or cache. This is more a C# question, no? Im assuming you're taking about something beyond global or static variables. More like a persistence database or writing to a text file and reading it back.
-
@JohnFromGWN I mean permanently so that when your reload the game your purchase that you made is still there in c#
-
@M8T can you write the value or set a flag to a text file and then just read it back?
-
@JohnFromGWN how do you do that?
-
@M8T im not a programmer so im the wrong person to ask. I figured out how to write to text awhile back but i never researched reading, particularly reading an xml file. That would be interesting.
My.Computer.FileSystem.WriteAllText("c:\Code.txt", myvariable, False)
That was in vb.net.
For C#
public static void WriteAllText (string path, string contents, System.Text.Encoding encoding); or something like that