• Visit Rebornbuddy
  • Initialize() RB 32/64

    Discussion in 'Community Developer Forum' started by newb23, Oct 3, 2016.

    1. newb23

      newb23 Community Developer

      Joined:
      Nov 26, 2014
      Messages:
      397
      Likes Received:
      15
      Trophy Points:
      18
      Good afternoon!

      I wanted to verify that I understood what was happening in the Initialize() portion of routines specifically.

      When I load up RB32, the initial routine that I choose fires Initialize() and all other code called within the Initialize() method and ONLY for that selected, active routine - no others.

      When I load up RB64, the initial routine that I choose doesn't appear to fire Initialize() at all, until I change routines for the first time. After that first routine change, it loads Initialize() and all associate code for ONLY the selected routine, but only after changing routines at least once. It will then however fire Initialize() for each routine you change to, every time you change to that routine.

      I assume the RB32 behavior is correct and RB64 will need to be corrected, but wanted to verify.

      Thank you!
       
      y2krazy likes this.
    2. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      I'm unable to replicate any issues on x64.

      I installed this dummy routine
      Code:
      using System;
      using System.Collections.Generic;
      using System.IO;
      using System.Linq;
      using System.Linq.Expressions;
      using System.Runtime.CompilerServices;
      using System.Text;
      using System.Threading;
      using System.Threading.Tasks;
      using System.Windows.Forms;
      using ff14bot.AClasses;
      using ff14bot.Enums;
      using ff14bot.Forms.RoutineSelector;
      using ff14bot.Helpers;
      using ff14bot.Interfaces;
      using ff14bot.Settings;
      using Clio.Utilities;
      using ff14bot.Behavior;
      using TreeSharp;
      using ff14bot;
      namespace ff14bot
      {
      
          public class DerpTest : CombatRoutine
          {
              public override ClassJobType[] Class
              {
                  get
                  {
                      return new ClassJobType[] { Core.Player.CurrentJob };
                  }
              }
      
              public override string Name
              {
                  get
                  {
                      return "DerpTest";
                  }
              }
      
              public DerpTest()
              {
              }
      
              public override float PullRange
              {
                  get { return 0; }
              }
      
              public override void Initialize()
              {
      			Logging.Write("Hello");
              }
          }
      }
      
      And selected kupo at startup, and as expected the kupo initalizer is called.

      Since there is actually X copies of kupo running, id expect to see many versions announcing their initalization
       
    3. newb23

      newb23 Community Developer

      Joined:
      Nov 26, 2014
      Messages:
      397
      Likes Received:
      15
      Trophy Points:
      18
      I am still seeing the same behavior when loading up my routine. Attached is my Main class for the routine, and a log showing me loading up RB 64, selecting my routine, not having Init fire, changing to a DoH class, switching back, THEN having Initialize fire.

      The Initialize Method itself:
      Code:
              public void Initialize()
              {
                  Logger.KefkaLog(@"Initializing");
      
      
                  TreeRoot.OnStart += OnBotStart;
                  TreeRoot.OnStop += OnBotStop;
                  GameEvents.OnClassChanged += OnClassChanged;
      
      
                  var _class = RoutineManager.CurrentClass;
                  InterruptManager.ResetInterrupts();
                  TankBusterManager.ResetTankBusters();
                  OpenerManager.ResetOpeners();
                  HotkeyManager.UnregisterAllHotkeys();
              }
      
       

      Attached Files:

    4. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      Your not inheriting CombatRoutine so the bot doesn't see your routine.

      Edit or maybe i misunderstand what your trying todo, but regardless you've got a bunch of stuff installed, and the only way .Initialize ever gets called is when routinemanager.current is switched. Since i verified that its working properly on my end, you should try a clean install and add things one at a time to figure out whats broken. But thats all im going comment in this thread as no support for third party precompiled works.
       
    5. newb23

      newb23 Community Developer

      Joined:
      Nov 26, 2014
      Messages:
      397
      Likes Received:
      15
      Trophy Points:
      18
      AH, I see. Ha! I'll keep playing around with it. Thank you!
       
    6. newb23

      newb23 Community Developer

      Joined:
      Nov 26, 2014
      Messages:
      397
      Likes Received:
      15
      Trophy Points:
      18
      I wanted to throw a reply in here after finally figuring out what the issue was, in case it leads to further help later down the road for someone.

      IF the routine selection window is not fired at the beginning of the bot starting up, IE: You only have ONE routine that supports the class you're currently running, and it defaults in to whatever routine, Initialize() for that routine will not fire.

      ^ I assume is the reason for this. ^


      IF you literally have to choose your routine in the routine select window during inital startup, it will fire Initialize().

      Thank you Mastahg for your insight into WHEN initialize is fired, set me one the right track! Glad it had nothing to do with third party, whew!
       
      Last edited: Oct 6, 2016
    7. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,232
      Likes Received:
      364
      Trophy Points:
      83
      This is incorrect, the initial state is that no routine is selected, so when the default gets set it gets called. You can see this is the case if you do a clean install and look at kupo.cs
       
    8. newb23

      newb23 Community Developer

      Joined:
      Nov 26, 2014
      Messages:
      397
      Likes Received:
      15
      Trophy Points:
      18
      I did verify that ONLY having Kupo initializes like you said that it would, so, I don't know what's up specifically, or why mine works as Kupo does in 32, but not 64. *shrug*

      Changing nothing except adding another routine that supports the initial class upon startup, and thus having to choose between the two, has been working in every instance since I added another routine in there, then choosing mine.

      Regardless, I have found a solution through your guidance, even if it wasn't quite the path you expected me to find, so, thank you. :p
       

    Share This Page