• Visit Rebornbuddy
  • Plugin creation questions

    Discussion in 'Community Developer Forum' started by tmask, Oct 22, 2014.

    1. tmask

      tmask New Member

      Joined:
      Jun 18, 2011
      Messages:
      22
      Likes Received:
      0
      Trophy Points:
      1
      Sorry for the noob questions, but im hoping to get some help with two questions, as im totally new to this.

      First im trying to get a log printout of the closest enemies but the code i found gives me errors:
      Code:
      ClearLog();
      foreach(var x in GameObjectManager.GameObjects.OrderBy(r=>r.Distance()))
      {
      Log("Name:{0} Visible:{1} Type:{2} Distance:{3} ObjectType:{4} ObjectID:{5}",x,x.IsVisible,x.Type,x.Distance(),x.GetType(),x.ObjectId);
      }
      
      this gives me:
      [23:42:02.574 N] Compiler Error: c:\Users\owner\Downloads\rebornbuddy\Plugins\GStealth\GStealth.cs(108,1) : error CS0122: 'System.Diagnostics.Log' is inaccessible due to its protection level
      Currious how I can get this to work

      Next im trying to detect enemies close by and if there are any, to cast stealth

      Code:
        target =(from unit in GameObjectManager.GetObjectsOfType<BattleCharacter>()
                           where unit.Type == GameObjectType.BattleNpc
                           where unit.Location.Distance(Core.Player.Location) < 30
                           where unit.CanAttack
                           where unit.IsVisible
                           orderby unit.Distance(Core.Player.Location) ascending 
                           select unit).FirstOrDefault();
      
                      if (target != null)
                      {
       					Spell.Cast("Stealth",  r =>!IsStealthed);
                      }
                      if (target == null)
      			{
      					Spell.Cast("Stealth",  r =>IsStealthed);
      			}
      
      this compiles but doesnt actually do anything. Which is why im trying to get a log readout via the first code. And lastly, dumb question, is there any to force rebornbuddy to recompile the plugins without having to close and reopen RB?

      Thanks!
       
    2. kagamihiiragi17

      kagamihiiragi17 Community Developer

      Joined:
      Jun 24, 2014
      Messages:
      873
      Likes Received:
      25
      Trophy Points:
      0
      Log is for RebornConsole. To write to the RB log use Logging.Write.

      Spell.Cast is a helper function of Magitek. To cast spells in RB check ff14bot.Managers.Actionmanager. That namespace has everything you need. You're also not setting the IsStealthed variable to true or false after casting the spell as far as I can see.
       
    3. Endus

      Endus Community Developer

      Joined:
      Jul 9, 2012
      Messages:
      458
      Likes Received:
      6
      Trophy Points:
      18
      One of these days we need someone to set up some proper documentation for RebornBuddy to make it easier for new devs. Something like:

      Honorbuddy Namespaces
       
    4. exaccuss

      exaccuss Active Member

      Joined:
      Nov 10, 2013
      Messages:
      1,021
      Likes Received:
      6
      Trophy Points:
      38
      Couldn't agree more. I would love to try my hand at making some profiles, but I'm just so confused at where to start lol
       
    5. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,231
      Likes Received:
      364
      Trophy Points:
      83
      Having access to the object structure wont really help you there.

      https://www.thebuddyforum.com/rebor...m/183675-using-visual-studio-rebornbuddy.html

      Setting up the documentation was turning out to be a huge pain in the ass so its not going to happen for a while. (It's not something only I could do either...someone who wants it so badly could take the time todo it, you have the exe and xml that contains everything it uses)
       
    6. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      Just to clarify what mastahg said:

      You can find all of the rebornbuddy documentation such as the Honorbuddy Namespace and more inside of the api
       
    7. tmask

      tmask New Member

      Joined:
      Jun 18, 2011
      Messages:
      22
      Likes Received:
      0
      Trophy Points:
      1
      Thanks for all the information! I didnt realize you could get all that information through visual studio, thats very handy. Is there a specific function to pause RB activity? Im trying to make a plugin that will stop whatever it is doing if it detects a player in range. Ive tried using Thread.Sleep(); and setting it to wait for say a minute which kind of works, but causes lots of other problems. Im wanting to use it with the Gather and Grinding routines. Is there a way to specifically tell those routines to stop until a condition is met?
       
    8. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      I haven't messed with plugins in a long time but maybe you could use a composite and return true/runstatus.success?
       

    Share This Page