Page 2 of 2 FirstFirst 12
Results 26 to 48 of 48

Thread: Starting my first script

  1. #26
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    It looks like you're making progress You could however simpify your antiban quite a bit:

    Simba Code:
    procedure antiBan();
    var
    num1, num2, num3, method : integer;
    boxOne, boxTwo, boxThree : TBox;

    begin
      boxOne := intToBox(35, 336, 269, 501); //The boxes on the screen that the mouse will
      boxTwo := intToBox(421, 55, 706, 227); //randomly move to.
      boxThree := intToBox(491, 461, 783, 589);
      num1 := 1;
      num2 := 2;
      num3 := 3;
      method := randomRange(1, 3); //chooses which antiban method will be run

        if method = num1 then
          begin
            writeLn('Antiban Method 1');
            mouseBox(boxOne, MOUSE_MOVE);
          end;

        if method = num2 then
          begin
            writeLn('Antiban Method 2');
            mouseBox(boxTwo, MOUSE_MOVE);
          end;

        if method = num3 then
          begin
            writeLn('Antiban Method 3');
            mouseBox(boxThree, MOUSE_MOVE);
          end;
    end;

    Could just be:
    Simba Code:
    procedure antiBan();
    begin
      case random(3) + 1 of: //random(3) = 0, 1, 2.
        1:begin
            writeLn('Antiban Method 1');
            mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
          end;

        2:begin
            writeLn('Antiban Method 2');
            mouseBox(ntToBox(421, 55, 706, 227);, MOUSE_MOVE);
          end;

        3:begin
            writeLn('Antiban Method 3');
            mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
          end;
      end;
    end;

  2. #27
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    UPDATE
    *The script now runs forever til you stop it.
    *It will now wait til the backpack is full and bury all the bones.

    FUTURE UPDATES
    *Still working on the procedure for making the script run for specified time.
    *Actionbar functionality.
    *Moving the Script to a different area. I havent done this yet because i do not have a high

    Still having some trouble with making the script run for a specified amount of time. So if you guys can drop any ideas on me for how to do that then let me know. I know it is in the tutorial but the way it is done is not quite the way i was looking for. I want it to where the user can specify the time by editing a global in the script. Then when the time running is equal to the time you want it to run it will stop.

    I tried a few of simbas built in functions. But the script just kept running and it stopped burying the bones.




    Simba Code:
    program new;
      {$DEFINE SMART}
      {$I SRL-6/SRL.simba}

    procedure antiBan();
    var
     antiBanNum : integer;
    begin
      antiBanNum := randomRange(0, 2);
      case antiBanNum of //random(3) = 0, 1, 2.
        0:begin
            writeLn('Antiban Method 1');
            mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
          end;

        1:begin
            writeLn('Antiban Method 2');
            mouseBox(intToBox(421, 55, 706, 227), MOUSE_MOVE);
          end;

        2:begin
            writeLn('Antiban Method 3');
            mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
          end;
      end;
    end;

    procedure clickEnemy();
    var
    x, y, i: integer;
    TPA: TPointArray;
    ATPA: T2DPointArray;

    begin
      findColorsSpiralTolerance(x, y, TPA, 3434850, mainScreen.getBounds(), 22, colorSetting(2, 0.07, 0.11));
        if length (TPA) < 1 then   //If there are no monsters found it will terminate and rerun.
        begin
          exit;
        end;
      ATPA := TPA.toATPA(30, 30);
      ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

      smartImage.debugATPA(ATPA);

      for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
        begin
            mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
              if isMouseOverText(['ttack'], 500) then
            begin
              fastClick(MOUSE_LEFT); // attacks mob
              smartImage.clear();
              wait(randomRange(500, 800));
              antiBan();
              wait(randomRange(5000, 5800));
              break;
            end;

        if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
          begin
            writeLn('Gate of War found');
            break;
          end;

        end;

    end;

    procedure pickUpBones();
    var
    x, y, i : integer;
    TPA: TPointArray;
    ATPA: T2DPointArray;

    begin
      findColorsSpiralTolerance(x, y, TPA, 9015205, mainScreen.getBounds(), 21, colorSetting(2, 0.08, 0.43));
        if length (TPA) < 1 then   //If there are no bones found it will terminate and rerun.
          begin
            exit;
          end;
      ATPA := TPA.toATPA(30, 30);
      ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest drop to you.

      smartImage.debugATPA(ATPA);

      for i := 0 to high(ATPA) do
        begin
          wait(1000);
          mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
            if isMouseOverText(['ake'], 500) then
              begin
                mouse(middleTPA(ATPA[i]), MOUSE_RIGHT);   // picks up the bones at the closest point to you.
                chooseOption.select(['ake Bones']);
                tabBackPack.waitForShift(10000);
                smartImage.clear();
                break;
              end;
          end;

    end;

    procedure buryBones();
    var
      slotNum, i : integer;
    begin
      slotNum := 28;
      for i := 1 to slotNum do //for every time "i" is not equal to slotNum
        begin                  //keep clicking the bones in the next box over.
        tabBackPack.mouseSlot(i, MOUSE_LEFT);
        wait(randomRange(1500, 2300));   //wait until the bones are out of the inventory
        i + 1;
        end;
    end;


    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      mainScreen.setAngle(MS_ANGLE_HIGH);
      minimap.setAngle(MM_DIRECTION_NORTH);
      repeat
        repeat
          clickEnemy();
          wait(3000);
          pickUpBones();
        until tabBackPack.isFull();
      buryBones();
      until(false);
    end.
    Last edited by o0Matthius0o; 08-12-2014 at 09:32 AM. Reason: Replaced If statements with Case statements

  3. #28
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    It looks like you're making progress You could however simpify your antiban quite a bit:

    Simba Code:
    procedure antiBan();
    var
    num1, num2, num3, method : integer;
    boxOne, boxTwo, boxThree : TBox;

    begin
      boxOne := intToBox(35, 336, 269, 501); //The boxes on the screen that the mouse will
      boxTwo := intToBox(421, 55, 706, 227); //randomly move to.
      boxThree := intToBox(491, 461, 783, 589);
      num1 := 1;
      num2 := 2;
      num3 := 3;
      method := randomRange(1, 3); //chooses which antiban method will be run

        if method = num1 then
          begin
            writeLn('Antiban Method 1');
            mouseBox(boxOne, MOUSE_MOVE);
          end;

        if method = num2 then
          begin
            writeLn('Antiban Method 2');
            mouseBox(boxTwo, MOUSE_MOVE);
          end;

        if method = num3 then
          begin
            writeLn('Antiban Method 3');
            mouseBox(boxThree, MOUSE_MOVE);
          end;
    end;

    Could just be:
    Simba Code:
    procedure antiBan();
    begin
      case random(3) + 1 of: //random(3) = 0, 1, 2.
        1:begin
            writeLn('Antiban Method 1');
            mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
          end;

        2:begin
            writeLn('Antiban Method 2');
            mouseBox(ntToBox(421, 55, 706, 227);, MOUSE_MOVE);
          end;

        3:begin
            writeLn('Antiban Method 3');
            mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
          end;
      end;
    end;
    I tried this mayor and i kept getting an access violation. Not sure why. The debug was exactly "access violation"

  4. #29
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Scratch that. I had copied your text exactly but now looking back on it there was a mistype and a semicolon in the wrong spot. editing the script now. thanks mayor.

  5. #30
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by o0Matthius0o View Post
    Scratch that. I had copied your text exactly but now looking back on it there was a mistype and a semicolon in the wrong spot. editing the script now. thanks mayor.
    Glad you solved my antileech

  6. #31
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    Glad you solved my antileech
    lol actually i didnt. Changed that and a few more things. Still getting that same violation. Looked more into pascals case statements. Still havent figured it out. Im sure its simple and ill kick myself for it later. >.<

  7. #32
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by o0Matthius0o View Post
    lol actually i didnt. Changed that and a few more things. Still getting that same violation. Looked more into pascals case statements. Still havent figured it out. Im sure its simple and ill kick myself for it later. >.<
    1) of: = of
    2) mouseBox(ntToBox = mouseBox(intToBox
    3) 706, 227);, = 706, 227),

  8. #33
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    1) of: = of
    2) mouseBox(ntToBox = mouseBox(intToBox
    3) 706, 227);, = 706, 227),
    AWWWW! The only thing i forgot was the colon on the end of the "of".

    Thanks for the lesson! lol it works great now.

  9. #34
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Anyone know how to keep my bot within a certain bounds on the map? I should be able to figure out how to get him back in that area should he leave. But i want to see if i can prevent that all together. Doors like the gates of war in the stronghold all have the same color so it would be a bit difficult to guide him back.... Unless i had it check the camera angle. and if it is pointed north then click the southern most door. Which will work in this situation. Any tips and ideas would be great, but if no luck then its no big deal. This guy is going to the wilderness dungeons next. After i level this character a bit. :/

  10. #35
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    UPDATE
    *Added a little bit of actionbar abilities.
    *Added a DTM to find the "0" in the hp bar of a goblin to let the script know the fight is over.


    Still need to change the DTM to a function so i can use it in a more modular manner. It will make the script a bit less bulky and easier to read. I am trying to figure out how to keep the script from clicking the action bar and use the keyboard instead. Havent seen a way to do that yet although i know one exists. I was looking through the bonsaiFighter to see how they did it but i cant decipher it yet.

    FUTURE UPDATE
    *Will add a login function so you can just start the script and forget about it.
    *Still need to add some breaks into the antiban.






    Simba Code:
    program new;
      {$DEFINE SMART}
      {$I SRL-6/SRL.simba}

    procedure antiBan(); //So far all it does is move the mouse into a random area of one of 3 TBoxes.
    var
     antiBanNum : integer;
    begin
      antiBanNum := randomRange(0, 4);
      case antiBanNum of //random(3) = 0, 1, 2.
        0:begin
            writeLn('Antiban Method 1');
            if randomRange(0, 2) = 1 then
              begin
                writeLn('Rotation of Method 1');
                minimap.setAngle(randomRange(0, 275));
              End
            else
              begin
                mouseBox(intToBox(35, 336, 269, 501), MOUSE_MOVE);
              end;
          end;

        1:begin
            writeLn('Antiban Method 2');
            if randomRange(0, 2) = 1 then
              begin
                mouseBox(intToBox(421, 55, 706, 227), MOUSE_MOVE);
              End
            else
              begin
                writeLn('Rotation of Method 2');
                minimap.setAngle(randomRange(0, 360));
              end;
          end;

        2:begin
            writeLn('Antiban Method 3');
            if randomRange(0, 2) = 1 then
              begin
                mouseBox(intToBox(491, 461, 783, 589), MOUSE_MOVE);
              End
            else
              begin
                writeLn('Rotation of Method 3');
                minimap.setAngle(randomRange(100, 200));
              end;
          end;

        3:begin
            writeLn('No Antiban this round');
          end;

        4:begin
            writeLn('Antiban Method 4');
            mouseBox(intToBox(17, 12, 539, 260), MOUSE_MOVE);
          end;
      end;
    end;

    procedure clickEnemy();
    var
    x, y, i: integer;
    TPA: TPointArray;
    ATPA: T2DPointArray;
    hpDTM: integer;

    begin
      hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3gwUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
      findColorsSpiralTolerance(x, y, TPA, 3434850, mainScreen.getBounds(), 22, colorSetting(2, 0.07, 0.11));
        if length (TPA) < 1 then   //If there are no monsters found it will terminate and rerun.
        begin
          exit;
        end;
      ATPA := TPA.toATPA(30, 30);
      ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

      smartImage.debugATPA(ATPA);

      for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
        begin
            mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
              if isMouseOverText(['ttack'], 500) then
            begin
              fastClick(MOUSE_LEFT); // attacks mob
              smartImage.clear();
              if findDTM(hpDTM, x, y, mainScreen.getBounds()) then  //If the number "0" is found in the goblins hp bar the fight will end
                begin
                  writeLn('DTM found!!!!!');
                  exit;
                End
                else if not findDTM(hpDTM, x, y, mainScreen.getBounds()) then  // If it is not found then we will use the first ability.
                  begin
                    writeLn('Slicing');
                    actionBar.clickSlot(1);
                  End
                    else
                    begin
                      writeLn('Dicing');
                      actionBar.clickSlot(2);
                    end;
              wait(randomRange(500, 800));
              antiBan();
              wait(randomRange(5000, 5800));
              break;
            end;

        if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
          begin
            writeLn('Gate of War found');
            break;
          end;

        end;

    end;

    procedure pickUpBones();
    var
    x, y, i : integer;
    TPA: TPointArray;
    ATPA: T2DPointArray;

    begin
      findColorsSpiralTolerance(x, y, TPA, 9015205, mainScreen.getBounds(), 21, colorSetting(2, 0.08, 0.43));
        if length (TPA) < 1 then   //If there are no bones found it will terminate and rerun.
          begin
            exit;
          end;
      ATPA := TPA.toATPA(30, 30);
      ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest drop to you.

      smartImage.debugATPA(ATPA);

      for i := 0 to high(ATPA) do
        begin
          wait(1000);
          mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
            if isMouseOverText(['ake'], 500) then
              begin
                mouse(middleTPA(ATPA[i]), MOUSE_RIGHT);   // picks up the bones at the closest point to you.
                chooseOption.select(['ake Bones']);
                tabBackPack.waitForShift(10000);
                smartImage.clear();
                break;
              end;
          end;

    end;

    procedure buryBones();
    var
      slotNum, i : integer;
    begin
      slotNum := 28;
      for i := 1 to slotNum do //for every time "i" is not equal to slotNum
        begin                  //keep clicking the bones in the next box over.
        tabBackPack.mouseSlot(i, MOUSE_LEFT);
        wait(randomRange(1500, 2300));   //wait until the bones are out of the inventory
        i + 1;
        end;
    end;

    procedure checkAngle();
    var
      angle : extended;

    begin
      angle := minimap.getAngleRadians();

      if angle <> MM_DIRECTION_NORTH and MS_ANGLE_HIGH then // checks to see if the camera is in the correct position. If its not it will put it there.
        begin
          mainScreen.setAngle(MS_ANGLE_HIGH);
          minimap.setAngle(MM_DIRECTION_NORTH);
        end;

    end;

    procedure monsterHealthDTM();
    var
      hpDTM: integer;
    begin
      hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3gwUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
    end;


    begin
      clearDebug();
      smartEnableDrawing := true;
      setupSRL();
      mainScreen.setAngle(MS_ANGLE_HIGH);
      minimap.setAngle(MM_DIRECTION_NORTH);
      repeat
        repeat
          //checkAngle();
          clickEnemy();
          //checkAngle();
          wait(randomRange(3000, 3500));
          pickUpBones();
        until tabBackPack.isFull();
      buryBones();
      until(false);
    end.

  11. #36
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by o0Matthius0o View Post
    I am trying to figure out how to keep the script from clicking the action bar and use the keyboard instead. Havent seen a way to do that yet although i know one exists. I was looking through the bonsaiFighter to see how they did it but i cant decipher it yet.
    At this point I prefer to use revolution and let the game do the work. Less things for them to notice

    Simba Code:
    procedure doAbilities();

    var
       i: integer;
       keyStr: string;
       
    begin
       for i := 9 downto 1 do  // used 9 to match revolution
       begin
          if (actionBar.getAbilityCooldown(i) = 1) then
          begin
             case i of
                0..9:    keyStr := intToStr(i);
                10:      keyStr := '0';
                11:      keyStr := '-';
                12:      keyStr := '=';
             end;
         
             SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));

             exit;  // only do one ability
          end;
       end;
    end;

  12. #37
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by bonsai View Post
    At this point I prefer to use revolution and let the game do the work. Less things for them to notice

    Simba Code:
    procedure doAbilities();

    var
       i: integer;
       keyStr: string;
       
    begin
       for i := 9 downto 1 do  // used 9 to match revolution
       begin
          if (actionBar.getAbilityCooldown(i) = 1) then
          begin
             case i of
                0..9:    keyStr := intToStr(i);
                10:      keyStr := '0';
                11:      keyStr := '-';
                12:      keyStr := '=';
             end;
         
             SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));

             exit;  // only do one ability
          end;
       end;
    end;

    So if i break this down. It will randomly cycle 1-9 and 0 - =. After that it will pick a slot from the action bar and then press that key on the keyboard?
    i am still new to this so would you mind breaking down the code? like what does this line do "SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));"

    and what is the purpose of getting the cooldowns to cycle through?

  13. #38
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by o0Matthius0o View Post
    SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));
    sendKeys is a simba procedure which actually presses a key on your keyboard. The parameters are:

    Simba Code:
    procedure SendKeys(const s: string; keywait, keymodwait: integer);

    s is the key you want to press as a string. So to press number 1 you would go '1'. You can also send words e.g. 'Hello'.
    keywait is the time in ms to hold down the key you press
    keymodwait is the time to +/- from the keywait

    SRL6 also has a procedure called typeSend:

    Simba Code:
    procedure typeSend(text: string; pressEnter: boolean = true);

    Text is your text, and you can optionally make it press enter after it's done typing.

    typeSend('Hello there', true);

  14. #39
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    sendKeys is a simba procedure which actually presses a key on your keyboard. The parameters are:

    Simba Code:
    procedure SendKeys(const s: string; keywait, keymodwait: integer);

    s is the key you want to press as a string. So to press number 1 you would go '1'. You can also send words e.g. 'Hello'.
    keywait is the time in ms to hold down the key you press
    keymodwait is the time to +/- from the keywait

    SRL6 also has a procedure called typeSend:

    Simba Code:
    procedure typeSend(text: string; pressEnter: boolean = true);

    Text is your text, and you can optionally make it press enter after it's done typing.

    typeSend('Hello there', true);

    Do you mind if i use your methods for logging in and breaking? I found them to be really easy to understand and very useful.

  15. #40
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by o0Matthius0o View Post
    Do you mind if i use your methods for logging in and breaking? I found them to be really easy to understand and very useful.
    Use whatever

  16. #41
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by o0Matthius0o View Post
    So if i break this down. It will randomly cycle 1-9 and 0 - =. After that it will pick a slot from the action bar and then press that key on the keyboard?
    i am still new to this so would you mind breaking down the code? like what does this line do "SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));"

    and what is the purpose of getting the cooldowns to cycle through?
    getAbilityCooldown tells you if the ability is ready. I think the documentation says it returns 100 but it returns 1 when the ability is ready to use.

    The cycling is not random. It loops backwards from 9 to 1 and checks that slot to see if it is ready. That way when people put their threshold skills to the right of the actionbar it will choose them before the basic skills (on the left).

    So the for loop and the if test will choose the right-most skill that is ready.

    The case statement decides which key to be press to activate the chosen ability. It has entries for 10/11/12 but they are not needed any more since I'm only looping from 9.

    Then it calls sendkeys to actually push the key.

  17. #42
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Thanks for the help guys. I now have login functionality. Tonight when I get home I'll add in some breaking and then clean it up a bit. Then add a proggy function. Once that's done I'll have almost a fully functional script ready for testing. You guys are awesome.

  18. #43
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Ok, this is just to see if my signature works. But if you want to know i have gotten the break times in the script now. Probably going to move to a higher level area for the rest of the script til i think its ready for fire giants. This way im not one shotting goblins and can test out the action bar and eating.

  19. #44
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by bonsai View Post
    getAbilityCooldown tells you if the ability is ready. I think the documentation says it returns 100 but it returns 1 when the ability is ready to use.

    The cycling is not random. It loops backwards from 9 to 1 and checks that slot to see if it is ready. That way when people put their threshold skills to the right of the actionbar it will choose them before the basic skills (on the left).

    So the for loop and the if test will choose the right-most skill that is ready.

    The case statement decides which key to be press to activate the chosen ability. It has entries for 10/11/12 but they are not needed any more since I'm only looping from 9.

    Then it calls sendkeys to actually push the key.
    This was incredibly helpful! Now thanks to using that and a few of the functions from The Mayor i now have a functional script with breaks. Still want to clean up the debug window and add a proggy.

    I have now moved the start location. Instead of goblins it now fights the minotaurs right next door. Or anywhere in that floor of the dungeon. I commented out the looting of the bones for now as it was pretty useless at this stage.

    Ok so the biggest change i made was in the script finding the end of the fight. I used a DTM to find the monsters hp. When it sees the "0" it will stop the fight and move on to the next one. I did this because he kept aggroing all the minotaurs.

    Please let me know your thoughts on this!


    Simba Code:
    program new;
      {$DEFINE SMART}
      {$I SRL-6/SRL.simba}
      {$I SPS/LIB/SPS-RS3.simba}


    const
    //-------Login Settings-------//
    PLAYER_FILE = 'Godlist';
    NICKNAME = 'Miner2';
    LOGIN_WORLD = 0;
    //ENABLE_DEBUG = False;
    //----------------------------//
    //-------Break settings-------//
    ENABLE_BREAKS = True;

    MIN_PLAY_TIME = 45;
    MAX_PLAY_TIME = 180;

    MIN_BREAK_TIME = 5;
    MAX_BREAK_TIME = 45;
    //----------------------------//

    var
    //-------Global Variables-------//
      TotalBreakTime, StatsTime : TTimeMarker; //Timers Here

      BreakTimeTotal, BreakTime, Breaked, XpGained : integer; //Stats Here

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure resetBreakTimer();
    begin
      BreakTime := getSystemTime() + gaussRangeInt(MIN_PLAY_TIME * 60000, MAX_PLAY_TIME * 60000);
    end;

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure setup();

    begin
       smartEnableDrawing := true;
       //disableSRLDebug := not ENABLE_DEBUG;
       setupSRL();

       players.Setup([NICKNAME], PLAYER_FILE);
       currentPlayer := 0;
       players[currentPlayer].world := LOGIN_WORLD;

       exitTreasure();

       resetBreakTimer();
       TotalBreakTime.start();
       TotalBreakTime.pause();
    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    function antiBan(): boolean;
    var
     antiBanNum : integer;
    begin
      antiBanNum := random(1500);
      if antiBanNum <= 100 then
      begin
        writeLn('Antiban Time!');

        case antiBanNum of
        1..10: boredHuman(false);
        11..25: hoverRandomSkill();
        26..31: hoverOnlineFriend();
        32..52: mouseMovingObject();
        53..69: mouseOffClient(4);
        70..80: randomCameraAngle(MS_ANGLE_HIGH);
        81..90: randomCompass(10, 40, True);
        91..100: wait(randomRange(3000, 5000));

        end;
      end;
    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    function timeUntilBreak() : string;
    var
      breakFromNow, H, M, S : integer;
    begin
      if ENABLE_BREAKS then
      begin
        breakFromNow := BreakTime - getSystemTime();
        convertTime(breakFromNow, H, M, S);
        result := (toStr(H) + 'h ' + toStr(M) + 'm ' + toStr(S) + 's');
      end else
        result := ('Breaking disabled');
    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure takeBreak();
    var
      H, M, S, HH, MM, SS, breakFor, timeLeft : integer;
      breakStartTimer : TTimeMarker;

    begin
      if not ENABLE_BREAKS then
        exit;

      if (getSystemTime() >= BreakTime) then
      begin
        TotalBreakTime.start();
        writeLn('Taking a break');

        if random(2) = 0 then
          players[currentPlayer].logout()
        else
          players[currentPlayer].exitToLobby();

        breakFor := gaussRangeInt(MIN_BREAK_TIME * 60000, MAX_BREAK_TIME * 60000);
        convertTime(breakFor, H, M, S);
        writeLn('You are taking a break for: ' + toStr(H) + 'h ' + toStr(M) + 'm ' + toStr(S) + 's');

        breakStartTimer.start();

        repeat
          timeLeft := breakFor - breakStartTimer.getTime();
          convertTime(timeLeft, HH, MM, SS);
          writeLn('Ending break in: ' + toStr(HH) + 'h ' + toStr(MM) + 'm ' + toStr(SS) + 's');
          wait(25000 + random(4000));
        until breakFor < breakStartTimer.getTime();

        inc(Breaked);
        resetBreakTimer();
        TotalBreakTime.pause();
        players[currentPlayer].login();
        wait(gaussRangeInt(1500, 3500));
        exitTreasure();
        minimap.clickCompass();
        end;
    end;

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure doAbilities();
    var
      i : integer;
      keyStr : string;

    begin
      for i := 9 downto 1 do
      begin
        if (actionBar.getAbilityCooldown(i) = 1) then
        begin
          case i of
            0..9: keyStr := intToStr(i);
            10:   keyStr := '0';
            11:   keyStr := '-';
            12:   keyStr := '=';
          end;

          SendKeys(keyStr[1], 60 + Random(60), 60 + Random(60));

          exit;
        end;
      end;
    end;

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure clickEnemy();
    var
    x, y, i: integer;
    TPA: TPointArray;
    ATPA: T2DPointArray;
    hpDTM: integer;
    isMobDead : boolean;
    begin
      if isLoggedIn() then
      begin

      hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3gwUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
      isMobDead := false;
      findColorsSpiralTolerance(x, y, TPA, 2709450, mainScreen.getBounds(), 24, colorSetting(2, 0.09, 1.42));
        if length (TPA) < 1 then   //If there are no monsters found it will terminate and rerun.
        begin
          exit;
        end;
      ATPA := TPA.toATPA(40, 40);
      ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest monster to you.

      smartImage.debugATPA(ATPA);

      for i := 0 to high(ATPA) do //Finds and draws all the monsters a debug box.
        begin
            mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
              if isMouseOverText(['ttack'], 500) then
            begin
            if findDTM(hpDTM, x, y, mainScreen.getBounds()) then
                begin
                writeLn('DTM found, Moster hp 0');
                isMobDead := True;
                break;
                end;
              fastClick(MOUSE_LEFT); // attacks mob
              repeat
                if findDTM(hpDTM, x, y, mainScreen.getBounds()) then //Will keep fighting the monster til their health reaches 0
                  begin
                  writeLn('DTM found, Moster hp 0');
                  isMobDead := True;
                  break;
                  end;
                doAbilities();
              until isMobDead = True;
              smartImage.clear();
              antiBan();
              wait(randomRange(5000, 8000));
              break;
            end;

        if isMouseOverText(['pen Gate of War']) then // keeps you from stepping through the door
          begin
            writeLn('Gate of War found');
            break;
          end;

        end;
      End else
      if not isLoggedIn() then
      begin
        writeLn('You are not logged in');
        exit;
      end;

    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure pickUpBones();
    var
    x, y, i : integer;
    TPA: TPointArray;
    ATPA: T2DPointArray;

    begin
      if IsLoggedIn() then
      begin

      findColorsSpiralTolerance(x, y, TPA, 9015205, mainScreen.getBounds(), 21, colorSetting(2, 0.08, 0.43));
        if length (TPA) < 1 then   //If there are no bones found it will terminate and rerun.
          begin
            exit;
          end;
      ATPA := TPA.toATPA(20, 20);
      ATPA.sortFromMidPoint(mainscreen.playerPoint); //Chooses the closest drop to you.

      smartImage.debugATPA(ATPA);

      for i := 0 to high(ATPA) do
        begin
          wait(1000);
          mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
            if isMouseOverText(['ake'], 500) then
              begin
                mouse(middleTPA(ATPA[i]), MOUSE_RIGHT);   // picks up the bones at the closest point to you.
                chooseOption.select(['ake Bones']);
                tabBackPack.waitForShift(10000);
                smartImage.clear();
                break;
              end;
          end;
      end;
    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure buryBones();
    var
      slotNum, i : integer;
    begin
      if isLoggedIn() then
      begin

      slotNum := 28;
      for i := 1 to slotNum do //for every time "i" is not equal to slotNum
        begin                  //keep clicking the bones in the next box over.
        tabBackPack.mouseSlot(i, MOUSE_LEFT);
        wait(randomRange(1500, 2300));   //wait until the bones are out of the inventory
        i + 1;
        end;
      end;
    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure checkAngle();
    var
      angle : extended;

    begin
      angle := minimap.getAngleRadians();

      if angle <> MM_DIRECTION_NORTH and MS_ANGLE_HIGH then // checks to see if the camera is in the correct position. If its not it will put it there.
        begin
          mainScreen.setAngle(MS_ANGLE_HIGH);
          minimap.setAngle(MM_DIRECTION_NORTH);
        end;

    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    procedure monsterHealthDTM();
    var
      hpDTM: integer;
    begin
      hpDTM := DTMFromString('mbQAAAHicY2VgYFBhZWBQBmI1IFYFYiUg3gwUXw/EG4B4GxTbCAsz/D/NynB3AwuYDtMRZJAEiqNjRiwYDADI8wr3');
    end;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



    begin
      setup();
      repeat
      if not isLoggedIn() then
      begin
        players[currentPlayer].login();
      end;
      until isLoggedIn();
      mainScreen.setAngle(MS_ANGLE_HIGH);
      minimap.setAngle(MM_DIRECTION_NORTH);
      repeat
        //repeat
          clickEnemy();
          wait(randomRange(3000, 3500));
          //pickUpBones();
        //until tabBackPack.isFull();
      //buryBones();
      until(false);
    end.
    Last edited by o0Matthius0o; 08-17-2014 at 04:50 AM. Reason: Changed the clickEnemy procedure

  20. #45
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    This is the new recommended starting point for anyone who is wondering.

    startPoint.PNG

    Edit: i condensed the other messages down into this one. Sorry about that mr. roboto.

    I do realize there is a little problem with the script detecting any 0's in the monsters hp. I have a temp fix for that. If i extend the dtm a bit to find the corners of the hp bar as well as the points set on the 0 then that will atleast stop it from detecting any zeros that arent in the center.

    As for making sure the hp is absolute 0 i have an idea. But first i need to know if its possible to do something like a dtm within a dtm.





    I havent actually tested whether or not it actually takes breaks yet. So just a warning for anyone who might be using it (nobody)

    I have also drastically improved the antiban using the method from The Mayor. I found the antiban folder in the simba core files and went nuts with them.
    Last edited by o0Matthius0o; 08-17-2014 at 04:43 AM. Reason: Deleted other posts

  21. #46
    Join Date
    Jun 2012
    Posts
    122
    Mentioned
    0 Post(s)
    Quoted
    40 Post(s)

    Default

    Hey, not to be mean, but I think there is a suggestion on the forums to avoid posting after yourself; you can edit the same post until someone replies. The only reason I am telling you is because my page is refreshing as I try to read your code.

    For the important things:
    I thought you changed the antiban to be a procedure and to not have the unnecessary if statement.

    Another thing, what will happen if you call clickEnemy(); but your user is not actually logged in?

  22. #47
    Join Date
    Nov 2012
    Location
    OKC
    Posts
    123
    Mentioned
    5 Post(s)
    Quoted
    56 Post(s)

    Default

    Quote Originally Posted by Mr. Roboto View Post
    Hey, not to be mean, but I think there is a suggestion on the forums to avoid posting after yourself; you can edit the same post until someone replies. The only reason I am telling you is because my page is refreshing as I try to read your code.

    For the important things:
    I thought you changed the antiban to be a procedure and to not have the unnecessary if statement.

    Another thing, what will happen if you call clickEnemy(); but your user is not actually logged in?
    I cleaned them up. Sorry for all the unnecessary posts. Got excited lol.

    As for your points. What if statements are you talking about in the antiban? I only have the one.

    I corrected the problem with the clickEnemy procedure. It will now exit if you are not logged in. I have edited that in the code. Its at the very bottom of the procedure.

  23. #48
    Join Date
    Jun 2012
    Posts
    122
    Mentioned
    0 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by o0Matthius0o View Post
    I cleaned them up. Sorry for all the unnecessary posts. Got excited lol.

    As for your points. What if statements are you talking about in the antiban? I only have the one.

    I corrected the problem with the clickEnemy procedure. It will now exit if you are not logged in. I have edited that in the code. Its at the very bottom of the procedure.
    I would write the antiban like this:

    Simba Code:
    procedure antiBan()
    var
      i: integer;
    begin
      i := random(1500);

        case i of
          1..4 : boredHuman(true);
        end;
    end;

    You don't need the

    Code:
    if i < 20 then
      begin
    The reason you want a procedure instead of function is because function is going to create stack space for a return value. And you don't need the if because a switch case is technically an if already.

Page 2 of 2 FirstFirst 12

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
  •