SRL Archive - SRL Snippets

function BuyGEItem(ItemName :String) :Boolean;


Home

2012-03-11 17:21:21

Handles multiple results.
This is case sensivite. Ex. Not dragon battleaxe. Correct Dragon battleaxe.

This calculates ColorCount of your own inputted text and compares it to Results given by GE.

function Results :Boolean;
var
TextBox :TBox;
begin
TextBox := IntToBox(65, 344 + 15, 495, 344 + 30);
Result := CountColor(23200, TextBox.X1, TextBox.Y1, TextBox.X2, TextBox.Y2) <> 578;
end;


function BuyGEItem(ItemName :String) :Boolean;
var
TextBox :TBox;
LineCount, CorrCount, I :Integer;
begin
TypeSendEx(ItemName, False);
CorrCount := CountColor(clWhite, 31, 453, 492, 473) - 14;
WriteLn('Correct Count : ' + IntToStr(CorrCount));
If WaitFunc(@Results, RandomRange(10, 25), RandomRange(2500, 3000)) then
for I := 1 to 7 do
begin
TextBox := IntToBox(65, 344 + (15 * (I - 1)), 495, 344 + (15 * (I - 1)) + 15);
LineCount := CountColor(23200, TextBox.X1, TextBox.Y1, TextBox.X2, TextBox.Y2);
WriteLn('Line ' + IntToStr(I) + ' Count : ' + IntToStr(LineCount));
If InRange(LineCount, CorrCount - 1, CorrCount + 1) then
begin
MouseBox(TextBox.X1, TextBox.Y1, TextBox.X2, TextBox.Y2, mouse_Left);
Result := True;
Exit;
end;
end;
Result := False;
end;

~Home

Imanoobbot

2012-03-11 17:40:18

Looks quite nice so far! ;)

Coh3n

2012-03-12 21:58:11

There's actually a grandexchange.simba in SRL/misc. Maybe it's worth updating?