What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

How to check if own Plugin is enabled?

sunb

New Member
Joined
Jan 26, 2012
Messages
5
Reaction score
0
Hi there!

At the moment I am trying to develop my first Plugin. It`s just a extra Statuswindow which shows count of looted Items.
It is no problem to create a window and update it.

My problem is, that this window allways appears - even if the plugin is disabled.
So i thought about checking if my plugin is enabled before creating the extra window. But I can`t find a way to do this.

Anybody has some hints for me?

Thanks
mike
 
if the window is always coming up, chances are you have your window code in the wrong place, post your code and ill take alook.
 
At the moment my testwindow.show(); is in the constructor of my class.
I just thougt about checking if window is enabled in pulse().
if it is not enabled just show it up. I`m gonna try this right now.
 
Ok I my thoughts didn`t work.

Here my testcode:

PHP:
namespace sunb_status
{
    public class sunb_status : HBPlugin
    {
        //Normal Stuff.
        public override string Name { get { return "sunb_status"; } }
        public override string Author { get { return "SunB"; } }
        public override Version Version { get { return new Version(1, 0); } }
        public override bool WantButton { get { return false; } }
        public override string ButtonText { get { return "sunb_status"; } }

        public static bool init;
        public status mks;
        private static readonly LocalPlayer Me = ObjectManager.Me;

        //Uncomment if adding a UI for the plugin
        /*public override void OnButtonPress()
        {
        }*/
        
        public sunb_status()
        {
            status mks = new status();
            log("white", "testlog in constructor!");
        }

        public override void Pulse()
        {
            if (!sunb_status.init)
            {
                Initme();
            }
            
        }

        private void log(string color, string text)
        {
            Logging.Write(Color.FromName(color), "[sunb_status] - " + text);
        }

        private void Initme()
        {
            sunb_status.init = true;
            log("white", "Testlog in Initme");
            mks.Show();    
        }
     }
}

The window (mks) shows allways - even if the plugin is disabled. I do not know how to change this.

Thanks in advance.
Mike
 
never use constructors for loading things, since they always load even if your plugin is not.
Code:
     public override void Initialize()
        {



        }
copy that and stick your code in there.
 
Back
Top