quasimodo 0 Posted May 20, 2020 Share Posted May 20, 2020 Hey everyone, I'm working on a Totem Twist Fight Class for TBC and i want to add Settings, which allow me to chose the Totems i want the bot to use. I'm creating C# Fightclasses for a while. Yet i couldn't figure out, how to properly impliment options in the Settings. This is how i tried to make it work: [Serializable] public class TestingSettings : Settings { [Setting] [DefaultValue("")] [Category("Category")] [DisplayName("Displ")] [Description("Descr")] public string Setting1 { get; set; } private TestingSettings() { Setting1 = ""; } public static TestingSettings CurrentSetting { get; set; } public bool Save() { try { return Save(AdviserFilePathAndName("TestSetting", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("Failed" + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("TestSetting", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<TestingSettings>(AdviserFilePathAndName("TestSetting", ObjectManager.Me.Name + "." + Usefuls.RealmName)); return true; } CurrentSetting = new TestingSettings(); } catch (Exception e) { Logging.WriteError("Failed" + e); } return false; } } Unfortunatly, when i press "Settings", just nothing happens. What am I doing wrong? Link to comment https://wrobot.eu/forums/topic/12176-how-do-i-impliment-fight-class-settings/ Share on other sites More sharing options...
Zer0 148 Posted May 20, 2020 Share Posted May 20, 2020 Looks good to me at first sight. Maybe you forgot to declare the following method? public static void ShowConfiguration() { TestingSettings.Load(); TestingSettings.CurrentSetting.ToForm(); TestingSettings.CurrentSetting.Save(); } You also need to load the settings in the Initialize() method of the FC: TestingSettings.Load(); Talamin 1 Link to comment https://wrobot.eu/forums/topic/12176-how-do-i-impliment-fight-class-settings/#findComment-58290 Share on other sites More sharing options...
quasimodo 0 Posted May 20, 2020 Author Share Posted May 20, 2020 1 hour ago, Zer0 said: Looks good to me at first sight. Maybe you forgot to declare the following method? public static void ShowConfiguration() { TestingSettings.Load(); TestingSettings.CurrentSetting.ToForm(); TestingSettings.CurrentSetting.Save(); } You also need to load the settings in the Initialize() method of the FC: TestingSettings.Load(); This made it work. Thanks a lot! (ofc I was missing the obvious stuff ... time to feel stupido for a few minutes ? ) Link to comment https://wrobot.eu/forums/topic/12176-how-do-i-impliment-fight-class-settings/#findComment-58291 Share on other sites More sharing options...
Zer0 148 Posted May 20, 2020 Share Posted May 20, 2020 No worries ? If you need further inspiration, feel free to check out my githubhttps://github.com/Wholesome-wRobot/Z.E.TBC_AllInOne_FightClasses/tree/master/Wrobot Link to comment https://wrobot.eu/forums/topic/12176-how-do-i-impliment-fight-class-settings/#findComment-58295 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now