Ordush 185 Posted September 25, 2017 Share Posted September 25, 2017 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? Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/ Share on other sites More sharing options...
Droidz 2738 Posted September 25, 2017 Share Posted September 25, 2017 Hello, for the product or general settings? Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-32622 Share on other sites More sharing options...
Ordush 185 Posted September 25, 2017 Author Share Posted September 25, 2017 (edited) 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, 2017 by Ordush Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-32629 Share on other sites More sharing options...
Droidz 2738 Posted September 25, 2017 Share Posted September 25, 2017 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 Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-32630 Share on other sites More sharing options...
Ordush 185 Posted September 25, 2017 Author Share Posted September 25, 2017 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! Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-32631 Share on other sites More sharing options...
Ordush 185 Posted October 20, 2017 Author Share Posted October 20, 2017 @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? Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-33947 Share on other sites More sharing options...
Droidz 2738 Posted October 21, 2017 Share Posted October 21, 2017 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? Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-33953 Share on other sites More sharing options...
Ordush 185 Posted October 21, 2017 Author Share Posted October 21, 2017 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')"); } } Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-33958 Share on other sites More sharing options...
Ordush 185 Posted October 22, 2017 Author Share Posted October 22, 2017 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. :) Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-33989 Share on other sites More sharing options...
Droidz 2738 Posted October 23, 2017 Share Posted October 23, 2017 HunterBeastmasterSettings.CurrentSetting.Save() Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34003 Share on other sites More sharing options...
Ordush 185 Posted October 23, 2017 Author Share Posted October 23, 2017 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() Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34006 Share on other sites More sharing options...
Ordush 185 Posted October 28, 2017 Author Share Posted October 28, 2017 @Droidz Bump Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34161 Share on other sites More sharing options...
Droidz 2738 Posted October 29, 2017 Share Posted October 29, 2017 Don't call "Save" from "new SpellState(" Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34177 Share on other sites More sharing options...
Droidz 2738 Posted October 29, 2017 Share Posted October 29, 2017 When do you want to save (what triggers the save)? Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34178 Share on other sites More sharing options...
Ordush 185 Posted October 29, 2017 Author Share Posted October 29, 2017 (edited) 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, 2017 by Ordush Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34184 Share on other sites More sharing options...
Droidz 2738 Posted October 29, 2017 Share Posted October 29, 2017 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), Ordush 1 Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34185 Share on other sites More sharing options...
Ordush 185 Posted October 29, 2017 Author Share Posted October 29, 2017 (edited) 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, 2017 by Ordush Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34186 Share on other sites More sharing options...
Droidz 2738 Posted October 29, 2017 Share Posted October 29, 2017 Add c# condition (HunterBeastmasterSettings.CurrentSetting.Save() && false) Ordush 1 Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34187 Share on other sites More sharing options...
Ordush 185 Posted October 29, 2017 Author Share Posted October 29, 2017 5 hours ago, Droidz said: Add c# condition (HunterBeastmasterSettings.CurrentSetting.Save() && false) Thank you so much Droidz! You are a star! Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34212 Share on other sites More sharing options...
Ordush 185 Posted October 30, 2017 Author Share Posted October 30, 2017 (edited) @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, 2017 by Ordush Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34267 Share on other sites More sharing options...
Ordush 185 Posted October 30, 2017 Author Share Posted October 30, 2017 Nevermind, i figured it out myself by looking at the top of my cs file. It's just: HunterBeastmasterSettings.Load() Link to comment https://wrobot.eu/forums/topic/7189-call-settings-saveload-in-c/#findComment-34271 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