Jump to content

Executing Lua code only once after I die


Matenia

Recommended Posts

Is there any way in my fight class to execute Lua code, whenever I die, once?
I want it to call ReloadUI() to prevent the combat rotation from stopping randomly on a MoP client.

 

I tried some custom scripts, but the bot never executed them (and there is that issue of only doing it ONCE too).

Link to comment
Share on other sites

Hello,

in the fightclass editor, in "Additionnal C# code" (top left) put this code:

    static Main()
    {
        bool lastState = false;

        while (Conditions.ProductIsStarted)
        {
            if (Conditions.InGameAndConnectedAndProductStartedNotInPause &&
                !Conditions.IsAttackedAndCannotIgnore)
            {
                if (lastState && !ObjectManager.Me.IsDeadMe)
                {
                    Logging.WriteDebug("Retrieve corpse, ReloadUI");
                    Lua.LuaDoString("ReloadUI()");
                }
                lastState = ObjectManager.Me.IsDeadMe;
            }
            Thread.Sleep(100);
        }
    }

 

Link to comment
Share on other sites

That bugs it entirely, so the bot only keeps working if I turn it on/off (for one fight, but it doesn't run unless I turn it on, and doesn't fight unless I turn it off).
Probably a multithreading issue.

But it's okay, I'll use this to write a custom plugin instead.

Link to comment
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...