September 25, 20178 yr Hey all! The save and load functiosn are called 3 times. First load is when you open settings, save is called when you close settings, load is called again when you start the bot (press play) Is there any way that i can call the save or load during the rotaiton?
September 25, 20178 yr Author 1 hour ago, Droidz said: Hello, for the product or general settings? Sorry for the general settings ofc. :) It's because I've made it so it updates some in-game lua variables every time it saves/loads. (It's so i don't have to make an addon with savedVariables to save my lua variables between sessions.) For my fightclass Edited September 25, 20178 yr by Ordush
September 25, 20178 yr wManager.wManagerSetting.Load(); // no required for wManagerSettings // .... wManager.wManagerSetting.CurrentSetting.Save(); Sample for product settings https://wrobot.eu/forums/topic/6910-change-profile-in-a-plugin/#comment-31413
September 25, 20178 yr Author 1 minute ago, Droidz said: wManager.wManagerSetting.Load(); // no required for wManagerSettings // .... wManager.wManagerSetting.CurrentSetting.Save(); Sample for product settings https://wrobot.eu/forums/topic/6910-change-profile-in-a-plugin/#comment-31413 Perfect! Thank you!
October 20, 20178 yr Author @Droidz is there any way to save fightclass settings with C# as well? That's actually what i was trying to do. wManager.wManagerSetting.CurrentSetting.Save(); did not work, i'd like to save the fightclass settings with C#. Is that at all possible?
October 21, 20178 yr 12 hours ago, Ordush said: @Droidz is there any way to save fightclass settings with C# as well? That's actually what i was trying to do. wManager.wManagerSetting.CurrentSetting.Save(); did not work, i'd like to save the fightclass settings with C#. Is that at all possible? Hello, what is your fightclass code?
October 21, 20178 yr Author 3 hours ago, Droidz said: Hello, what is your fightclass code? [Serializable] public class HunterBeastmasterSettings : Settings { private bool _huntersmark = false; [Setting] [DefaultValue(false)] [Category("Settings")] [DisplayName("Hunter's Mark")] [Description("Use Hunter's Mark")] public bool HuntersMark { get { return _huntersmark; } set { _huntersmark = value; } } private HunterBeastmasterSettings() { ConfigWinForm(new System.Drawing.Point(400, 400), "HunterBeastmaster " + Translate.Get("Settings")); } public static HunterBeastmasterSettings CurrentSetting { get; set; } public bool Save() { try { CurrentSetting.FetchFromLua(); // LOAD SETTINGS FROM LUA return Save(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("HunterBeastmasterSettings > Save(): " + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<HunterBeastmasterSettings>(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName)); CurrentSetting.PushToLua(); // SETTINGS LOADED, MUST BE TRANSLATED TO LUA return true; } CurrentSetting = new HunterBeastmasterSettings(); } catch (Exception e) { Logging.WriteError("HunterBeastmasterSettings > Load(): " + e); } return false; } void FetchFromLua() { HuntersMark = Lua.LuaDoString<bool>("return HuntersMarkDisabled"); Lua.LuaDoString("print('Fetched Lua')"); } void PushToLua() { Lua.LuaDoString("HuntersMarkDisabled = " + HuntersMark.ToString().ToLower()); Lua.LuaDoString("print('Pushed Lua')"); } }
October 22, 20178 yr Author If i am running wManager.wManagerSetting.CurrentSetting.Save(); Nothing happens, but if i open and close the fightclass options, the save function is called. But i'd like to add wManager.wManagerSetting.CurrentSetting.Save(); to the fight class rotation, so it saves every so often instead of only when you open/close the options. :)
October 23, 20178 yr Author 2 hours ago, Droidz said: HunterBeastmasterSettings.CurrentSetting.Save() @Droidz Am i doing something wrong? If you look at the code i have above, then the line you just wrote here should save and thereby do CurrentSetting.FetchFromLua(); But neither if i have it in my rotation and set to do C#, or if i use the DevolpmentTools and write the code below will work? HunterBeastmasterSettings.CurrentSetting.Save() This is how it looks: new SpellState("HunterBeastmasterSettings.CurrentSetting.Save();", 1, context => true, false, false, false, false, false, false, false, false, 0, false, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Yes, "", "none", false, false, true), /* * SETTINGS */ [Serializable] public class HunterBeastmasterSettings : Settings { private bool _huntersmark = false; [Setting] [DefaultValue(false)] [Category("Settings")] [DisplayName("Hunter's Mark")] [Description("Use Hunter's Mark")] public bool HuntersMark { get { return _huntersmark; } set { _huntersmark = value; } } private HunterBeastmasterSettings() { ConfigWinForm(new System.Drawing.Point(400, 400), "HunterBeastmaster " + Translate.Get("Settings")); } public static HunterBeastmasterSettings CurrentSetting { get; set; } public bool Save() { try { CurrentSetting.FetchFromLua(); // LOAD SETTINGS FROM LUA return Save(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName)); } catch (Exception e) { Logging.WriteError("HunterBeastmasterSettings > Save(): " + e); return false; } } public static bool Load() { try { if (File.Exists(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName))) { CurrentSetting = Load<HunterBeastmasterSettings>(AdviserFilePathAndName("CustomClass-HunterBeastmaster", ObjectManager.Me.Name + "." + Usefuls.RealmName)); CurrentSetting.PushToLua(); // SETTINGS LOADED, MUST BE TRANSLATED TO LUA return true; } CurrentSetting = new HunterBeastmasterSettings(); } catch (Exception e) { Logging.WriteError("HunterBeastmasterSettings > Load(): " + e); } return false; } void FetchFromLua() { HuntersMark = Lua.LuaDoString<bool>("return HuntersMarkDisabled"); Lua.LuaDoString("print('Fetched Lua')"); } void PushToLua() { Lua.LuaDoString("HuntersMarkDisabled = " + HuntersMark.ToString().ToLower()); Lua.LuaDoString("print('Pushed Lua')"); } } Yet it is not printing anything nor is it saving. :/ If i open the options by clicking the cogwheel, it will print Pushed Lua, if i close the cogwheel it will print Fetched Lua This is what i'm trying to do with HunterBeastmasterSettings.CurrentSetting.Save()
October 29, 20178 yr Author 57 minutes ago, Droidz said: When do you want to save (what triggers the save)? I just want to save every end of the "rotation" or on a timer.. I also tried calling the save with the Development tool. Edit: I am using the fight class editor to make my fightclasses. (And notepad) Edit2: To be more precise, what i wanted to do was to put the HunterBeastmasterSettings.CurrentSetting.Save() as the last "spell" in my rotation and then set it to run as C#. Edited October 29, 20178 yr by Ordush
October 29, 20178 yr try: new SpellState("Save...", 1, context => HunterBeastmasterSettings.CurrentSetting.Save() && false, false, false, false, false, false, false, false, false, 0, false, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Yes, "", "none", false, false, true),
October 29, 20178 yr Author 4 minutes ago, Droidz said: try: new SpellState("Save...", 1, context => HunterBeastmasterSettings.CurrentSetting.Save() && false, false, false, false, false, false, false, false, false, 0, false, false, false, false, false, false, wManager.Wow.Helpers.FightClassCreator.YesNoAuto.Yes, "", "none", false, false, true), You are a god damn god! <3 Thank you!!!! Edit: Is there any way that i can add this with the fight class editor, so i don't have to change to CS every update? :) Edited October 29, 20178 yr by Ordush
October 29, 20178 yr Author 5 hours ago, Droidz said: Add c# condition (HunterBeastmasterSettings.CurrentSetting.Save() && false) Thank you so much Droidz! You are a star!
October 30, 20178 yr Author @Droidz Is there any way to Load from the fightclass? HunterBeastmasterSettings.CurrentSetting.Load() Won't work since the Load function is static. The reason i want to load manually is because if people do /reloadui without stopping the bot, it will not load (since it only loads when you press "play") Edited October 30, 20178 yr by Ordush
October 30, 20178 yr Author Nevermind, i figured it out myself by looking at the top of my cs file. It's just: HunterBeastmasterSettings.Load()
Create an account or sign in to comment