Results 1 to 11 of 11

Thread: Even More scripting help (sorry)

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

    Default Even More scripting help (sorry)

    Simba Code:
    program Simple_eater_and_prayer;
    {$i srl/srl.simba}

    var
    x, y,count : integer;
     shark:Integer;
      one_dose:Integer;
       two_dose:integer;
       three_dose:integer;
       four_dose:integer;

    const //credit goes to hoodz from villavu forums for this

    USERNAME = '';//type account username in here
    PASSWORD = '';//type account password in here

    function IsLoggedIn: boolean;//credit goes to hoodz
    begin
    if findcolortolerance(x, y, 6256642, 696, 136, 713, 150, 5) then
    begin
    result := true
    end
    else
    begin
    result := false
    end;
    end;

    procedure LoggingIn;//credit goes to hoodz
    begin
      Wait(200);
      movemouse(376, 188);
      writeln('entering username');
      Wait(200);
      clickmouse(x, y, mouse_left);
      count := 0;
      repeat
        Inc(count);
        PressKey(VK_Back);
      until count > 25;
      Wait(250);
      sendkeys(USERNAME, 0, 0);
      Wait(1000);
      writeln('entering password');
      movemouse(376, 233);
      Wait(200);
      clickmouse(x, y, Mouse_left);
      Wait(200);
      count := 0;
      repeat
        PressKey(VK_Back);
        Inc(count);
      until count > 25
      sendkeys(PASSWORD, 50, 25);
      writeln('logging in');
      Wait(1000);
      movemouse(377, 271);
      Wait(1000);
      ClickMouse(x, y, mouse_left);
      Wait(8000);
      writeln('logged in! (?)')
    end;


    procedure compass_reset;
    begin
    movemouse(542, 20);
    clickmouse(542, 20, 1);
    end;




    function Lowish_hp: boolean;
    begin
    if findcolortolerance(x, y, 255, 724, 26, 742, 38, 5) or
       findcolortolerance(x, y, 2070783, 724, 26, 742, 38, 5) or
       findcolortolerance(x, y, 65535, 724, 26, 742, 38, 5) then
    begin
    result := true
    end
    else
    begin
    result := false
    end;
    end;

    function Lowish_prayer: boolean;
    begin
    if   findcolortolerance(x, y, 65535, 736, 66, 757, 80, 5) then
    begin
    result := true
    end
    else
    begin
    result := false
    end;
    end;

    procedure eating_sharks;
    var
    x, y:integer;
    begin
      if FindDTM(shark, x, y, 548, 206, 734, 459) then
      begin
      mmouse(x, y, 1, 1);
      wait(randomrange(100, 200));
      clickmouse2(mouse_Left);
      wait(randomrange(150, 250));
      end;
      end;




    procedure restoring_prayer;
    var
    x, y:integer;
    begin
      if FindDTM(one_dose, x, y, 548, 206, 734, 459) or
      FindDTM(two_dose, x, y, 548, 206, 734, 459) or
      FindDTM(three_dose, x, y, 548, 206, 734, 459) or
      FindDTM(four_dose, x, y, 548, 206, 734, 459) then
      begin
      mmouse(x, y, 1, 1);
      wait(randomrange(100, 200));
      clickmouse2(mouse_Left);
      wait(randomrange(150, 250));
      end;
      end;


    procedure free_the_slaves;
      begin
        FreeDtm(shark);
        FreeDtm(one_dose);
        FreeDtm(two_dose);
        freedtm(three_dose);
        freedtm(four_dose);
        writeln('freed the slaves')
      end;

     procedure eating;
    Begin
    mousespeed := 60
    repeat
      if (not lowish_hp) then
      begin
      writeln('you are not low hp')
      end;
          if (lowish_hp) then
          begin
          writeln('you are low hp, you are being attacked')
          shark:= DTMFromString('mbQAAAHicY2VgYHBkYmCwBWIbIPYEYi8gfgwUfwnE96EYxA5x0GfICHFlqE0LZoj0sGaYUBrPgA0wYsFgAAD8AgsP');
          eating_sharks;
          end;

    until(false)
    end;

     procedure drinking;
    Begin
    mousespeed := 60
    repeat
      if (not lowish_prayer) then
      begin
      writeln('you are not low prayer')
      end;
          if (lowish_prayer) then
          begin
          writeln('you are low prayer, you are very holy')
          One_dose:=DTMFromString('mbQAAAHicY2VgYHBgYmBwBGJ3ILYFYlcgfgMUfwzEH4D4PRC/AOLqbUsYUtOyGLT6MhmqtixmcHPzZMAGGLFgMAAAZ38Mxg==');
          Two_dose:=DTMFromString('mbQAAAHicY2VgYMhmYmDIBeICIE4D4iwgfgsUfwTE74D4AxC/AGKrA30MwSHhDHqzihgs9/cyVKydx4ANMGLBYAAAt4MNyg==');
          Three_dose:=DTMFromString('mWAAAAHicY2FgYJjMxMAwHYinAfEMIH4LFHsExO+B+BUQWx2awBAcEs5gubeHwXR9EwM6YETDIAAAkb4Lgw==');
          Four_dose :=DTMFromString('mWAAAAHicY2FgYDjIBMF7gPgQEL8Eij0C4tdA/A6ITdY1MBitqGWwOT4ZzEYHjGgYBADOZwxm');
          restoring_prayer;
          end;

    until(false)
    end;


    begin
    mousespeed := 35
    repeat
    if (not isloggedin) then
      begin
      loggingin;
      compass_reset;
      end;
    if (isloggedin) then
          begin
          eating;
          drinking;
          end;
    free_the_slaves;
    until(false)
    end.
    Alright, everything compiles correctly, but I don't understand why it doesn't do both, "eating;" and "drinking;" at the end of the script. basically it will eat sharks once it sees yellow, orange, or red hp, and sip a prayer pot once it sees yellow pray numbers. But like I said, it will only eat, and only if I delete "eating;" then it will drink. Can anyone help me so it compiles both these commands?

  2. #2
    Join Date
    Apr 2015
    Location
    Falador
    Posts
    41
    Mentioned
    2 Post(s)
    Quoted
    18 Post(s)

    Default

    I changed the way it is written and changed some procedures to functions, but nothing is change the way you want it to be. So test this one out and tell me if it works.
    Simba Code:
    program Simple_eater_and_prayer;
    {$i srl/srl.simba}

    var
    shark,one_dose,two_dose,three_dose,four_dose,x, y,count : integer;

    const //credit goes to hoodz from villavu forums for this

    USERNAME = '';//type account username in here
    PASSWORD = '';//type account password in here

    function IsLoggedIn: boolean;//credit goes to hoodz
    begin
    if findcolortolerance(x, y, 6256642, 696, 136, 713, 150, 5) then
    begin
    result := true
    end
    else
    begin
    result := false
    end;
    end;

    procedure LoggingIn;//credit goes to hoodz
    begin
      Wait(200);
      movemouse(376, 188);
      writeln('entering username');
      Wait(200);
      clickmouse(x, y, mouse_left);
      count := 0;
      repeat
        Inc(count);
        PressKey(VK_Back);
      until count > 25;
      Wait(250);
      sendkeys(USERNAME, 0, 0);
      Wait(1000);
      writeln('entering password');
      movemouse(376, 233);
      Wait(200);
      clickmouse(x, y, Mouse_left);
      Wait(200);
      count := 0;
      repeat
        PressKey(VK_Back);
        Inc(count);
      until count > 25
      sendkeys(PASSWORD, 50, 25);
      writeln('logging in');
      Wait(1000);
      movemouse(377, 271);
      Wait(1000);
      ClickMouse(x, y, mouse_left);
      Wait(8000);
      writeln('logged in! (?)')
    end;

    Function compass_reset:Boolean;
     begin
      wait(500);
       Mouse(542,20,2,2,True);
        result:=True
         end;

    Function Lowish_hp: boolean;
     begin
      if findcolortolerance(x, y, 255, 724, 26, 742, 38, 5) or
        findcolortolerance(x, y, 2070783, 724, 26, 742, 38, 5) or
         findcolortolerance(x, y, 65535, 724, 26, 742, 38, 5) then
          Begin
           Writeln('Health Point is low');
            Begin
             Result:=True
           End
         End Else
       Writeln('Health point not low');
    End;

    Function Lowish_prayer: boolean;
     begin
      if findcolortolerance(x, y, 65535, 736, 66, 757, 80, 5) then
       begin
        Writeln('Pray Point is low');
          Begin
           Result:=True
          End
        End Else
      Writeln('Pray Point is not low');
    End;

    function eating_sharks: boolean;
     var
      shark, x, y:integer;
       begin
        shark:= DTMFromString('mbQAAAHicY2VgYHBkYmCwBWIbIPYEYi8gfgwUfwnE96EYxA5x0GfICHFlqE0LZoj0sGaYUBrPgA0wYsFgAAD8AgsP');
         if FindDTM(shark, x, y, 548, 206, 734, 459) then
          begin
           Wait (100 + random(200));
            Writeln('Eating Shark');
             MMouse(x, y, 2, 2);
            begin
           Mouse(x, y, 2, 2, true);
          Result := True;
        end
      end else
        Writeln('couldn''t eat shark');
    end;

    function restoring_prayer: Boolean;
     var
      x, y : Integer;
       begin
        wait(100);
         One_dose := DTMFromString('mbQAAAHicY2VgYHBgYmBwBGJ3ILYFYlcgfgMUfwzEH4D4PRC/AOLqbUsYUtOyGLT6MhmqtixmcHPzZMAGGLFgMAAAZ38Mxg==');
          Two_dose := DTMFromString('mbQAAAHicY2VgYMhmYmDIBeICIE4D4iwgfgsUfwTE74D4AxC/AGKrA30MwSHhDHqzihgs9/cyVKydx4ANMGLBYAAAt4MNyg==');
          Three_dose:= DTMFromString('mWAAAAHicY2FgYJjMxMAwHYinAfEMIH4LFHsExO+B+BUQWx2awBAcEs5gubeHwXR9EwM6YETDIAAAkb4Lgw==');
          Four_dose := DTMFromString('mWAAAAHicY2FgYDjIBMF7gPgQEL8Eij0C4tdA/A6ITdY1MBitqGWwOT4ZzEYHjGgYBADOZwxm');
      if FindDTM(one_dose, x, y, 548, 206, 734, 459) or
       FindDTM(two_dose, x, y, 548, 206, 734, 459) or
        FindDTM(three_dose, x, y, 548, 206, 734, 459) or
         FindDTM(four_dose, x, y, 548, 206, 734, 459) then
         begin
         Wait (100 + random(200));
         Writeln('Drinking Pray Potion');
         MMouse(x, y, 2, 2);
          begin
          Mouse(x, y, 2, 2, true);
          Result := True;
        end
      end else
        Writeln('Can''t drink on Pray Potion');
    end;

    procedure free_the_slaves;
     begin
      FreeDtm(shark);
       FreeDtm(one_dose);
        FreeDtm(two_dose);
         freedtm(three_dose);
       freedtm(four_dose);
      writeln('freed the slaves')
     end;
    begin
    mousespeed := 35
    repeat
    if not isloggedin then
     begin
      loggingin;
       Wait (500 + random(200));
        compass_reset;
         end;
    if lowish_hp then eating_sharks;
     if lowish_prayer then restoring_prayer;
      free_the_slaves;
      until(false)
    end.
    Last edited by The Legendary; 04-15-2015 at 07:20 AM. Reason: grammar mistakes

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

    Default

    Quote Originally Posted by The Legendary View Post
    I changed the way it is written and changed some procedures to functions, but nothing is change the way you want it to be. So test this one out and tell me if it works.
    Simba Code:
    program Simple_eater_and_prayer;
    {$i srl/srl.simba}

    var
    shark,one_dose,two_dose,three_dose,four_dose,x, y,count : integer;

    const //credit goes to hoodz from villavu forums for this

    USERNAME = '';//type account username in here
    PASSWORD = '';//type account password in here

    function IsLoggedIn: boolean;//credit goes to hoodz
    begin
    if findcolortolerance(x, y, 6256642, 696, 136, 713, 150, 5) then
    begin
    result := true
    end
    else
    begin
    result := false
    end;
    end;

    procedure LoggingIn;//credit goes to hoodz
    begin
      Wait(200);
      movemouse(376, 188);
      writeln('entering username');
      Wait(200);
      clickmouse(x, y, mouse_left);
      count := 0;
      repeat
        Inc(count);
        PressKey(VK_Back);
      until count > 25;
      Wait(250);
      sendkeys(USERNAME, 0, 0);
      Wait(1000);
      writeln('entering password');
      movemouse(376, 233);
      Wait(200);
      clickmouse(x, y, Mouse_left);
      Wait(200);
      count := 0;
      repeat
        PressKey(VK_Back);
        Inc(count);
      until count > 25
      sendkeys(PASSWORD, 50, 25);
      writeln('logging in');
      Wait(1000);
      movemouse(377, 271);
      Wait(1000);
      ClickMouse(x, y, mouse_left);
      Wait(8000);
      writeln('logged in! (?)')
    end;

    Function compass_reset:Boolean;
     begin
      wait(500);
       Mouse(542,20,2,2,True);
        result:=True
         end;

    Function Lowish_hp: boolean;
     begin
      if findcolortolerance(x, y, 255, 724, 26, 742, 38, 5) or
        findcolortolerance(x, y, 2070783, 724, 26, 742, 38, 5) or
         findcolortolerance(x, y, 65535, 724, 26, 742, 38, 5) then
          Begin
           Writeln('Health Point is low');
            Begin
             Result:=True
           End
         End Else
       Writeln('Health point not low');
    End;

    Function Lowish_prayer: boolean;
     begin
      if findcolortolerance(x, y, 65535, 736, 66, 757, 80, 5) then
       begin
        Writeln('Pray Point is low');
          Begin
           Result:=True
          End
        End Else
      Writeln('Pray Point is not low');
    End;

    function eating_sharks: boolean;
     var
      shark, x, y:integer;
       begin
        shark:= DTMFromString('mbQAAAHicY2VgYHBkYmCwBWIbIPYEYi8gfgwUfwnE96EYxA5x0GfICHFlqE0LZoj0sGaYUBrPgA0wYsFgAAD8AgsP');
         if FindDTM(shark, x, y, 548, 206, 734, 459) then
          begin
           Wait (100 + random(200));
            Writeln('Eating Shark');
             MMouse(x, y, 2, 2);
            begin
           Mouse(x, y, 2, 2, true);
          Result := True;
        end
      end else
        Writeln('couldn''t eat shark');
    end;

    function restoring_prayer: Boolean;
     var
      x, y : Integer;
       begin
        wait(100);
         One_dose := DTMFromString('mbQAAAHicY2VgYHBgYmBwBGJ3ILYFYlcgfgMUfwzEH4D4PRC/AOLqbUsYUtOyGLT6MhmqtixmcHPzZMAGGLFgMAAAZ38Mxg==');
          Two_dose := DTMFromString('mbQAAAHicY2VgYMhmYmDIBeICIE4D4iwgfgsUfwTE74D4AxC/AGKrA30MwSHhDHqzihgs9/cyVKydx4ANMGLBYAAAt4MNyg==');
          Three_dose:= DTMFromString('mWAAAAHicY2FgYJjMxMAwHYinAfEMIH4LFHsExO+B+BUQWx2awBAcEs5gubeHwXR9EwM6YETDIAAAkb4Lgw==');
          Four_dose := DTMFromString('mWAAAAHicY2FgYDjIBMF7gPgQEL8Eij0C4tdA/A6ITdY1MBitqGWwOT4ZzEYHjGgYBADOZwxm');
      if FindDTM(one_dose, x, y, 548, 206, 734, 459) or
       FindDTM(two_dose, x, y, 548, 206, 734, 459) or
        FindDTM(three_dose, x, y, 548, 206, 734, 459) or
         FindDTM(four_dose, x, y, 548, 206, 734, 459) then
         begin
         Wait (100 + random(200));
         Writeln('Drinking Pray Potion');
         MMouse(x, y, 2, 2);
          begin
          Mouse(x, y, 2, 2, true);
          Result := True;
        end
      end else
        Writeln('Can''t drink on Pray Potion');
    end;

    procedure free_the_slaves;
     begin
      FreeDtm(shark);
       FreeDtm(one_dose);
        FreeDtm(two_dose);
         freedtm(three_dose);
       freedtm(four_dose);
      writeln('freed the slaves')
     end;
    begin
    mousespeed := 35
    repeat
    if not isloggedin then
     begin
      loggingin;
       Wait (500 + random(200));
        compass_reset;
         end;
    if lowish_hp then eating_sharks;
     if lowish_prayer then restoring_prayer;
      free_the_slaves;
      until(false)
    end.
    Yes! this includes both the eating and the drinking now! Sadly the only way it will work is by deleting the freetheslaves; procedure in the main loop. Do the DTMs have to be freed? or is that only if the script will be running for an extended period of time and clog up the cache?

  4. #4
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    Yes! this includes both the eating and the drinking now! Sadly the only way it will work is by deleting the freetheslaves; procedure in the main loop. Do the DTMs have to be freed? or is that only if the script will be running for an extended period of time and clog up the cache?
    It's good programming practice to always free objects from memory when they're no longer in use.

    Easiest way to do this is to create a dedicated procedure, but only call it upon termination of the script.

    e.g.

    Simba Code:
    procedure stop();
    begin
      try
        freeDtms([number1, number2, number3]);
      except
        writeLn('Exception: unable to free DTMs');
    end;

    and to use this, simply call
    Simba Code:
    addOnTerminate('stop');
    once in your mainloop. This way, you ensure that every time your script stops, it will free the DTMs from memory.

    If you force-terminate the thread (i.e. double-click the stop button or kill Simba.exe), this procedure may never run and you'll be left with unfreed memory.

    Therefore it is also good practice to let the script terminate in its own time, after you've sent the kill signal.

    Also: don't ever be sorry to ask for help! That's one of the reasons we're here, after all
    Last edited by KeepBotting; 04-15-2015 at 09:13 PM. Reason: array
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

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

    Default

    I put some of your code in loops

    Simba Code:
    program Simple_eater_and_prayer;
    {$i srl/srl.simba}

    const
      USERNAME = '';
      PASSWORD = '';

    function IsLoggedIn(): Boolean;
    var
      x, y: Integer;
    begin
      result := findcolortolerance(x, y, 6256642, 696, 136, 713, 150, 5);
    end;

    procedure LoggingIn();
    var
      count, x, y: Integer;
    begin
      Wait(200);
      MoveMouse(376, 188);
      WriteLn('entering username');
      Wait(200);
      ClickMouse(x, y, MOUSE_LEFT);
      count := 0;

      repeat
        Inc(count);
        PressKey(VK_Back);
      until (count > 25);

      Wait(250);
      SendKeys(USERNAME, 0, 0);
      Wait(1000);
      WriteLn('entering password');
      MoveMouse(376, 233);
      Wait(200);
      ClickMouse(x, y, MOUSE_LEFT);
      Wait(200);
      count := 0;

      repeat
        PressKey(VK_Back);
        Inc(count);
      until (count > 25);

      SendKeys(PASSWORD, 50, 25);
      WriteLn('logging in');
      Wait(1000);
      MoveMouse(377, 271);
      Wait(1000);
      ClickMouse(x, y, MOUSE_LEFT);
      Wait(8000);
      WriteLn('logged in! (?)')
    end;

    function Compass_Reset(): Boolean;
    begin
      Wait(500);
      Mouse(542, 20, 2, 2, True);
      Result := True
    end;

    function Lowish_HP(): Boolean;
    var
      x, y, i: Integer;
      colours: Array[0..2] of Integer;
    begin
      colours := [255, 2070783, 65535]

      for i := 0 to High(colours) do
        if FindColorTolerance(x, y, colours[i], 724, 26, 742, 38, 5) then
        begin
          WriteLn('Health Point is low');
          Result := True
        end else
          WriteLn('Health point not low');
    end;

    function Lowish_Prayer: Boolean;
    var
      x, y: Integer;
    begin
      if FindColorTolerance(x, y, 65535, 736, 66, 757, 80, 5) then
      begin
        WriteLn('Pray Point is low');
        Result := True
      end else
        WriteLn('Pray Point is not low');
    end;

    function Eating_Sharks: Boolean;
    var
      shark, x, y: integer;
    begin
      shark := DTMFromString('mbQAAAHicY2VgYHBkYmCwBWIbIPYEYi8gfgwUfwnE96EYxA5x0GfICHFlqE0LZoj0sGaYUBrPgA0wYsFgAAD8AgsP');

      if FindDTM(shark, x, y, 548, 206, 734, 459) then
      begin
        Wait(100 + Random(200));
        WriteLn('Eating Shark');
        MMouse(x, y, 2, 2);
        Mouse(x, y, 2, 2, True);
        Result := True;
      end else
        Writeln('Couldn''t eat shark');

      FreeDTM(shark);
    end;

    function Restoring_Prayer: Boolean;
    var
      x, y, i: Integer;
      potDTMs: Array[0..3] of Integer;
    begin
      potDTMs := [
        DTMFromString('mbQAAAHicY2VgYHBgYmBwBGJ3ILYFYlcgfgMUfwzEH4D4PRC/AOLqbUsYUtOyGLT6MhmqtixmcHPzZMAGGLFgMAAAZ38Mxg=='),
        DTMFromString('mbQAAAHicY2VgYMhmYmDIBeICIE4D4iwgfgsUfwTE74D4AxC/AGKrA30MwSHhDHqzihgs9/cyVKydx4ANMGLBYAAAt4MNyg=='),
        DTMFromString('mWAAAAHicY2FgYJjMxMAwHYinAfEMIH4LFHsExO+B+BUQWx2awBAcEs5gubeHwXR9EwM6YETDIAAAkb4Lgw=='),
        DTMFromString('mWAAAAHicY2FgYDjIBMF7gPgQEL8Eij0C4tdA/A6ITdY1MBitqGWwOT4ZzEYHjGgYBADOZwxm')
        ];

      for i := 0 to High(potDTMs) do
      if FindDTM(potDTMs[i], x, y, 548, 206, 734, 459) then
      begin
        Wait(100 + Random(200));
        WriteLn('Drinking ' + toStr(i + 1) + ' dose Pray Potion');
        MMouse(x, y, 2, 2);
        Mouse(x, y, 2, 2, True);
        Result := True;
      end else
        WriteLn('Can''t drink on Pray Potion');

      for i := 0 to high(potDTMs) do
        FreeDTM(potDTMs[i]);
    end;

    begin
      MouseSpeed := 35

      repeat
        if not IsLoggedIn() then
        begin
          LoggingIn();
          Wait(500 + random(200));
          Compass_Reset;
        end;

        if Lowish_HP() then
          Eating_Sharks();

        if Lowish_Prayer() then
          Restoring_Prayer();
      until false;
    end.

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

    Default

    Quote Originally Posted by The Mayor View Post
    I put some of your code in loops

    Simba Code:
    program Simple_eater_and_prayer;
    {$i srl/srl.simba}

    const
      USERNAME = '';
      PASSWORD = '';

    function IsLoggedIn(): Boolean;
    var
      x, y: Integer;
    begin
      result := findcolortolerance(x, y, 6256642, 696, 136, 713, 150, 5);
    end;

    procedure LoggingIn();
    var
      count, x, y: Integer;
    begin
      Wait(200);
      MoveMouse(376, 188);
      WriteLn('entering username');
      Wait(200);
      ClickMouse(x, y, MOUSE_LEFT);
      count := 0;

      repeat
        Inc(count);
        PressKey(VK_Back);
      until (count > 25);

      Wait(250);
      SendKeys(USERNAME, 0, 0);
      Wait(1000);
      WriteLn('entering password');
      MoveMouse(376, 233);
      Wait(200);
      ClickMouse(x, y, MOUSE_LEFT);
      Wait(200);
      count := 0;

      repeat
        PressKey(VK_Back);
        Inc(count);
      until (count > 25);

      SendKeys(PASSWORD, 50, 25);
      WriteLn('logging in');
      Wait(1000);
      MoveMouse(377, 271);
      Wait(1000);
      ClickMouse(x, y, MOUSE_LEFT);
      Wait(8000);
      WriteLn('logged in! (?)')
    end;

    function Compass_Reset(): Boolean;
    begin
      Wait(500);
      Mouse(542, 20, 2, 2, True);
      Result := True
    end;

    function Lowish_HP(): Boolean;
    var
      x, y, i: Integer;
      colours: Array[0..2] of Integer;
    begin
      colours := [255, 2070783, 65535]

      for i := 0 to High(colours) do
        if FindColorTolerance(x, y, colours[i], 724, 26, 742, 38, 5) then
        begin
          WriteLn('Health Point is low');
          Result := True
        end else
          WriteLn('Health point not low');
    end;

    function Lowish_Prayer: Boolean;
    var
      x, y: Integer;
    begin
      if FindColorTolerance(x, y, 65535, 736, 66, 757, 80, 5) then
      begin
        WriteLn('Pray Point is low');
        Result := True
      end else
        WriteLn('Pray Point is not low');
    end;

    function Eating_Sharks: Boolean;
    var
      shark, x, y: integer;
    begin
      shark := DTMFromString('mbQAAAHicY2VgYHBkYmCwBWIbIPYEYi8gfgwUfwnE96EYxA5x0GfICHFlqE0LZoj0sGaYUBrPgA0wYsFgAAD8AgsP');

      if FindDTM(shark, x, y, 548, 206, 734, 459) then
      begin
        Wait(100 + Random(200));
        WriteLn('Eating Shark');
        MMouse(x, y, 2, 2);
        Mouse(x, y, 2, 2, True);
        Result := True;
      end else
        Writeln('Couldn''t eat shark');

      FreeDTM(shark);
    end;

    function Restoring_Prayer: Boolean;
    var
      x, y, i: Integer;
      potDTMs: Array[0..3] of Integer;
    begin
      potDTMs := [
        DTMFromString('mbQAAAHicY2VgYHBgYmBwBGJ3ILYFYlcgfgMUfwzEH4D4PRC/AOLqbUsYUtOyGLT6MhmqtixmcHPzZMAGGLFgMAAAZ38Mxg=='),
        DTMFromString('mbQAAAHicY2VgYMhmYmDIBeICIE4D4iwgfgsUfwTE74D4AxC/AGKrA30MwSHhDHqzihgs9/cyVKydx4ANMGLBYAAAt4MNyg=='),
        DTMFromString('mWAAAAHicY2FgYJjMxMAwHYinAfEMIH4LFHsExO+B+BUQWx2awBAcEs5gubeHwXR9EwM6YETDIAAAkb4Lgw=='),
        DTMFromString('mWAAAAHicY2FgYDjIBMF7gPgQEL8Eij0C4tdA/A6ITdY1MBitqGWwOT4ZzEYHjGgYBADOZwxm')
        ];

      for i := 0 to High(potDTMs) do
      if FindDTM(potDTMs[i], x, y, 548, 206, 734, 459) then
      begin
        Wait(100 + Random(200));
        WriteLn('Drinking ' + toStr(i + 1) + ' dose Pray Potion');
        MMouse(x, y, 2, 2);
        Mouse(x, y, 2, 2, True);
        Result := True;
      end else
        WriteLn('Can''t drink on Pray Potion');

      for i := 0 to high(potDTMs) do
        FreeDTM(potDTMs[i]);
    end;

    begin
      MouseSpeed := 35

      repeat
        if not IsLoggedIn() then
        begin
          LoggingIn();
          Wait(500 + random(200));
          Compass_Reset;
        end;

        if Lowish_HP() then
          Eating_Sharks();

        if Lowish_Prayer() then
          Restoring_Prayer();
      until false;
    end.
    with that it gives me this error:

    Error: Could not call proc at line 70

    -Thank you all for contributing

  7. #7
    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 jstemper View Post
    with that it gives me this error:

    Error: Could not call proc at line 70

    -Thank you all for contributing
    Sorry, might be that missing semicolon on the line above it (line 68)

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

    Default

    no problem mr mayor! well now that everyone is here, does anyone know if the DTMs change for alotic on login or something? I had to re do all the shark and prayer dose DTMs, because they weren't being recognized

  9. #9
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    no problem mr mayor! well now that everyone is here, does anyone know if the DTMs change for alotic on login or something? I had to re do all the shark and prayer dose DTMs, because they weren't being recognized
    Had you any tolerance for the points in your DTM? Generally, the midpoint should have a tolerance of (depending on the item) 10 - 30, and the subpoints are usually tolerance 0, but might have to be adjusted for Alotic.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

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

    Default

    Quote Originally Posted by KeepBotting View Post
    Had you any tolerance for the points in your DTM? Generally, the midpoint should have a tolerance of (depending on the item) 10 - 30, and the subpoints are usually tolerance 0, but might have to be adjusted for Alotic.
    Now that you say that I can't recall that I did... it wouldn't really make sense that they would change so if it happens again I'll experiment with different tolerances

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

    Default

    @jstemper; I have a Alotic Include that I'm working on, eating is a simple as

    Simba Code:
    if (minimap.getHealth() < 25) then
      if inventory.searchDTM(shark, mouse_left) then //clicks shark
        writeln('ate shark')
      else
        writeln('Could not find shark in inventory');

    As soon as I update minimap functions and get the updater working I will be able to help you use the include, the script can be 1/3 as big if you use the include

    Simba Code:
    program Simple_eater_and_prayer;
    {$I Alotic/lib/alotic.Simba}

    var
      one_dose,two_dose,three_dose,four_dose,x, y,count : integer;

    Procedure declarePlayers()
    begin
      setLength(players, 1);
      with players[0] do
        user := USERNAMEHERE;
        pass := PASSWORDHERE;
      end;
    end;

    function eating_sharks: boolean;
    var
      shark:integer;
    begin
      shark := DTMFromString('mbQAAAHicY2VgYHBkYmCwBWIbIPYEYi8gfgwUfwnE96EYxA5x0GfICHFlqE0LZoj0sGaYUBrPgA0wYsFgAAD8AgsP');
      result := inventory.searchDTM(shark, mouse_left);
      if (result) then
        writeln('Eating shark')
      else
        Writeln('couldn''t eat shark');
      freeDTM(shark)
    end;

    function restoring_prayer: Boolean;
    begin
      wait(100);
      One_dose := DTMFromString('mbQAAAHicY2VgYHBgYmBwBGJ3ILYFYlcgfgMUfwzEH4D4PRC/AOLqbUsYUtOyGLT6MhmqtixmcHPzZMAGGLFgMAAAZ38Mxg==');
      Two_dose := DTMFromString('mbQAAAHicY2VgYMhmYmDIBeICIE4D4iwgfgsUfwTE74D4AxC/AGKrA30MwSHhDHqzihgs9/cyVKydx4ANMGLBYAAAt4MNyg==');
      Three_dose:= DTMFromString('mWAAAAHicY2FgYJjMxMAwHYinAfEMIH4LFHsExO+B+BUQWx2awBAcEs5gubeHwXR9EwM6YETDIAAAkb4Lgw==');
      Four_dose := DTMFromString('mWAAAAHicY2FgYDjIBMF7gPgQEL8Eij0C4tdA/A6ITdY1MBitqGWwOT4ZzEYHjGgYBADOZwxm');
      if inventory.searchDTM([one_dose, two_dose, three_dose, four_dose], mouse_left) then
        result := true;
      if (result) then
        Writeln('Drinking Pray Potion')
      else
        Writeln('Can''t drink on Pray Potion');
    end;

    procedure free_the_slaves;
    begin
      FreeDtm(one_dose);
      FreeDtm(two_dose);
      freedtm(three_dose);
      freedtm(four_dose);
      writeln('freed the slaves')
    end;

    begin
      repeat
      if not isloggedin then
      begin
        players[currentPlayer].login();
        Wait (500 + random(200));
      end;
      if lowish_hp then
        eating_sharks;
      if lowish_prayer then restoring_prayer;
        free_the_slaves;
      until(false)
    end.

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
  •