Jump to content

camelot10

Elite user
  • Posts

    838
  • Joined

  • Last visited

Posts posted by camelot10

  1. 	void PushToLua()
    	{
    		var result = Lua.LuaDoString<bool>("HuntersMarkDisabled = " + HuntersMark.ToString().ToLower() + "; print('PUSHED LUA VALUE HuntersMarkDisabled=', HuntersMarkDisabled); return HuntersMarkDisabled;");
    		Logging.Write("Wrobot push to LUA HunterMark=" + HuntersMark + " return result=" + result + " isCorret=" + (HuntersMark == result) + " ");
    	}
    	void FetchFromLua()
    	{
    		var result = Lua.LuaDoString<bool>("print('FETCH FROM LUA VALUE HuntersMarkDisabled=', HuntersMarkDisabled); return HuntersMarkDisabled");
    		HuntersMark = result;
    		Logging.Write("Wrobot fetch from LUA HunterMark=" + result + " ");
    	}

    ok. here is main proble. you asked a quick example. i write you quick example in notepad. no spellchecking/code reviewing.

    there is a simple typo, what lead to 2 hour of my brainf#cking. and main problem here that you refuse to think and analyze code, only copy-pasting and waiting solution

  2. so you see difference and didnt understand what happened?

    there is no such definition in wow lua as False only false thats why is set that var to nil

     

    	void PushToLua()
    	{
    		var result = Lua.LuaDoString<bool>("HuntersMarkDisabled = " + HuntersMark.ToString().ToLower() + "; print('PUSHED LUA VALUE HunterMarkDisabled=', HuntersMarkDisabled); return HunterMarkDisabled;");
    		Logging.Write("Wrobot push to LUA HunterMark=" + HuntersMark + " return result=" + result + " isCorret=" + (HuntersMark == result) + " ");
    	}
    	void FetchFromLua()
    	{
    		var result = Lua.LuaDoString<bool>("print('FETCH FROM LUA VALUE HunterMarkDisabled=', HuntersMarkDisabled); return HuntersMarkDisabled");
    		HuntersMark = result;
    		Logging.Write("Wrobot fetch from LUA HunterMark=" + result + " ");
    	}

    just make sure for bool in C# before pushing to lua to convert to string and make lowercase

    ToString().ToLower()

  3. 
     
    	void PushToLua()
    	{
    		var result = Lua.LuaDoString<bool>("HuntersMarkDisabled = " + HuntersMark + "; print('PUSHED LUA VALUE HunterMarkDisabled=', HuntersMarkDisabled); return HunterMarkDisabled;");
    		Logging.Write("Wrobot push to LUA HunterMark=" + HuntersMark + " return result=" + result+ " isCorret=" + (HuntersMark == result) + " ");
    	}
    	void FetchFromLua()
    	{
    		var result = Lua.LuaDoString<bool>("print('FETCH FROM LUA VALUE HunterMarkDisabled=', HuntersMarkDisabled); return HuntersMarkDisabled");
    		HuntersMark = result;
    		Logging.Write("Wrobot fetch from LUA HunterMark=" + result+ " ");
    	}
    
    as i see, lua also not your strong side. also programming in general same.
    

    step by step tracing from point where no bug to point where bug appear called bug hunting. any programming related entity know how to do that

    do you ever before develop anything related to programming/coding?

  4. maybe me, but you dont understand how its works.

    you load config from file to wrobot, and after that you should push settings to lua.

    when you save settings, you you to fetch values from lua and save to file.

    your error, as example: 

    HunterMark default value is true, user set in wow HunterMark as false, before saving settings to file, you push settings to lua > override lua HunterMark to true and save HunterMark=true into xml

    when you load settings from file, HunterMark become true, but after loading you fetch HunterMark from lua and no matter what saved into xml file, its gonna be overriden by lua fetch.

    how to fix: fetch before save, push after load

  5. @Droidz

    im trying to figure out how i can track quester profile changing

    	void TestProductEvents()
    	{
    		robotManager.Events.ProductEvents.OnDisposeProduct += OnProductDispose;
    		robotManager.Events.ProductEvents.OnProductPauseStarted += OnProductPauseStarted;
    		robotManager.Events.ProductEvents.OnProductLoaded += OnProductLoaded;
    		robotManager.Events.ProductEvents.OnProductStarting += OnProductStarting;
    		robotManager.Events.ProductEvents.OnProductStarted += OnProductStarted;
    		robotManager.Events.ProductEvents.OnProductStopping += OnProductStopping;
    		robotManager.Events.ProductEvents.OnProductStopped += OnProductStopped;
    		robotManager.Events.ProductEvents.OnProductRestarting += OnProductRestarting;
    		robotManager.Products.Products.OnChangedIsAliveProduct += OnChangedIsAliveProduct;
    		robotManager.Products.Products.OnChangedIsStarted += OnChangedIsStarted;
    		robotManager.Products.Products.OnProductNeedSettings += OnProductNeedSettings;
    	}
    	private void OnProductNeedSettings(robotManager.Products.Products.ProductNeedSettingsEventArgs e)
    	{
    		Logging.Write("@@@ TEST OnProductNeedSettings " + e);
    	}
    	private void OnChangedIsStarted(robotManager.Products.Products.IsStartedChangeEventArgs e)
    	{
    		Logging.Write("@@@ TEST OnChangedIsStarted " + e);
    	}
    	private void OnChangedIsAliveProduct(robotManager.Products.Products.IsAliveProductChangeEventArgs e)
    	{
    		Logging.Write("@@@ TEST OnChangedIsAliveProduct " + e);
    	}
    	private void OnProductRestarting(string str)
    	{
    		Logging.Write("@@@ TEST OnProductRestarting " + str);
    	}
    	private void OnProductStopped(string str)
    	{
    		Logging.Write("@@@ TEST OnProductStopped " + str);
    	}
    	private void OnProductStopping(string str)
    	{
    		Logging.Write("@@@ TEST OnProductStopping " + str);
    	}
    	private void OnProductStarted(string str)
    	{
    		Logging.Write("@@@ TEST OnProductStarted " + str);
    	}
    	private void OnProductStarting(string str)
    	{
    		Logging.Write("@@@ TEST OnProductStarting " + str);
    	}
    	void OnProductLoaded(string productName)
    	{
    		Logging.Write("@@@ TEST OnProductLoaded " + productName);
    	}
    	void OnProductDispose(string productName)
    	{
    		Logging.Write("@@@ TEST OnProductDispose " + productName);
    	}
    	void OnProductPauseStarted(string productName)
    	{
    		Logging.Write("@@@ TEST OnProductPauseStarted " + productName);
    	}

    i got two profiles. first one subscribe on events and load second profile (LoadProfile step in questing order list). second profile is empty with log message

    i run this code in static class constructor of attached custom script test.cs

    this gives me log:

    02:03:10 - @@@ TEST OnChangedIsAliveProduct robotManager.Products.Products+IsAliveProductChangeEventArgs
    02:03:11 - [PathTracer] started
    02:03:11 - --- TEST START ---
    02:03:11 - --- TEST COMPLETE ---
    02:03:11 - [Quester] Started
    02:03:13 - === TEST2 START ===
    02:03:13 - --- TEST 2 DONE ---

    is there and posibility to track that current quester profile changed?

    i tryed to check Quester.Bot.QuesterSetting.CurrentSetting.ProfileName but its still same: first profile

    logicaly, one of this events should fire when other profile loaded, but nothing happened. 

    robotManager.Events.ProductEvents.OnDisposeProduct

    robotManager.Events.ProductEvents.OnProductRestarting

    robotManager.Products.Products.OnChangedIsAliveProduct

    robotManager.Products.Products.OnChangedIsStarted

     

    any info or tip how i can track profile change and load?

  6. [Serializable]
    public class HunterBeastmasterSettings : Settings
    {
    	const string FILE_PREFIX = "CustomClass-HunterBeastmaster";
    
    	[Setting]
    	[DefaultValue(true)]
    	[Category("Combat Spells - Hunter Abilities")]
    	[DisplayName("Hunter's Mark Disabled")]
    	[Description("Is Hunter's Mark Disabled?")]
    	public bool HuntersMark { get; set; }
    
    	[Setting]
    	[DefaultValue(true)]
    	[Category("Combat Spells - Hunter Abilities")]
    	[DisplayName("Steady Shot")]
    	[Description("Use Steady Shot")]
    	public bool SteadyShot { get; set; }
    
    	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(FILE_PREFIX, ObjectManager.Me.Name + "." + Usefuls.RealmName));
    		}
    		catch (Exception e)
    		{
    			Logging.WriteError(FILE_PREFIX + " save error: " + e);
    			return false;
    		}
    	}
    
    	public static bool Load()
    	{
    		try
    		{
    			if (File.Exists(AdviserFilePathAndName(FILE_PREFIX, ObjectManager.Me.Name + "." + Usefuls.RealmName)))
    			{
    				CurrentSetting = Load<HunterBeastmasterSettings>(AdviserFilePathAndName(FILE_PREFIX, ObjectManager.Me.Name + "." + Usefuls.RealmName));
    				CurrentSetting.PushToLua(); // SETTINGS LOADED, MUST BE TRANSLATED TO LUA
    				return true;
    			}
    			CurrentSetting = new HunterBeastmasterSettings();
    
    		}
    		catch (Exception e)
    		{
    			Logging.WriteError(FILE_PREFIX + " load error: " + e);
    		}
    		return false;
    	}
    	void FetchFromLua()
    	{
    		HuntersMark = Lua.LuaDoString<bool>("return HuntersMarkDisabled");
    	}
    
    	void PushToLua()
    	{
    		Lua.LuaDoString("HuntersMarkDisabled = " + HuntersMark);
    	}
    }

     

  7. #if VISUAL_STUDIO
    using robotManager.Helpful;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using wManager.Wow.Bot.Tasks;
    using wManager.Wow.Class;
    using wManager.Wow.Helpers;
    using wManager.Wow.ObjectManager;
    using wManager.Wow.Enums;
    using System.Configuration;
    using System.ComponentModel;
    using System.IO;
    #endif
    
    [Serializable]
    public class TestSettings : Settings
    {
    	[Setting]
    	[DefaultValue(true)]
    	[Category("GHOST WOLF SETTINGS")]
    	[DisplayName("Ghost Wolf")]
    	[Description("Use Ghost Wolf")]
    	public bool UGW { get; set; }
    
    	[Setting]
    	[DefaultValue(4)]
    	[Category("GHOST WOLF SETTINGS")]
    	[DisplayName("Use after X secondes")]
    	[Description("Use Ghost Wolf after X secondes out of combat")]
    	public int TGW { get; set; }
    
    	public static TestSettings CurrentSetting { get; set; }
    
    	public TestSettings()
    	{
    	}
    
    	public bool Save()
    	{
    		try
    		{
    			
    			return Save(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
    		}
    		catch (Exception e)
    		{
    			Logging.WriteError("CustomClass_ShamanSettings > Save(): " + e);
    			return false;
    		}
    	}
    	public static bool Load()
    	{
    		try
    		{
    			if (File.Exists(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
    			{
    				CurrentSetting = Load<TestSettings>(AdviserFilePathAndName("CustomClass_Shaman", ObjectManager.Me.Name + "." + Usefuls.RealmName));
    			}
    			else
    			{
    				CurrentSetting = new TestSettings
    				{
    					UGW = true,
    					TGW = 4,
    				};
    			}
    			CurrentSetting.PushToLua();
    			return true;
    		}
    		catch (Exception e)
    		{
    			Logging.WriteError("CustomClass_ShamanSettings > Load(): " + e);
    		}
    		return false;
    	}
    	void PushToLua()
    	{
    		UGW = Lua.LuaDoString<bool>("return luaVar");
    	}
    
    	void FetchFromLua()
    	{
    		Lua.LuaDoString("UGW = " + UGW);
    	}
    }

    quick and dirty example

  8. its a very bad practice to save variables between sessions like "c# -> wrobot -> lua -> wow -> addon -> disk" for wrobot and vice versa to load it.

    you can load wrobot settings and set lua vars after load for your lua-fightclass. this allow you to skip dependancy from wow addon and store everything you need for fightclass

  9. god, why so agressive? there is a small bits of information on this forum, i just whant to explain you how you can solve 99% of wrobot problems by your own.

    but lazy and agressive peoples like you, prefer to ask questions whats required a 5 minutes of time and brain working.

    my second link, first google link lead to 

     

    there is everything you need for saving and loading data/params between wrobot sessions.

    second google link gives complete info too. whats wrong with you? if you can't search internet and im trying to help, why you aggroed? since 24 aug, im only one who helping with answers in this topic. sorry if i hurt your feelings in any way. i hope you understand how to search strict string on current site and follow the trail to get answers in 5-10 mins and dont wait 3 weeks for "kind stranger"

     

×
×
  • Create New...