SRL Archive - RS3 Outdated / Broken Scripts

mc_teo's Prayer Script


mc_teo

2011-02-10 15:45:25


{

Prayer, by mc_teo.

Just start somewhere where theres lots of bones lying around.
I like the low level goblins in Lumbridge, and the cows field there too, myself.

Just picks up bones until your inventory is full, then uses them to pray.

N.B. might need to pick the bones colour again (and I hated to see all those hides go to waste, so if you dont want them, comment that line)

}
program Prayer;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i srl\srl\misc\debug.scar}

const
{---SMART Setup Constants---}
WORLD = 165;
MEMBERS = false;
SIGNED = true;
{---------------------------}

var
points: TPointArray;
atpa: T2DPointArray;
tp: TPoint;
I: Integer;

{*******************************************************************************
procedure CleanTPA(var TPA:TPointArray);
By: mc_teo
Description: Tweaks TPA to remove any Out of Array Bounds errors.
*******************************************************************************}
procedure CleanTPA(var TPA:TPointArray);
var
Len: Integer;
I: Integer;
Bound: TPoint;
begin
Len := Length(TPA);
GetClientDimensions(Bound.X, Bound.Y);
for I := 0 to Len-1 do
begin
if ((TPA[I].X < 0) or (TPA[I].X > Bound.X)) then
TPA[I].X := 0;
if ((TPA[I].Y < 0) or (TPA[I].Y > Bound.Y)) then
TPA[I].Y := 0;
end;
end;

{*******************************************************************************
procedure myDebugATPABounds(aPoints: Array Of TPointArray);
By: Wizzup?, lordsaturn, caused (modded by mc_teo)
Description: Adds an image of the client to SMARTS debug canvas,
plotting each TPA's bounds as a box of different colour per TPA.
*******************************************************************************}
procedure myDebugATPABounds(aPoints: array Of TPointArray);
var
Width, Height, ClientBMP, I: Integer;
B, Box: TBox;
BoxColors : TIntegerArray;
SelColor: Integer;
x,y : integer;
BMP : Integer;
Canvas: TCanvas;
begin
Box := GetATPABounds(aPoints);
Width := Box.X2 + 5;
Height := Box.Y2 + 5;
BoxColors := [clRed, clBlue, clBlack, clGreen, clYellow];
ClientBMP := BitmapFromClient(0,0,width-1,height-1);
for i:= 0 to high(aPoints) do
begin
SelColor := BoxColors[Random(length(Boxcolors))];

B := getTPABounds(aPoints[i]);
for x := B.x1 to B.x2 do
begin
FastSetPixel(ClientBMP, x, b.y1, selColor)
FastSetPixel(ClientBMP, x, B.y2, selColor)
end;
for y := B.y1 to B.y2 do
begin
FastSetPixel(ClientBMP, B.x1, y, selColor)
FastSetPixel(ClientBMP, B.x2, y, selColor)
end;

BMP := BitmapFromText(inttostr(i),StatChars);
FastReplaceColor(bmp,clblack,clyellow);
FastReplaceColor(bmp,clwhite,clblack);
SetTransparentColor(bmp,clYellow);
FastDrawTransparent(B.x1 + 2, b.y1 + 2, bmp,clientbmp);
FreeBitmap(BMP);
end;

Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(clientBmp, Canvas, 0, 0);
FreeBitmap(ClientBmp);
end;

{*******************************************************************************
function DebugTPA(Points: TPointArray; Colour: TColor): Boolean;
By: Narcle (well i got this version from his thread anyways)
Description: Paints the Points on SMART's Debug Canvas (in Colour).
*******************************************************************************}
function myDebugTPA(Points: TPointArray; Colour: TColor): Boolean;
var
Bmp: integer;
P: TPoint;
Canvas: TCanvas;
begin
GetClientDimensions(P.x, P.y);
Bmp := BitmapFromString(P.x, P.y,'');
CleanTPA(Points);
DrawTPABitmap(Bmp, Points, Colour);
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Bmp, Canvas, 0, 0);
FreeBitmap(Bmp);
Result := True;
end;

function myIsMoving(interval: Integer): boolean;
var
tp: TPoint;
col: Integer;
begin
tp := Point(RandomRange(MMX1, MMX2), RandomRange(MMY1, MMY2));
col := GetColor(tp.X, tp.Y);
if ((col = clYellow) or (col = clRed)) then
begin
tp := Point(RandomRange(MMX1, MMX2), RandomRange(MMY1, MMY2));
col := GetColor(tp.X, tp.Y);
end;

wait(interval);
if (GetColor(tp.X, tp.Y) = col) then
Result := False
else
Result := True;
end;

procedure WaitUntilNotMoving();
begin
repeat
wait(100);
until(not IsMoving);
end;

procedure Pray();
begin
for I := 0 to 28 do
begin
MMouseItem(I);
if IsUpTextMultiCustom(['ury', 'one']) then
begin
InvMouse(I, 1);
Wait(500);
end;
end;
end;

begin
Smart_Members := MEMBERS;
Smart_Server := WORLD;
Smart_Signed := SIGNED;

SetupSRL;

repeat
WaitUntilNotMoving();
FindColorsSpiralTolerance(MSCX, MSCY, points, 13619417, MSX1, MSY1, MSX2, MSY2, 10)

DebugTPA(points, '');

atpa := SplitTPA(points, 20);
DebugATPABounds(atpa);

for I := 0 to length(atpa)-1 do
begin
tp := MiddleTPA(atpa[I]);
MMouse(tp.X, tp.Y, 3, 3);
wait(500);
if IsUpText('ake') then
begin
Mouse(tp.X, tp.Y, 1, 1, false);
wait(300);
// if ChooseOptionMulti(['ones']) then
if ChooseOptionMulti(['ones', 'owhide']) then
begin
Wait(300);
WaitUntilNotMoving();
break;
end;
end;
end;

if InvFull then
Pray();

wait(1000);
until(false);
end.


Just made to waste a bit of time (I supposed to be studying). Might update it like during the summer, after more exams.

Feel free to leave any comments, or like, you know, give me members.

Anywhos,
~mc_teo

marpis

2011-02-11 02:32:42

Looks really nice :) Useful for F2P players, leveling prayer on free RS is tedious.

procedure Pray();
begin
for I := 0 to 28 do
begin
MMouseItem(I);
if IsUpTextMultiCustom(['ury', 'one']) then
begin
InvMouse(I, 1);
Wait(500);
end;
end;
end;

I believe this will cause the mouse to do 1 unnecessary movement every time it clicks an item, am I correct?


procedure Pray();
begin
for I := 1 to 28 do // Note the "1 to 28" it also works like that!
begin
MMouseItem(I);
if IsUpTextMultiCustom(['ury', 'one']) then
begin
ClickMouse2(True); // This will just click the left mouse button
Wait(500 + random(200)); // a little randomness goes a long way
end;
end;
end;

mc_teo

2011-02-15 14:41:22

Thank you. I didn't bother testing that dropping procedure much, since I had a fairly full inventory of cowhides.

I was testing some coloured walking procedures, and I saw tons of bones dropped, so I said I'd try use of TPA stuff, for practice. They are quite nice, in that they give nearly the tile, as opposed to a specific point, while maintaining speed thanks to being precompiled