Results 1 to 14 of 14

Thread: [First Script] Bag of Bones

  1. #1
    Join Date
    Jul 2015
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default [First Script] Bag of Bones

    Hi everyone. This is my first script and I only spend an hour or so on it so it has some work but basically it is supposed to just search for 'Bones' in the area, pick up and inventor, the bury that inventory. I still have yet to put it through a loop.
    My question is why does it not stop at a full inventory and start burying the bones?
    I want to thank Vizzyy and his Boner script for the inspiration, elfyyy for the Reflection tutorial and some code, and Fitta on the snippets of code about finding items.

    Code:
    program BagOfBones;
      {$DEFINE SMART}
      {$i AeroLib/AeroLib.Simba}
      {$i Reflection/Reflection.Simba}
    
    
    var
      MyPlayer: TReflectLocalPlayer;
      Bones: TStringArray;
      BonesCount: TIntegerArray;
    
    procedure SetupLoot;
    begin
      Bones := ['Bones'];
      SetLength (BonesCount, Length(Bones));
    end;
    
    
    
    procedure FindBones; //elfyyy and Fitta
    var
      Drop: TReflectGroundItemArray;
      I: Integer;
      Point: TPoint;
    begin
      Drop.GetAll(20);
      for I := 0 to High(Drop)do
      begin
        Point := Drop[I].GetMSPoint;
        Reflect.Mouse.Move(Point, 2, 2);
        Reflect.Mouse.Click(Mouse_Left);
        Wait (4000);
      end;
    end;
    
    procedure BuryBones
    var
      Item: TReflectInvItem;
    begin
      Item.Find('Bones');
      Reflect.Mouse.Move(Item.GetPoint,2,2);
      Reflect.Mouse.Click(Mouse_Left);
    end;
    
    begin
      initAL;
      Reflect.Setup;
      MyPlayer.UserName := '';
      MyPlayer.Password := '';
      MyPlayer.Active := True;
      MyPlayer.Login;
      SetUpLoot;
      wait(3000+random(100));
      repeat
        FindBones;
      until (TReflectionInventory.IsFull);
      repeat
        BuryBones;
      until (False)
    end.

  2. #2
    Join Date
    Feb 2013
    Posts
    342
    Mentioned
    8 Post(s)
    Quoted
    110 Post(s)

    Default

    I would try putting the repeat findbones until within that procedure so
    Repeat
    Findbones
    Until(fullinv)
    and then in the main loop just have
    findbones;
    Burybones;

    See if that works any better.

    Sorry can't do much more as on my phone

    Looks quite neat, guessing you popped it through the formatter?

  3. #3
    Join Date
    Jul 2015
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Something like this?

    Code:
    procedure FindBones;
    var
      Drop: TReflectGroundItemArray;
      I: Integer;
      Point: TPoint;
    begin
      repeat
        Drop.GetAll(20);
        for I := 0 to High(Drop)do
        begin
          Point := Drop[I].GetMSPoint;
          Reflect.Mouse.Move(Point, 2, 2);
          Reflect.Mouse.Click(Mouse_Left);
          Wait (4000);
        end;
      until (TReflectionInventory.IsFull);
    end;
    I've run that and it doesn't seem to stop looking for bones.
    And I have to say I'm not sure what the formatter is.

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by GetHyper View Post
    I would try putting the repeat findbones until within that procedure so
    Repeat
    Findbones
    Until(fullinv)
    and then in the main loop just have
    findbones;
    Burybones;

    See if that works any better.

    Sorry can't do much more as on my phone

    Looks quite neat, guessing you popped it through the formatter?
    formatted doesn't change script logic, just the standards

  5. #5
    Join Date
    Feb 2013
    Posts
    342
    Mentioned
    8 Post(s)
    Quoted
    110 Post(s)

    Default

    Quote Originally Posted by Ohaun View Post
    Something like this?

    I've run that and it doesn't seem to stop looking for bones.
    And I have to say I'm not sure what the formatter is.
    I may be missing something then, I haven't dealt with reflection before (will get into it soon).

    Generally on RS3 doing until(whatever) would normally stop an action, maybe it is to do with 0 to high(drop).
    Is that saying 'drop' doesn't have a set value and therefore will continually look for the bones?

    Quote Originally Posted by rj View Post
    formatted doesn't change script logic, just the standards
    Yeah I was on about the standards, just meant it was easy to read.
    Last edited by GetHyper; 07-29-2015 at 06:23 PM.

  6. #6
    Join Date
    Jul 2015
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by GetHyper View Post
    Generally on RS3 doing until(whatever) would normally stop an action, maybe it is to do with 0 to high(drop).
    I didn't even consider the os vs rs3 situation. I'll have to look into if the code is different? I still have much research to do.

    Quote Originally Posted by GetHyper View Post
    Is that saying 'drop' doesn't have a set value and therefore will continually look for the bones?
    I'm not sure. The intention was to just have it run until a full inventor then move to the next function which buries the bones.

  7. #7
    Join Date
    Feb 2013
    Posts
    342
    Mentioned
    8 Post(s)
    Quoted
    110 Post(s)

    Default

    I'll make one last guess while you wait for someone with reflection knowledge,
    try removing the
    Drop.GetAll(20);
    for I := 0 to High(Drop)do
    just to see if it makes a difference.

    Sorry I haven't been much help

  8. #8
    Join Date
    Jul 2015
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Thank you for the help you could give. I'll continue to research more and report back if I find anything out.

  9. #9
    Join Date
    Jul 2015
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    I did a thing that works! If there is more than bones on the stack it doesn't know what to do but I will be adding some to it tomorrow anyway. Here is what works.

    Code:
    program BagOfBones;
      {$DEFINE SMART}
      {$i AeroLib/AeroLib.Simba}
      {$i Reflection/Reflection.Simba}
    
    
    var
      MyPlayer: TReflectLocalPlayer;
      Bones: TStringArray;
      BonesCount: TIntegerArray;
    
    procedure SetupLoot;
    begin
      Bones := ['Bones'];
      SetLength (BonesCount, Length(Bones));
    end;
    
    
    
    procedure FindBones;
    var
      Drop: TReflectGroundItemArray;
      I, Ind: Integer;
      Point: TPoint;
    begin
      repeat
        begin
          Drop.GetAll(20);
          for I := 0 to High(Drop)do
          if InStrArrEx(Drop[I].GetName, Bones, Ind) then
          begin
            Point := Drop[I].GetMSPoint;
            Reflect.Mouse.Move(Point, 2, 2);
            Reflect.Mouse.Click(Mouse_Left);
            Wait (1000);
            While Myplayer.IsMoving do
              Wait (150);
          end;
        end;
      until (TReflectionInventory.IsFull);
    end;
    
    procedure BuryBones
    var
      Item: TReflectInvItem;
    begin
      repeat
        Item.Find('Bones');
        Reflect.Mouse.Move(Item.GetPoint,2,2);
        Reflect.Mouse.Click(Mouse_Left);
      until (TReflectionInventory.IsEmpty);
    end;
    
    begin
      initAL;
      Reflect.Setup;
      MyPlayer.UserName := '';
      MyPlayer.Password := '';
      MyPlayer.Active := True;
      MyPlayer.Login;
      SetUpLoot;
      wait(3000+random(100));
      repeat
        FindBones;
        BuryBones;
      until (False)
    end.

  10. #10
    Join Date
    Sep 2014
    Posts
    447
    Mentioned
    10 Post(s)
    Quoted
    203 Post(s)

    Default

    I'm not familiar with Reflection, so I'm not here to criticize your code or anything, but I just wanted to say that if you surround your code with the tags [ SIMBA ] [ /SIMBA ] (but remove the spaces). Makes the code easier to read.

    Code:
    begin
       if (1 > 0) then
       begin
         writeLn('This is just an example');
       end;
    end;
    Turns into:

    Simba Code:
    begin
       if (1 > 0) then
       begin
         writeLn('This is just an example');
       end;
    end;

  11. #11
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Never used reflection before but if its anything like SRL

    Im gonna go ahead and guess that
    Simba Code:
    ReflectionInventory.IsFull
    is an included function and you might have to call it like this
    Simba Code:
    until (TReflectionInventory.IsFull());
    Add the two extra parenthesis and see if that works, also make sure that, that function returns a boolean variable. If it doesn't, checking for it wont do anything.

    Again, never used reflection before.

    Nice job on trying to learn how to script though

  12. #12
    Join Date
    Jul 2015
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by A Bit Poor View Post

    Nice job on trying to learn how to script though
    Thanks!
    I've actually figured out a few things since my last post. My trouble now is right clicking so if anyone knows how to work that with reflection/lape I would love a pointer.

  13. #13
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Quote Originally Posted by Ohaun View Post
    Thanks!
    I've actually figured out a few things since my last post. My trouble now is right clicking so if anyone knows how to work that with reflection/lape I would love a pointer.
    You could do
    Simba Code:
    Reflect.Mouse.Click(MOUSE_RIGHT);

    Thats how it works with SRL since MOUSE_LEFT and MOUSE_RIGHT are just Constants, you should be able to change it to MOUSE_RIGHT.

    Also try to write your constants in all caps, that way you can tell whats a constant and what isn't.

    The best advice I can give you is look through the library files. If you wanted to for example, use the bank. Go to the reflection/lib folder and look for a file that involves the bankscreen. That file should have included functions to make interacting with the bank much easier.

    Good luck!

  14. #14
    Join Date
    Jul 2015
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by A Bit Poor View Post

    The best advice I can give you is look through the library files. If you wanted to for example, use the bank. Go to the reflection/lib folder and look for a file that involves the bankscreen. That file should have included functions to make interacting with the bank much easier.

    Good luck!
    Thanks! I have already looked through a few but haven't found what I need yet. I'll keep looking.

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
  •