• Visit Rebornbuddy
  • RebornBuddyCN r202

    Discussion in 'Rebornbuddy Forum' started by mastahg, Aug 26, 2014.

    1. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      4,575
      Likes Received:
      240
      Trophy Points:
      63
      Are you testing that in the console, a test file, or a compiled assembly?
      Unless you manually upgraded the roslyn compiler the $ and ? is unsupported in the console/files.


      But regardless of that, there can be buttons without labels, so check that button.isvalid and button.label.isvalid, as the button simply contains a label.
       
    2. Akira0245

      Akira0245 Member

      Joined:
      Mar 9, 2019
      Messages:
      37
      Likes Received:
      0
      Trophy Points:
      6
      Sorry I only checked the label is not null, added an IsValid check then it works:)
      for the console, yes I upgraded it to use the roslyn complier included in rb folder.
       
    3. Akira0245

      Akira0245 Member

      Joined:
      Mar 9, 2019
      Messages:
      37
      Likes Received:
      0
      Trophy Points:
      6
      hi mastahg, i met some trouble when trying to use the Lua class. many of the client lua functions such as
      Code:
      Log(Lua.GetReturnVal<string>("return _G['CmnDefHousingSignboard:721031']:OpenSignboard()"));
      or
      Code:
      Log(Lua.GetReturnVal<string>("return _G['Pc:0000014924BFCCA0']:BalloonTalk()"));
      throws an "attempt to index a nil value" exception, google says it's because the function being called is a local function so the the calling procedure must be later than it declares... but i really don't know how to control the time to calling them properly... Can you help me?
       
      Last edited: Oct 30, 2020
    4. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      4,575
      Likes Received:
      240
      Trophy Points:
      63
      I don't recommend you touch anything with lua unless you know exactly what the game is doing, as most of the functions must be called with parameters.
       
    5. Akira0245

      Akira0245 Member

      Joined:
      Mar 9, 2019
      Messages:
      37
      Likes Received:
      0
      Trophy Points:
      6
      mastahg sorry to bother again, i am trying to use NavGraph in a botbase as navigator, i ran this in console
      Code:
      Task.Run(async () =>
      {
          Log("getting path");
          var path = await NavGraph.GetPathAsync(WorldManager.ZoneId,
              FateManager.ActiveFates.Where(i => i.IsValid)
                  .OrderBy(i => i.Location.Distance(Core.Me.Location)).First().Location);
          Log("received path");
      });
      i tried these codes both in an async botbase and reborn console, but its output is always "getting path" and nothing more...
      is it possible to use NavGraph in another botbase? or it is limited for orderbot usage?
       
    6. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      4,575
      Likes Received:
      240
      Trophy Points:
      63
      Coroutines are not compatible with the standard Task.run

      There isnt a good way to test/run coroutines from the console.

      If I really need to test them I use a dummy botbase, i imagine you could modify this to wait for the console to assign a function and then it would execute that.


      Code:
          public class CoroutineBot : BotBase
          {
              public override string Name
              {
                  get { return "CoroutineBot"; }
              }
      
              public override bool RequiresProfile
              {
                  get { return false; }
              }
      
      
              public override PulseFlags PulseFlags
              {
                  get { return PulseFlags.All; }
              }
      
              public static async Task<bool> dowork()
              {
      
                  var bagslot = InventoryManager.FilledSlots.FirstOrDefault(r => r.RawItemId == 4870);
                  await CommonTasks.HandOverRequestedItems();
                  return true;
              }
      
      
              private Composite _cache;
              public override Composite Root
              {
                  get
                  {
      
                      if (_cache != null)
                      {
                          return _cache;
                      }
      
                      _cache = new PrioritySelector(new ActionRunCoroutine(r => dowork()));
                      return _cache;
                  }
              }
      
              public override void Start()
              {
                  Navigator.NavigationProvider = new ServiceNavigationProvider();
                  Navigator.PlayerMover = new SlideMover();
              }
      
              public override void Stop()
              {
                  (Navigator.NavigationProvider as IDisposable)?.Dispose();
                  Navigator.NavigationProvider = null;
              }
          }
      
      
      This also does not demonstrate optimal practices, just an example of how it could be done. Using an AsyncBotBase would probably better.
       
      Akira0245 likes this.

    Share This Page