• Visit Rebornbuddy
  • Help fixing a simple /dnd plugin

    Discussion in 'Requests' started by Cukie, Feb 22, 2015.

    1. Cukie

      Cukie Active Member

      Joined:
      Dec 3, 2011
      Messages:
      1,255
      Likes Received:
      3
      Trophy Points:
      38
      I had a simple dnd plugin someone wrote for me that simply puts up a /dnd message when enabled, but it has broken during one of the previous HB updates, and now I am getting compile errors! Please help!!

      Code:
      Compiler Error: f:\HB\Plugins\DND\DND.cs(15,30) : error CS0115: 'DND.DND.Initialize()': no suitable method found to override
      Compiler Error: f:\HB\Plugins\DND\DND.cs(16,30) : error CS0115: 'DND.DND.Dispose()': no suitable method found to override


      Code:
      using System;
      using System.Windows.Media;
      using System.Threading;
      
      using Styx.Common;
      using Styx.Common.Helpers;
      using Styx.Plugins;
      using Styx.WoWInternals;
      
      namespace DND
      {
          public partial class DND : HBPlugin
          {
          #region Overrides of HBPlugin 
              public override void Initialize(){}
              public override void Dispose(){}
      
              public override string  ButtonText { get { return "No Settings"; } }
              public override bool    WantButton { get { return false; } }
              public override void OnButtonPress() {}
              public override string  Name { get { return "DND"; } }
              public override string  Author { get { return "Powa"; } }
              public override Version Version { get { return new Version(0, 1); } }
      
              public override void Pulse()
      		{
      			
      			//getting dnd info
                  bool isDND = Lua.GetReturnVal<bool>("return  UnitIsDND(\"player\")",0);
      			if(isDND==false)
      			{	String msg = "INSERT MESSAGE HERE";   // Choose your message here 
      			
      	            Lua.DoString("RunMacroText(\"/dnd "+msg+ "\")"); 
      				Logging.Write(Colors.SeaGreen, "Your are now Busy : DND");
      				Thread.Sleep(1000);
      			}
      		}
      
          #endregion
          }
      }
       
    2. Opply

      Opply Community Developer

      Joined:
      Feb 28, 2013
      Messages:
      328
      Likes Received:
      29
      Trophy Points:
      0
      Remove the lines:

      public override void Initialize(){}
      public override void Dispose(){}

      and it should fix your error...

      However, this code will hammer your client with the same LUA request 'return UnitIsDND("player")' many times a second..

      adding some code to only to this like once a minute is probs a smart thing.
      I think the FPSRefresher plugin do this, would check it out :)

      I would also the line saying Thread.Sleep, will just fuck things up..
       
      Cukie likes this.
    3. Cukie

      Cukie Active Member

      Joined:
      Dec 3, 2011
      Messages:
      1,255
      Likes Received:
      3
      Trophy Points:
      38
      Hmm, I can't seem to find FPSRefresher, do you have a link by chance?
       
    4. Opply

      Opply Community Developer

      Joined:
      Feb 28, 2013
      Messages:
      328
      Likes Received:
      29
      Trophy Points:
      0

    Share This Page