how to Read a ini file from script
Hello I was wondering how i can make my script read my ini file does somebody know
I hope that's it.
@Niziul bruh, you don't need to use that. If he's using SHVDN, then he can use the ScriptSettings class to read/write ini files.
@JustDancePC Look, I didn't know. Thanks for the tip.
@JustDancePC Can you post sample code, so others can benefit. Thanks
Just to add to the party, this is how I read text files, so not .ini files, but text in general.
lines = System.IO.File.ReadAllLines(@"pathgoeshere\name.txt");
In SHVDN, you can read an .ini file the same name as your script like this:
Settings.GetValue("Category", "Key", "default_value");
If you want to use an .ini file that is not named the same as your script:
var settings = ScriptSettings.Load("scripts\\custom_named.ini"); settings.GetValue("Category", "Key", "default_value");
Just to add your script as an example for both the script and the .ini.
Settings.GetValue("Settings", "Key", Keys.J);
Key = J
Edit: no quotes on the default key in GetValue, Keys.J
@JohnFromGWN except the default value should be
@Jitnaught my bad, will edit it.