Daniel
2008-04-27 04:13:39
I just made these when i was bored and thought, what the heck, they'll be good use in SRL, so i posted them here.
and here is the FindColorMulti function out of the IP-Includes:
Enjoy!
//Place in: SRL/Core/Inventory.scar
procedure DropToPosition(StartPosition, EndPosition: Integer; WaitPeriod: Integer);
var
i: Integer;
begin
for i:=StartPosition to EndPosition do
begin
if(not(ExistsItem(i))) then
DropItem(i);
Wait(WaitPeriod+Random(WaitPeriod/2));
end;
end;
procedure DropExcept(tsa: TStringArray; WaitPeriod: Integer);
var
i: Integer;
begin
for i:=1 to 28 do
begin
if(not(ExistsItem(i))) or (not(IsUpTextMultiCustom(tsa))) then
DropItem(i);
Wait(WaitPeriod+Random(WaitPeriod/2));
end;
end;
procedure DropToPositionExcept(StartPosition, EndPosition: Integer; tsa: TStringArray; WaitPeriod: Integer);
var
i: Integer;
begin
for i:=StartPosition to EndPosition do
begin
if(not(ExistsItem(i))) or (not(IsUpTextMultiCustom(tsa))) then
DropItem(i);
Wait(WaitPeriod+Random(WaitPeriod/2));
end;
end;
procedure DropExceptColor(tsa: TStringArray; Color: TIntegerArray; WaitPeriod: Integer);
var
i: Integer;
Box: TBox;
x, y: Integer;
begin
for i:=1 to 28 dp
begin
Box:=InvBox(i);
if(not(ExistsItem)) or (not(IsUpTextMulti(tsa))) or (not(FindMultiColor(x, y, MSX1, MSY1, MSX2, MSY2, Color))) then
DropItem(i);
Wait(WaitPeriod+Random(WaitPeriod div 2));
end;
end;
//Place in: SRL/skill/Mining.scar
function DetectPickaxeEx(tx, ty, Tol: Integer; SpiralDist: Extended): String;
var
b: Boolean;
begin
b:=FindPickHeadColor;
if(not(b)) then
Exit;
if(FindObjEx(tx, ty, ['une', 'icka'], [0, hc1, hc2, hc3, hc4, hc5], Tol, 586, 304, SpiralDist, MIX1, MIY1, MIX2, MIY2)) then
Result:='runite' else
if(FindObjEx(tx, ty, ['daman', 'mant', 'icka'], [0, hc1, hc2, hc3, hc4, hc5], Tol, 586, 304, SpiralDist, MIX1, MIY1, MIX2, MIY2)) then
Result:='adamant' else
if(FindObjEx(tx, ty, ['ith', 'hri', 'ril', 'icka'], [0, hc1, hc2, hc3, hc4, hc5], Tol, 586, 304, SpiralDist, MIX1, MIY1, MIX2, MIY2)) then
Result:='mithril' else
if(FindObjEx(tx, ty, ['tee', 'eel', 'icka'], [0, hc1, hc2, hc3, hc4, hc5], Tol, 586, 304, SpiralDist, MIX1, MIY1, MIX2, MIY2)) then
Result:='steel' else
if(FindObjEx(tx, ty, ['Iron', 'icka'], [0, hc1, hc2, hc3, hc4, hc5], Tol, 586, 304, SpiralDist, MIX1, MIY1, MIX2, MIY2)) then
Result:='iron' else
if(FindObjEx(tx, ty, ['ronz', 'ze', 'icka'], [0, hc1, hc2, hc3, hc4, hc5], Tol, 586, 304, SpiralDist, MIX1, MIY1, MIX2, MIY2)) then
Result:='bronze';
end;
function DetectPickaxe(vx, vy: Integer): String;
begin
GameTab(5);
Wait(867+Random(541));
Result:=DetectPickaxeEx(vx, vy, 5, 2.0);
if(Result='') then
begin
GameTab(4);
Wait(869+Random(763));
Result:=DetectPickaxeEx(vx, vy, 5, 3.0);
if(Result='') then
Writeln('WARNING: No Pickaxe Found');
end;
end;
//Place in: SRL/Core/AntiBan.scar
procedure RandomCompass;
var
i: Integer;
begin
i := 1 + Random(359);
case random(7) of
0: MakeCompass('N');
1: MakeCompass('S');
2: MakeCompass('E');
3: MakeCompass('W');
4: MakeCompass(IntToStr(i));
5: SetAngle(True);
6: SetAngle(False);
end;
end;and here is the FindColorMulti function out of the IP-Includes:
{*******************************************************************************
function FindMultiColor(x, y, xs, ys, xe, ye: Integer; Colors: TIntegerArray): Boolean;
By: IP-Drowner
Type: Simple.
Description: Will return true if found one of the colors specified.
Usage: FindMultiColor(x, y, 0, 0, 500, 400, [0, 255', 16777215]);
Result: Will search for the colours Black, Red and White within a boxed area
of 0, 0 and 500, 400.
*******************************************************************************}
function FindMultiColor(x, y, xs, ys, xe, ye: Integer; Colors: TIntegerArray): Boolean;
var
i: Integer;
begin
for i:=1 to Length(Colors) do
begin
Result:=FindColor(x, y, Colors[i], xs, ys, xe, ye);
if(Result) then Break;
end;
end;
{*******************************************************************************
function FindMultiColorTolerance(x, y, xs, ys, xe, ye, Tol: Integer; Colors: TIntegerArray): Boolean;
By: IP-Drowner
Type: Simple.
Description: Will return true if found one of the colors specified.
Usage: FindMultiColor(x, y, 0, 0, 500, 400, [0, 255', 16777215], 5);
Result: Will search for the colours Black, Red and White within a boxed area
of 0, 0 and 500, 400 with a Tolerance level of 5.
*******************************************************************************}
function FindMultiColorTolerance(x, y, xs, ys, xe, ye, Tol: Integer; Colors: TIntegerArray): Boolean;
var
i: Integer;
begin
for i:=1 to Length(Colors) do
begin
Result:=FindColorTolerance(x, y, Colors[i], xs, ys, xe, ye, Tol);
if(Result) then Break;
end;
end;Enjoy!