Feb 8 2015, 09:38 AM Post #1 | |
Ameteur Member Posts: 42 Joined: 3-November 14 | Getting GTAG Back to life Firstly, you should add this reference to your project/compiler CODE using System.IO; you should check in your constructor if the settings does'nt exists. for example CODE public void Class1() { if(!File.Exists(Settings.Filename)) { } } Settings.Filename is the name of your script. If you name your script gtagscript then the ini file name would gtagscript too now the does'nt exists we have to make the script generate it. We will write our information in the ini so when the script won't find the file it will create one CODE if(!File.Exists(Settings.Filename)) { Settings.SetValue("OptionName", "Category", "Value"); } you can add more info CODE if(!File.Exists(Settings.Filename)) { Settings.SetValue("OptionName", "Category", "Value"); Settings.SetValue("OptionName2", "Category2", "Value2"); } now let me explain OptionName does'nt need explaining If OptionName was Key1 then in the ini you would see CODE [Category] Key1=Value Category does'nt need explaining too if Category was MyMod then in the ini you would see CODE [MyMod] OptionName=Value Value is the default Value. It it can be Key,Float,int,bool,Crap,etc if Value was 10.0 in the ini you would see CODE [Category] OptionName=10.0 Here i will explain everything Creating settings in This Tutorial i will use int. Firstly, Define the int CODE int mynum; it does't have to be mynum it can be anything, i just chose mynum. lets make it a settings Value CODE mynum = Settings.GetValueInteger("Number", "Tut", 10); it have to be GetValueInteger because it is int. Number is the Option Name you can change it to anything you want Tut is the Category Name you can change it to anything you want 10 is the default value. The people who uses your mod may change this value from the ini file. Check if the Settings File does't exists and Write your info CODE if(!File.Exists(Settings.Filename)) { Settings.SetValue("Number", "Tut", 10); } now the ini file would be like this CODE [TUT] Number=10 now i need to use this int in something I want to use it in a number displayed on screen Print is the best example. Print can support Keys,Int,Float,Bool,Crap,etc CODE Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW","STRING",mynum.ToString(),5000,1); it will display the 10 in the screen for 10 seconds if the Users changes 10 from the ini file to 5 then 5 will be displayed. The Same happens with Int,float,bool,crap,etc but getting the value would be different Bool CODE Settings.GetValueBool Float CODE Settings.GetValueFloat Key CODE Settings.GetValueKey Model CODE Settings.GetValueModel Names - Don't know what is this really CODE Settings.GetValueNames String CODE Settings.GetValueString Vector3 CODE Settings.GetValueVector3 and also function will be different i mean for example you can't use bool in a function that needs float you can't use float in a function that needs bool every father takes his son and however I hope the tutorial was helpful This post has been edited by Mora Hannover: Feb 8 2015, 09:42 AM -------------------- Rest in Peace Yeardley Diamond (Dec. 21, 1985 - Aug. 20, 2014) Rest in Peace Kitty0706 (1994 - Jan. 25, 2015) |