Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Add event handler or hook to add new state safely

  • Product: WRobot General
  • Type: Bug
  • Status: Unconfirmed

Right now, I use FiniteStateMachine Events and add new states. This causes issues when not all states have been loaded correctly and for some people if the Quester uses a LoadProfile or Reload step, it "breaks" the FSM context because state are already added. 

Can you add some method I can utilize to add states to the FSM, for example "aftersuccessfulstart" or something?

User Feedback

Recommended Comments

Hi, you get same problem with "OnStartEngine"? You can also try to use "OnAddState" when  bot add "Idle" (it is all time last state)

Matenia

Elite user

When I use OnStartEngine, none of the states have been added yet and I need to get their priority (and in some cases, I need to add NextStates).
I will try OnAddState I think

Matenia

Elite user
(edited)

OnAddState does not work it seems. It's never called inside the plugin.
OnStartEngine, all states are missing. 

Edited by Matenia

and code like:

Engine lastEngine = null;
robotManager.Events.FiniteStateMachineEvents.OnBeforeCheckIfNeedToRunState +=
    delegate(Engine engine, State state, CancelEventArgs cancelable)
    {
        try
        {
            if (engine == null || engine.States == null)
                return;

            if (engine != lastEngine)
            {
                if (engine.States.Any(s => s is Idle))
                {
                    lastEngine = engine;
                    engine.AddState(new MyCustomState()); // or engine.States.Insert(X, new MyCustomState());
                    // cancelable.Cancel = true; ??
                }
            }
        }
        catch { }
    };

 

Matenia

Elite user

Thank you, I did something similar but this should help in case it reloads the engine (Quester reload etc).

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.