Results 1 to 13 of 13

Thread: TReflectGroundItemArray appears to not work as intended

  1. #1
    Join Date
    Nov 2015
    Posts
    73
    Mentioned
    1 Post(s)
    Quoted
    31 Post(s)

    Default TReflectGroundItemArray appears to not work as intended

    Using this code:

    Code:
    procedure myProcedure;
    var
        TheItems: TReflectGroundItemArray;
      I: Integer;
      Point: TPoint;
    begin
    
    
      TheItems.GetAll(3);
    
    
    
      for i:= 0 to High(TheItems) do
        begin
          writeln(TheItems[i].GetName );
    
        if IsArrInStr(['Potato'], TheItems[i].GetName) then
        begin
        wait(500+random(500));
          Point:= TheItems[i].GetMSPoint;
    Insert whatever item you want to pick up/manipulate with the TPoint into potato. This code is supposed to iterate through every item on the ground in X tiles near the player, but it never finds anything. Upon further inspection, when TheItems[i].GetName is printed, they are all called either "Toolkit" or "Instruction manual". I assume this is a bug.

  2. #2
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Are you using it in a potato field, or to actually pickup potatoes that have been dropped?

  3. #3
    Join Date
    Nov 2015
    Posts
    73
    Mentioned
    1 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by Aspect View Post
    Are you using it in a potato field, or to actually pickup potatoes that have been dropped?
    I'm using it in a chicken pen with feather as the item in the array, but it holds with any item that has been dropped by any npc as far as I can tell.

  4. #4
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

    Default

    Alright, and also the code you posted doesn't have any code to move the mouse, or do anything. Only to obtain information.
    var
    Grounds: TReflectGroundItemArray;
    I: Integer;

    Simba Code:
    begin
      Grounds.GetAll(20);

      for I := 0 to High(Grounds) do
      begin
          begin
            Reflect.Mouse.Move(Grounds[I].GetMSPoint, 0, 0);
            Reflect.Mouse.Click(Mouse_Right);
            Reflect.Text.ChooseOption(Grounds[I].GetName);
          end;
      end;
    end.
    Last edited by Aspect; 05-06-2017 at 07:19 AM.

  5. #5
    Join Date
    Nov 2015
    Posts
    73
    Mentioned
    1 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by Aspect View Post
    Alright, and also the code you posted doesn't have any code to move the mouse, or do anything. Only to obtain information.
    var
    Grounds: TReflectGroundItemArray;
    I: Integer;

    Simba Code:
    begin
      Grounds.GetAll(20);

      for I := 0 to High(Grounds) do
      begin
          begin
            Reflect.Mouse.Move(Grounds[I].GetMSPoint, 0, 0);
            Reflect.Mouse.Click(Mouse_Right);
            Reflect.Text.ChooseOption(Grounds[I].GetName);
          end;
      end;
    end.
    It prints the name of every item in the array, which will be wrong on testing. But yeah, also the code you provided will also not work, assuming you don't want to pick up every single thing near you.

  6. #6
    Join Date
    Aug 2016
    Location
    Kentucky
    Posts
    254
    Mentioned
    3 Post(s)
    Quoted
    96 Post(s)

  7. #7
    Join Date
    Apr 2013
    Posts
    680
    Mentioned
    13 Post(s)
    Quoted
    341 Post(s)

    Default

    Goto you Hooks file change

    Code:
    {Item: as}
     Item_StackSizes: THook =             ['c', 1707626481];
     Item_ID: THook =                    ['d', -933263931];
    As for the code

    Code:
    function loot(D: Integer): boolean;
    var
      e,i, j: integer;
      _gItems: TReflectGroundItemArray;
       s : string;
       InInv: TReflectInvItem;
       gItems : tstringarray;
    begin
    gItems := [ 'bones','big bones','bronze bar'];
    
        _gItems.GetAll(D);
    
    if length(_gItems) = 0 then Exit;
        for i := 0 to high(_gItems) do begin
          for j := 0 to high(gItems) do begin
    
            if  (pos(gItems[j], lowercase(_gItems[i].getName)) > 0) then begin
    
               If InteractTileOnce(_gItems[I].GetTile, 'Take ', 'Take ' + _gItems[I].GetName, Mouse_Right,0,0,0)then
                 writeln('Picked up: '+ _gItems[I].GetName);
            end;
         end;
     end;
    end;
    Code:
    procedure loot;
    var
      i, j, me_indice: integer;
      _gItems: TReflectGroundItemArray;
      gItems: tstringarray;
       s : string;
    begin
      _gItems.GetAll;
      for i := 0 to high(_gItems) do
        begin
          for j := 0 to high(gItems) do
          begin
            if (pos(gItems[j], lowercase(_gItems[i].getName)) > 0) then
            begin
                s:=_gItems[i].GetName;
                begin
                 Mouse.Move(_gItems[i].GetMSPoint, 2, 2);
                  Wait(50);
                  Mouse.Click(Mouse_Right);
                  Wait(50);
                   Reflect.Text.ChooseOption('Take '+s);
                   end
                  waitMove(3000);
              end;
            end;
          end;
        end;
    Can use the above if you don't have your own custom interactonce or similar function..



    But there is still one more problem... It will search through the piles.. but it returns to the last pile and false clicks.- where as it should release the final TPoint

    Something i need to discuss && resolve

    I have written the looting function 4 different ways; they all result with the same bug.

    <------------------>



  8. #8
    Join Date
    Nov 2015
    Posts
    73
    Mentioned
    1 Post(s)
    Quoted
    31 Post(s)

    Default

    Cool man, let me know if I can do anything to test or help. I'd love to learn how to update this stuff on my own.

    It appears to work with those changes, but only can see the items on the bottom of a stack.

  9. #9
    Join Date
    Apr 2013
    Posts
    680
    Mentioned
    13 Post(s)
    Quoted
    341 Post(s)

    Default

    Quote Originally Posted by terd View Post
    Cool man, let me know if I can do anything to test or help. I'd love to learn how to update this stuff on my own.

    It appears to work with those changes, but only can see the items on the bottom of a stack.
    When i get home; i will debug ground items again.. when i quickly tested it before the post it seemed fine.

    Code:
    writeln('Ground item'+ _gItems[I].GetName);
    - If you move this line above

    Code:
    (pos(gItems[j], lowercase(_gItems[i].getName)) > 0)
    it will output all items it finds.




    In regards to hook updates; you need to learn how to use the updater Kyle posted.(providing the update didn't break it)

    <------------------>



  10. #10
    Join Date
    Nov 2015
    Posts
    73
    Mentioned
    1 Post(s)
    Quoted
    31 Post(s)

    Default

    This fix worked for me: https://villavu.com/forum/showthread.php?t=117153

    I've read through the Brandon guide on how to make sense of the hook updater, but I still don't really understand. I'm not sure exactly what is being analyzed, or how it's being done.

  11. #11
    Join Date
    Apr 2013
    Posts
    680
    Mentioned
    13 Post(s)
    Quoted
    341 Post(s)

    Default

    https://github.com/KyleHunter/Java-Class-Updater

    Try find the forum post by Kyle.

    A few hooks are broken.. A couple senior members directed me to other forums to get their hook log; then edit in the broken hooks.

    I will try the fix you found.. As i am slowly building my own slayer script..

    Being able to loot ground objects is a must.

    I just moved onto the other essential parts and was going to come back to the looting part at the end.

    <------------------>



  12. #12
    Join Date
    Nov 2015
    Posts
    73
    Mentioned
    1 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by AFools View Post
    https://github.com/KyleHunter/Java-Class-Updater

    Try find the forum post by Kyle.

    A few hooks are broken.. A couple senior members directed me to other forums to get their hook log; then edit in the broken hooks.

    I will try the fix you found.. As i am slowly building my own slayer script..

    Being able to loot ground objects is a must.

    I just moved onto the other essential parts and was going to come back to the looting part at the end.
    ok, hit me up on the discord if you want to collaborate or test.

  13. #13
    Join Date
    Feb 2012
    Posts
    90
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Edited: problem with grounditems was a wrong hook.
    Client_GroundItems: THook = ['client.ji', 1];

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •