Jump to content

Recommended Posts

@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?

Link to comment
https://wrobot.eu/forums/topic/7100-product-events/
Share on other sites

Hello, you can try with log like (t.xml):

        robotManager.Events.LoggingEvents.OnAddLog += delegate(robotManager.Helpful.Logging.Log log)
        {
            // Logging.WriteDebug("[Quester] LoadProfile: " + Bot.Profile.QuestsSorted[i].NameClass);
            var logStartBy = "[Quester] LoadProfile: ";
            if (log != null && log.LogType == robotManager.Helpful.Logging.LogType.Debug && log.Text.StartsWith(logStartBy))
            {
                var profile = log.Text.Remove(0, logStartBy.Length).Trim();
                System.Windows.Forms.MessageBox.Show("Profile changed: " + profile);
            }
        };

(you can also write custom log from your profile and track it with "LoggingEvents.OnAddLog")

Link to comment
https://wrobot.eu/forums/topic/7100-product-events/#findComment-32220
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...