Results 1 to 9 of 9

Thread: help with a script

  1. #1
    Join Date
    Apr 2016
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default help with a script

    yo, im trying to make this script to eat brews and restores, and when its out of brews, it would teleport, but doesnt work, dunno what im doin wrong can any1 tell me
    Simba Code:
    function Teleport: Boolean;
    var
      x, y, i: Integer;
      begin
        for i := 0 to High(TeleDTMs) do
          if FindDTM(TeleDTMs[i], x, y,556, 208, 722, 462) then
          begin
            mouse(Point(x,y), Mouse_left);
          wait(3000);
          end;
        end;
    function Restore: Boolean;
    var
      x, y, i: Integer;
      begin
        for i := 0 to High(RestDTMs) do
          if FindDTM(RestDTMs[i], x, y, 556, 208, 722, 462) then
          begin
            Mouse(Point(x, y), Mouse_left);
            wait(1200);
            break;
          end;
        end;
    function bank: Boolean;
    var
      x, y, i: Integer;
      p: TPoint;
      begin
        for i := 0 to high(BankerDTMs) do
          if FindDTM(BankerDTMs[i], x, y, 5, 2, 762, 499) then
          begin
            Mouse(Point(x, y), Mouse_right);
        if findText(p, ['Bank'], [upCharsEx], options.getBounds()) then
        Mouse(Point(x, y), mouse_left);
    end;
    end;
    function EatBrew: Boolean;
    var
      i, x, y: Integer;
    begin
      for i := 0 to High(BrewDTMs) do
        if FindDTM(BrewDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          Mouse(Point(x, y), Mouse_left);
          wait(1200);
          if result := false then
          begin
          teleport;
          end;
          if (i >= 2) then
        begin
        //writeln ('Drank 3 or more brews so restoring');
        restore;
          break;
        end;
    end;
    end;
    btw the script does run and eat brews and restores, but doesnt teleport, dunno what im doin wrong

  2. #2
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    It looks like the teleport method is called inside the EatBrew function. However, it's only called if the brew DTM is found, not when you run out of brews. There are a bunch of other things wrong with this too (e.g. functions never return results) but I'm on phone. Might update my post if I get to a PC.

  3. #3
    Join Date
    Apr 2016
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    Quote Originally Posted by Laquisha View Post
    It looks like the teleport method is called inside the EatBrew function. However, it's only called if the brew DTM is found, not when you run out of brews. There are a bunch of other things wrong with this too (e.g. functions never return results) but I'm on phone. Might update my post if I get to a PC.
    alright man

  4. #4
    Join Date
    Dec 2013
    Location
    Pitcairn Island
    Posts
    288
    Mentioned
    20 Post(s)
    Quoted
    166 Post(s)

    Default

    Quote Originally Posted by scripter1 View Post
    alright man
    I'm not really sure how all the logic is meant to work (i.e. can you fail to 'restore' or fail to teleport etc) but I edited some stuff below. You can just put Teleport(); in your mainloop (comment out everything else) to test if your teleport is working (might be bad DTMs or something).

    script

    Simba Code:
    function Teleport(): Boolean;
    var
      x, y, i: Integer;
    begin
      for i := 0 to High(TeleDTMs) do
        if FindDTM(TeleDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          mouse(Point(x, y), Mouse_left);
          wait(3000);
          exit(true); // Set result to true here. Same as:
        end;          // result := true; exit;
    end;

    procedure Restore();
    var
      x, y, i: Integer;
    begin
      for i := 0 to High(RestDTMs) do
        if FindDTM(RestDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          Mouse(Point(x, y), Mouse_left);
          wait(1200);
          break;
        end;
    end;

    function Bank(): Boolean;
    var
      x, y, i: Integer;
      p: TPoint;
    begin
      for i := 0 to high(BankerDTMs) do
        if FindDTM(BankerDTMs[i], x, y, 5, 2, 762, 499) then
        begin
          Mouse(Point(x, y), Mouse_right);
          if findText(p, ['Bank'], [upCharsEx], options.getBounds()) then
          begin
            Mouse(Point(x, y), mouse_left);
            exit(true);
          end;
        end;
    end;

    function EatBrew(): Boolean;
    var
      i, x, y: Integer;
    begin
      for i := 0 to High(BrewDTMs) do
        if FindDTM(BrewDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          Mouse(Point(x, y), Mouse_left);
          wait(1200);
          result := true; // Return true if it ate any brew

          if (i >= 2) then
          begin
            WriteLn ('Drank 3 or more brews so restoring');
            Restore();
            Break;
          end;
        end;
    end;

    begin

        if EatBrew() then
        begin

          // wait(xx)?

        end else
        begin
          if not Teleport() then
          begin
            WriteLn('Out of brews and failed to teleport!');
            TerminateScript();
          end;

          Bank(); // I assume bank after teleport?
        end;

    end.

  5. #5
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    I assumed you were using Aerolib, if not just erase DidRedClick and put true, just a failsafe. Check if it works, i think it should, didnt try it though and made it in a hurry. GL

    Simba Code:
    program BrewManager;
    {$DEFINE SMART}
    {$DEFINE WALKER}
    {$i AeroLib/AeroLib.Simba}

    function teleport: Boolean;
    var
      x, y, i: Integer;
    begin

      for i := 0 to High(TeleDTMs) do
        if FindDTM(TeleDTMs[i], x, y,556, 208, 722, 462) then
        begin
          mouse(Point(x,y), Mouse_left);
          wait(3000);
          result := true;
        end;

    end;

    function restore: Boolean;
    var
      x, y, i: Integer;
    begin

      for i := 0 to High(RestDTMs) do
        if FindDTM(RestDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          Mouse(Point(x, y), Mouse_left);
          wait(1200);
          result:= true;
          break;
        end;

    end;

    function bank: Boolean;
    var
      x, y, i: Integer;
      p: TPoint;
    begin

      for i := 0 to high(BankerDTMs) do
        if FindDTM(BankerDTMs[i], x, y, 5, 2, 762, 499) then
        begin
          Mouse(Point(x, y), Mouse_right);
          if findText(p, ['Bank'], [upCharsEx], options.getBounds()) then
          begin
            Mouse(Point(x, y), mouse_left);
            result := didRedClick;    // If not using Aerolib
            writeln('Banking result: ' + tostr(result));
          end;
        end;

    end;

    function eatBrew: Boolean;
    var
      i, x, y: Integer;
    begin

      for i := 0 to High(BrewDTMs) do
        if FindDTM(BrewDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          Mouse(Point(x, y), Mouse_left);
          wait(1200);
          if (i >= 2) then
          begin
            writeln ('Drank 3 or more brews so restoring');
            result := restore;
            writeln('Brew and Restor result: ' + tostr(result));
            break;
          end;
        end;

    end;

    begin

      if not eatBrew then
        if teleport then
          bank

    end;
    Formerly known as Undorak7

  6. #6
    Join Date
    Apr 2016
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    Quote Originally Posted by Lipcot View Post
    I assumed you were using Aerolib, if not just erase DidRedClick and put true, just a failsafe. Check if it works, i think it should, didnt try it though and made it in a hurry. GL

    Simba Code:
    program BrewManager;
    {$DEFINE SMART}
    {$DEFINE WALKER}
    {$i AeroLib/AeroLib.Simba}

    function teleport: Boolean;
    var
      x, y, i: Integer;
    begin

      for i := 0 to High(TeleDTMs) do
        if FindDTM(TeleDTMs[i], x, y,556, 208, 722, 462) then
        begin
          mouse(Point(x,y), Mouse_left);
          wait(3000);
          result := true;
        end;

    end;

    function restore: Boolean;
    var
      x, y, i: Integer;
    begin

      for i := 0 to High(RestDTMs) do
        if FindDTM(RestDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          Mouse(Point(x, y), Mouse_left);
          wait(1200);
          result:= true;
          break;
        end;

    end;

    function bank: Boolean;
    var
      x, y, i: Integer;
      p: TPoint;
    begin

      for i := 0 to high(BankerDTMs) do
        if FindDTM(BankerDTMs[i], x, y, 5, 2, 762, 499) then
        begin
          Mouse(Point(x, y), Mouse_right);
          if findText(p, ['Bank'], [upCharsEx], options.getBounds()) then
          begin
            Mouse(Point(x, y), mouse_left);
            result := didRedClick;    // If not using Aerolib
            writeln('Banking result: ' + tostr(result));
          end;
        end;

    end;

    function eatBrew: Boolean;
    var
      i, x, y: Integer;
    begin

      for i := 0 to High(BrewDTMs) do
        if FindDTM(BrewDTMs[i], x, y, 556, 208, 722, 462) then
        begin
          Mouse(Point(x, y), Mouse_left);
          wait(1200);
          if (i >= 2) then
          begin
            writeln ('Drank 3 or more brews so restoring');
            result := restore;
            writeln('Brew and Restor result: ' + tostr(result));
            break;
          end;
        end;

    end;

    begin

      if not eatBrew then
        if teleport then
          bank

    end;
    yo can u help me dunno what im doing wrong lol
    Simba Code:
    begin
      loadDtms();
      addonTerminate('freethedtms');   //freeing them on terminate
      repeat
        writeln(getHealth());
        if ((getHealth() <= eatAt) and (getHealth() <> - 1)) then
        begin
          writeln('we are low hp');
          EatBrew();
          end;
         if ((getPrayer() <= PrayerEat) and (getPrayer() <> - 1)) then
         begin
          writeln('we are low prayer');
          Restore;
        end;
       sleep(250);
       until (false);
       if not EatBrew() then
       begin
        teleport();
       repeat until(false)
       end;
      end;
    supposed to make it teleport when out of brews, but doesnt teleport idk what im doin wrong, it does run the script and eat brews/restores, but when out of brews, it doenst teleort

  7. #7
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by scripter1 View Post
    yo can u help me dunno what im doing wrong lol
    Simba Code:
    begin
      loadDtms();
      addonTerminate('freethedtms');   //freeing them on terminate
      repeat
        writeln(getHealth());
        if ((getHealth() <= eatAt) and (getHealth() <> - 1)) then
        begin
          writeln('we are low hp');
          EatBrew();
          end;
         if ((getPrayer() <= PrayerEat) and (getPrayer() <> - 1)) then
         begin
          writeln('we are low prayer');
          Restore;
        end;
       sleep(250);
       until (false);
       if not EatBrew() then
       begin
        teleport();
       repeat until(false)
       end;
      end;
    supposed to make it teleport when out of brews, but doesnt teleport idk what im doin wrong, it does run the script and eat brews/restores, but when out of brews, it doenst teleort
    see the difference

    Simba Code:
    begin
      loadDtms();
      addonTerminate('freethedtms');
      repeat
        writeln(getHealth());
        if ((getHealth() <= eatAt) and (getHealth() <> - 1)) then
        begin
          writeln('we are low hp');
          EatBrew();
        end;
        if ((getPrayer() <= PrayerEat) and (getPrayer() <> - 1)) then
        begin
          writeln('we are low prayer');
          Restore;
        end;
        if not EatBrew() then
          teleport();
        sleep(250);
      until (false);
    end;

  8. #8
    Join Date
    Apr 2016
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    22 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    see the difference

    Simba Code:
    begin
      loadDtms();
      addonTerminate('freethedtms');
      repeat
        writeln(getHealth());
        if ((getHealth() <= eatAt) and (getHealth() <> - 1)) then
        begin
          writeln('we are low hp');
          EatBrew();
        end;
        if ((getPrayer() <= PrayerEat) and (getPrayer() <> - 1)) then
        begin
          writeln('we are low prayer');
          Restore;
        end;
        if not EatBrew() then
          teleport();
        sleep(250);
      until (false);
    end;
    sorry to disturb u, but still doesnt work :s

  9. #9
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by scripter1 View Post
    sorry to disturb u, but still doesnt work :s
    looks like your result for eatBrew(); actually depends on your result for "restore;"

    result := restore;

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
  •