Results 1 to 5 of 5

Thread: Help with my first script BoneBagAndBury

  1. #1
    Join Date
    Sep 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Question Help with my first script BoneBagAndBury

    This is the first script I've written for simba. I'm not sure what the problem is but I can't get the script to actually bury the bones. It will fill the inventory with bones but once it is full, it still tries to pick up bones and never changes procedures to bury them. Any advice would be appreciated.


    Simba Code:
    program BoneBagAndBury;
      {$define SMART}
      {$i SRL\SRL.simba}

    var
      xp : Extended;
      numBones, x, y, dtmBones: Integer;

    const
      SRLStats_Username = ' ';
      SRLStats_Password = ' ';

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := ' '; // Username
      Players[0].Pass := ' '; // Password
      Players[0].Nick := ' '; // 4 lowercase letters from your character name
      Players[0].Active := True;
    end;

    procedure AntiBan;
    begin
      if(not(LoggedIn)) then
        Exit;

      If FindNormalRandoms Then
          begin
            Players[CurrentPlayer].Active := False;
            NextPlayer(Players[CurrentPlayer].Active);
            Exit;
          end;

      case Random(80) of
        20: HoverSkill('prayer', False);
        30: PickUpMouse;
        40: RandomMovement;
        50: BoredHuman;
        60: ExamineInv;
      end;
    end;

    procedure FindBones;

    begin
      if FindObj(x, y, 'Take', 10002613, 5)then
      Mouse(x, y, 2, 0, False);
      ChooseOption('ones');
    end;

    procedure BuryBones;
    var
      a : Integer;
    begin
      dtmBones:= DTMFromString('mggAAAHicY2NgYJjGxMAwE4gnA3EvEE8C4nlA/Bgodx+I70Hpl0D8FIg3rFjBsHjObIZpEyYAeUwM65YvY1gydy4DLsCIA0MAAAGqElA=');
      a := CountItems('dtm', dtmBones, []);
      if FindDTM(dtmBones, x, y, MIX1, MIY1, MIX2, MIY2) then
      numBones := numBones + a;
      Mouse(x, y, 0, 0, True);
    end;

    procedure StatusReport;
    begin
      xp := 4.5;
      Writeln(' --- ');
      Writeln(' BoneBagAndBury ');
      Writeln(' Running For: ' + TimeRunning);
      Writeln(' Bones Collected/Buried: ' + IntToStr(numBones));
      Writeln(' Prayer XP Earned: ' + FloatToStr(numBones * xp));
      Writeln(' --- ');
    end;

    procedure GetBones;
    begin
    repeat
        FindBones;
        AntiBan;
        Wait(200);
    until (InvFull);
        WriteLn(' Bones Bagged ');
    end;

    begin
      SRL_SixHourFix := True;
      SMART_FixSpeed := True;

      ClearDebug;
      SetupSRL;
      SetupSRLStats(439, SRLStats_Username, SRLStats_Password);
      DeclarePlayers;

      while (not (AllPlayersInactive)) do
      begin
        if not LoggedIn then
          LoginPlayerToLob;
          OpenWorldScreen;
          SelectWorld(1);
          LoginPlayer;
        while(not LoggedIn) do
          wait(1000);

        MakeCompass(0);
        SetAngle(SRL_ANGLE_HIGH);

      while (LoggedIn) do
        while (InvFull) do
        repeat
          BuryBones;
          ClearDebug;
          AntiBan;
          Writeln(' Bones Buried ');
          Writeln(' --- ');
          StatusReport;
        until (InvEmpty);
         GetBones;
      end;
    end.
    Last edited by muu232; 10-03-2012 at 05:23 AM.

  2. #2
    Join Date
    Sep 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well i got it halfway working.
    I changed this procedure to:

    Simba Code:
    procedure BuryBones;
    var
      a, x, y : Integer;
    begin
      dtmBones:= DTMFromString('mggAAAHicY2NgYJjGxMAwE4gnA3EvEE8C4nlA/Bgodx+I70Hpl0D8FIg3rFjBsHjObIZpEyYAeUwM65YvY1gydy4DLsCIA0MAAAGqElA=');
      a := CountItems('dtm', dtmBones, []);
      if(FindColorSpiralTolerance(x, y, 10987695, MIX1, MIY1, MIX2, MIY2, 15))then
      numBones := numBones + a;
      Mouse(x, y, 15, 15, True);
    end;

    But it only buries half the bones in the inventory then stops. The bone and xp counter isn't working correctly either but I'm more interested in getting the script functiong before I worry about fixing that. Any help please??

  3. #3
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    You need a begin after conditional statement that is followed by >1 actions. You should load the DTM only once at start of the script (and free once at the end). At the current state you will crash simba within hrs.

    while..do is already a loop so it shouldn't be followed by repeat, check the beginner tutorials on loops.

  4. #4
    Join Date
    Feb 2012
    Location
    DON'T PM ME ASKING FOR STUFF
    Posts
    2,170
    Mentioned
    38 Post(s)
    Quoted
    423 Post(s)

    Default

    I suppose one thing I see is that you use while's and do's...


    Ever considered using If and then?

    Simba Code:
    if (InvEmpty) Then
            begin
              GetBones;
            end else
             writeln('Debug: Found Bones in Inventory OR Inventory is just full');
             BuryBones;

    What this does is detects if the inventory is empty then it will do the Procedure GetBones;
    If the inventory is full then it will say it found bones in inventory or inventory is just full... this allows for fail safes like extra checks etc etc :P


    You could also check if the inventory was just full of bones or if it had other items and if it has other items make it terminate the script.

    Just as a fail safe.
    Last edited by xtrapsp; 10-03-2012 at 01:57 PM.

  5. #5
    Join Date
    Sep 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks to both of you. Working on it now.

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
  •