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.

EventsLuaWithArgs.OnEventsLuaWithArgs not firing some events

  • Version: All
  • Product: WRobot General
  • Type: Bug
  • Status: Not a Bug

Hey @Droidz

I tested on 1.12:

EventsLuaWithArgs.OnEventsLuaWithArgs += CastingEventHandler;
private void CastingEventHandler(LuaEventsId id, List<string> args)
    {
        if (id == LuaEventsId.SPELLCAST_STOP)
        {
            _LastSpell = args[1];
            _LastCastTimeStamp = DateTime.Now.AddMilliseconds(double.Parse(args[0]));
            if (_LastSpell == "Polymorph")
            {
                _LastPoly = DateTime.Now.AddMilliseconds(double.Parse(args[0]));
            }
            Logging.WriteDebug("Last cast spell " + args[1] + " with cast time: " + args[0]);
        }
        if(id == LuaEventsId.SPELLCAST_DELAYED)
        {
            _LastCastTimeStamp = _LastCastTimeStamp.AddMilliseconds(double.Parse(args[0]));
            if(_LastSpell == "Polymorph")
            {
                _LastPoly = _LastPoly.AddMilliseconds(double.Parse(args[0]));
            }
        }
    }

but my code is never even called.
I think the handler just doesn't receive info on those events in wRobot vanilla.

User Feedback

Recommended Comments

Matenia

Elite user

3ImTerm.png

For the following code:

class AntiDrown
{
    private static DateTime BreathExpires = DateTime.MaxValue;

    public static void Start()
    {
        EventsLuaWithArgs.OnEventsLuaWithArgs += AntiDrownEventHandler;
    }

    public static void Stop()
    {
        EventsLuaWithArgs.OnEventsLuaWithArgs -= AntiDrownEventHandler;
    }

    private static void AntiDrownEventHandler(LuaEventsId id, List<string> args)
    {
        
        if (id == LuaEventsId.MIRROR_TIMER_START)
        {
            Logging.WriteDebug(args[0] + "  " + args[1]);
        }
        if (id == LuaEventsId.MIRROR_TIMER_START && args[0] == "BREATH")
        {
            //sets BreathExpires to be in the future by x milliseconds
            BreathExpires = DateTime.Now.AddMilliseconds(double.Parse(args[1]));
            Logging.WriteDebug("Breath has " + double.Parse(args[1]) + " milliseconds left");
        }
    }

    public static void DontDrown()
    {
        //check if we drown in less than 5 seconds
        while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && DateTime.Now.AddSeconds(5) > BreathExpires)
        {
            Move.JumpOrAscend();
            Thread.Sleep(500);
        }
    }
}

I call Start and Stop methos from plugin.

Matenia

Elite user
(edited)

Maybe the problem is that I reference TBC libraries of wRobot? I compile 1 dll for vanilla + tbc. 
It shouldn't really change anything, but maybe it does? I thought events remained the same
Maybe same problem as here:

I use TBC LuaEventsId.PLAYER_DEAD and it's different in different expacs.

Edited by Matenia

54 minutes ago, Matenia said:

Maybe the problem is that I reference TBC libraries of wRobot? I compile 1 dll for vanilla + tbc. 
It shouldn't really change anything, but maybe it does? I thought events remained the same
Maybe same problem as here:

I use TBC LuaEventsId.PLAYER_DEAD and it's different in different expacs.

It is that I think, Event id change frequently, and when you compile DLL, compiler put id in dll (not the enum name).

To fix it, try to (by sample) replace:

if (id == LuaEventsId.MIRROR_TIMER_START)

by

if (id.ToString() == "MIRROR_TIMER_START")

 

Matenia

Elite user

working solution

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.