Here are a bunch of fixes, or improvements rather on the current functions.
Some developers have seen them, others have not. 
Sorry for all of the 'x' on the beginnings. Let me compile it.
scar Code:
type
SRL_Item = (srl_BitmapMask, srl_Bitmap, srl_DTM, srl_Color, srl_Colour);
{*******************************************************************************
function FindItemEx(var x, y: Integer; Ident: Integer; IdentType: SRL_Item; Area: TBox; Tol: TIntegerArray): Boolean;
By: Nava2
Description: Finds an item in Area specified by TBox in Area. Valid IdentTypes are:
bmp, mask, color, dtm. The Tol variable is:
0 : Color Tolerance;
1 : Contour Tolerance or minimum Colors to Find to be True.
*******************************************************************************}
function xFindItemEx(var x, y: Integer; IdentType: SRL_Item; Ident: Integer; Area: TBox; Tol: TIntegerArray): Boolean;
var
Pts: TPointArray;
begin
Result := False;
if (IdentType = srl_BitmapMask) and (High(Tol) <> 1) then SetLength(Tol, 2) else SetLength(Tol, 1);
case IdentType of
srl_BitmapMask: Result := FindBitmapMaskTolerance(Ident, x, y, Area.x1, Area.y1, Area.x2, Area.y2, Tol[0], Tol[1]);
srl_Bitmap:FindBitmapSpiralTolerance(Ident, x, y, Area.x1, Area.y1, Area.x2, Area.y2, Tol[0]);
srl_DTM: Result := FindDTM(Ident, x, y, Area.x1, Area.y1, Area.x2, Area.y2);
srl_Color, srl_Colour:
begin
FindColorsTolerance(Pts, Ident, Area.x1, Area.y1, Area.x2, Area.y2, Tol[0]);
if Tol[1] < 1 then Tol[1] := 1;
Result := Length(Pts) >= Tol[1];
if Result then
MiddleTPAEx(Pts, x, y);
end;
else
SRL_Warn('FindItem', 'Invalid identifier input as IdentType.', -1);
end;
end;
function xFindItem(var x, y: Integer; IdentType: SRL_Item; Ident, x1, y1, x2, y2: Integer; Tol: TIntegerArray): Boolean;
begin
Result := xFindItemEx(x, y, IdentType, Ident, IntToBox(x1, y1, x2, y2), Tol);
end;
scar Code:
// Amount.scar
{*******************************************************************************
function GetAmount(itemx, itemy: Integer): Integer;
By: masquerader || Improved by Freddy1990 ||Updated June 4 2007 by Boreas || Fixed by Mr. Freeweed
Description: Returns the ammount of an item at a certain position.
*******************************************************************************}
{Edit: More efficient. Shorter.}
function xGetAmount(itemx, itemy: Integer): Integer;
//uses font cropped to work with "Opponent's Offer"
//you can get the coords from using IsTextInAreaEx w/ StatChars, but
//you probably shouldnt use this function directly (other functions use it)
//'K' and 'M' work (for approx values)
//non-stackable =1
//blank = 0
var
amountstr: string;
Colors: TIntegerArray;
tempx, tempy, I, L: Integer;
begin
Colors := [65535, 16777215, 8453888, -1];
for I := 0 to 3 do
if FindColor(TempX, TempY, Colors[I], Itemx, Itemy, Itemx + 10, ItemY + 10) then
Break;
AmountStr := TrimOthers(GetTextAtEx(itemx, itemy + 4, 0, tradeChars, False, False, 0, 2, Colors[I], 10, True, tr_AlphaNumericChars));
L := Length(AmountStr);
if (L > 0) then
begin
if (Pos('K', AmountStr) > 0) then
Result := StrToInt(GetNumbers(AmountStr)) * 1000
else
if (Pos('M', AmountStr) > 0) then
Result := StrToInt(GetNumbers(AmountStr)) * 1000000
else
Result := StrToInt(AmountStr);
end else
if (FindColor(tempx, tempy, 65536, itemx, itemy, itemx + 30, itemy + 30)) then
Result := 1;
end;
{*******************************************************************************
function ItemCoordinates(Area, ItemType: string; Item, Tol: TIntegerArray): TPointArray;
By: masquerader modified by ZephyrsFury
Description: Returns a TPA with the positions of all occurances of Item.
Parameters:
Area - 'inv', 'shop', 'bank', 'trade', 'your trade'.
ItemType - DTM, Color, BitmapMask, Bitmap
Item - name/value of your dtm/bmp/color/bmpmask.
Tol - DTM - [] (dtm's can't have tolerance).
Bitmap - [BMPTol].
Color - [COLOUR Tol].
BitmapMask - [BMPTol, ContourTol].
*******************************************************************************}
function xItemCoordinates(Area: String; ItemType: SRL_Item; Item: Integer; Tol: TIntegerArray): TPointArray;
{Edit: Added FindItem, shorter now. Also faster}
var
startx, starty, rowsize, colsize, colnumber, rownumber, col, row: Integer;
x1, y1, x2, y2: Integer;
itemx, itemy, L: Integer;
begin
if (CheckArea(area)) then
begin
AreaInfo(area, startx, starty, rowsize, colsize, colnumber, rownumber);
SetLength(Result, RowNumber * ColNumber);
for row := 0 to rownumber - 1 do
for col := 0 to colnumber - 1 do
begin
x1 := startx + col * colsize;
y1 := starty + row * rowsize;
x2 := x1 + colsize;
y2 := y1 + rowsize;
if FindItem(Itemx, Itemy, Item, ItemType, x1, y1, x2, y2, Tol) then
begin
Result[L].x := x1;
Result[L].y := y1;
Inc(L);
end;
end;
end;
SetLength(Result, L);
end;
{*******************************************************************************
function CountItemsIn(Area, ItemType: string; Item: Integer; Tol: TIntegerArray): Integer;
By: masquerader modified by ZephyrsFury
Description: Counts the number of items found within the Area. (Does not count stacks)
Parameters:
Area - 'inv', 'shop', 'bank', 'trade', 'your trade'.
ItemType - 'dtm', 'bmp', 'color', 'bmpmask'.
Item - name/value of your dtm/bmp/color/bmpmask.
Tol - 'dtm' - [] (dtm's can't have tolerance).
'bmp' - [BMPTol].
'color' - [COLOUR Tol].
'bmpmask' - [BMPTol, ContourTol].
*******************************************************************************}
function xCountItemsIn(Area: String; ItemType: SRL_Item; Item: Integer; Tol: TIntegerArray): Integer;
{Edit: Added FindItem stuffs}
var
Coords: TPointArray;
begin
Coords := ItemCoordinates(Area, ItemType, Item, Tol);
Result := Length(Coords);
end;
{*******************************************************************************
function CountItemsArea(area: String): Integer;
By: masquerader
Description: Counts items in a specified area. (Doesn't count stacks)
*******************************************************************************}
function xCountItemsArea(area: string): Integer;
{Edit: Added FindItem stuffs}
begin
Result := CountItemsIn(area, srl_Color, 65536, [0]);
end;
scar Code:
//Antiban.scar
// just a typo
{*******************************************************************************
procedure BoredHuman;
By: WT-Fakawi, small edit by Hy71194
Description: Performs 5-15 times:
* Rotates the cam,
* Moves the mouse around MainScreen,
* If it finds IsUpText('option'), it will Chooseoption('Examine');
*******************************************************************************}
scar Code:
// AutoColor.scar
{*******************************************************************************
function FindColorRecordEx(var rx, ry: Integer; ColorRecord: TAutoColorInfo; x1, y1, x2, y2: Integer; RGBXYZCheck: Boolean): Integer;
By: Sumilion
Description: Gets a color from the minimap using a TAutoColorInfo record, with extra options.
*******************************************************************************}
{Removed necessary begins and ends...}
function xFindColorRecordEx(var rx, ry: Integer; ColorRecord: TAutoColorInfo; x1, y1, x2, y2: Integer; RGBXYZCheck: Boolean): Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
with ColorRecord do
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(HueMod, SatMod);
FindColorsSpiralTolerance(MMCX, MMCY, arP, Color, x1, y1, x2, y2, LumTol);
if (Length(arP) = 0) then
begin
//Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
if (RGBXYZCheck) then
ColorToRGB(arC[i], R, G, B);
if (not RGBXYZCheck) or
((R >= MinR) and (R <= MaxR) and (G >= MinG) and (G <= MaxG) and (B >= MinB) and (B <= MaxB)) then
begin
if (RGBXYZCheck) then
ColorToXYZ(arC[i], X, Y, Z);
if (not RGBXYZCheck) or
((X >= MinX) and (X <= MaxX) and (Y >= MinY) and (Y <= MaxY) and (Z >= MinZ) and (Z <= MaxZ)) then
begin
rx := MMCX; ry := MMCY;
if FindColorSpiralTolerance(rx, ry, arC[i], MMX1, MMY1, MMX2, MMY2, 0) then
if (rs_OnMinimap(rx, ry)) then
if (CountColor(arC[i], MMX1, MMY1, MMX2, MMY2) > MinCount) then
if (CountColor(arC[i], MMX1, MMY1, MMX2, MMY2) < MaxCount) or (MaxCount = 0) then
begin
Result := arC[i];
Break;
end;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
end;
{*******************************************************************************
function FindSandColor: Integer;
By: Tarajunky
Description: Autodetects Sand Color on Minimap
*******************************************************************************}
{Cleaned....}
function xFindSandColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(0);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 7255237, MMX1, MMY1, MMX2, MMY2, 40);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the Sand color, no result.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;
arC := GetColors(arP);
arL := High(arC);
for i := 0 to arL do
begin
if (rs_OnMinimap(arP[i].x, arP[i].y)) then
begin
ColorToRGB(arC[i], R, G, B);
if InRange(R,175,220) then if InRange(G,140,220) then if InRange(B,80,140) then
begin
ColorToHSL(arC[i], H, S, L);
if (H >= 10.5) and (H <= 16.75) and (S >= 37.50) and (S <= 50.50) and (L >= 53.50) and (L <= 66.50) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 32.00) and (X <= 52.90) and (Y >= 32.00) and (Y <= 60.90) and (Z >= 15.00) and (Z <= 27.88) then
begin
if (GetColor(arP[i].x+3,arP[i].y)=arC[i]) and (GetColor(arP[i].x+3,arP[i].y+3)=arC[i]) then
if (GetColor(arP[i].x,arP[i].y+3)=arC[i]) and (GetColor(arP[i].x+5,arP[i].y)=arC[i]) then
if (GetColor(arP[i].x+5,arP[i].y+3)=arC[i]) and (GetColor(arP[i].x+5,arP[i].y+5)=arC[i]) then
if (GetColor(arP[i].x+3,arP[i].y+5)=arC[i]) and (GetColor(arP[i].x,arP[i].y+5)=arC[i]) then
begin
Result := arC[i];
Writeln('SandColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
if (i = arL + 1) then
Writeln('Failed to find Sand color!');
end;
// lordsaturn
function DirtRoadColor: Integer;
var
CTS, II, Count, PCount: Integer;
ColourDensity: Extended;
TPA, CPts: TPointArray;
TIA: TIntegerArray;
TB: TBox;
begin
Result := 0;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.44, 1.42);
if (FindColorsTolerance(TPA, 1915466, MMX1, MMY1, MMX2, MMY2, 10)) then
begin
FilterPointsPie(TPA, 0.0, 360.0, 0.0, 76.0, MMCX, MMCY);
TIA := GetColors(TPA);
ClearSameIntegersAndTPA(TIA, TPA);
for II := 0 to High(TIA) do
begin
FindColorsTolerance(CPts, TIA[II], MMX1, MMY1, MMX2, MMY2, 0);
TB := GetTPABounds(CPts);
Count := Length(CPts);
try
ColourDensity := Count / ((TB.x2 - TB.x1) * (TB.y2 - TB.y1));
except end;
if (Count < 150) or (ColourDensity < 0.08) or (Count <= PCount) then Continue;
Result := TIA[II];
PCount := Count;
end;
end;
if (Result > 0) then WriteLn('Dirt Road Color = ' + IntToStr(Result))
else WriteLn('Could not find Dirt Road Color!');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
end;
// lordsaturn
function LadderColor: integer;
var
GC, GC2, ColorCount, a, i, j, n, l, TestColor, Red, Green, Blue : integer;
ColorArray : array of integer;
P, P2 : array of Tpoint;
begin
GC := 10837;
GC2 := 1849186;
Flag;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 60);
SetArrayLength(ColorArray,32);
FindColorsSpiralTolerance(MMCX, MMCY, P2, GC2, MMX1, MMY1, MMX2, MMY2, 20);
P := CombineTPA(P, P2);
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
if rs_OnMinimap(P[a].x,P[a].y) then
begin
TestColor := GetColor(P[a].x,P[a].y);
if SimilarColors(TestColor,GC,60) or SimilarColors(TestColor,GC2,20) then
begin
ColorToRGB(TestColor,Red,Green,Blue);
if Blue <= 30 then if Red - Blue <= 105 then if Red <= 115 then
if Green <= 70 then if Green >= 5 then if Green - Blue >= 5 then
if Green - Blue <= 60 then if Red >= 55 then
if InRange((Red - Green),25,65) then
if Red - Blue >= 55 then if Blue <> 1 then if Blue <> 3 then
begin
n:=0;
for i:= 0 to 3 do
begin
for j:= 0 to 7 do
begin
ColorArray[n]:=GetColor(P[a].x+i,P[a].y-3+j);
n:=n+1;
end;
end;
ColorCount:=0;
for n:= 0 to 31 do
begin
if ColorArray[n]=TestColor then ColorCount:=ColorCount+1;
end;
if ColorCount<17 then if ColorCount>12 then
begin
Result := TestColor;
WriteLn('LadderColor = ' + IntToStr(TestColor));
//+
//' at ' + IntToStr(P[a].x) + ',' + IntToStr(P[a].y));
Exit;
end;
end;
end;
end;
end;
WriteLn('Could not find Ladder Color!');
Result := 0;
end;
// ls
function VarrockPathColor: Integer;
var
CTS, II, Count, PCount: Integer;
ColourDensity: Extended;
TPA, CPts: TPointArray;
TIA: TIntegerArray;
TB: TBox;
begin
Result := 0;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.83, 0.24);
if (FindColorsTolerance(TPA, 6126729, MMX1, MMY1, MMCX, MMY2, 10)) then
begin
FilterPointsPie(TPA, 0.0, 360.0, 0.0, 76.0, MMCX, MMCY);
TIA := GetColors(TPA);
ClearSameIntegersAndTPA(TIA, TPA);
for II := 0 to High(TIA) do
begin
FindColorsTolerance(CPts, TIA[II], MMX1, MMY1, MMCX, MMY2, 0);
TB := GetTPABounds(CPts);
Count := Length(CPts);
try
ColourDensity := Count / ((TB.x2 - TB.x1) * (TB.y2 - TB.y1));
except end;
if (Count < 300) or (ColourDensity < 0.08) or (Count <= PCount) then Continue;
Result := TIA[II];
PCount := Count;
end;
end;
if (Result > 0) then WriteLn('Varrock Path Color = ' + IntToStr(Result))
else WriteLn('Could not find Varrock Path Color!');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
end;
scar Code:
// Bank.scar
{*******************************************************************************
Function CurrentBankTab: Integer;
by: Narcle
Description: Returns Current Bank Tab selected
*******************************************************************************}
{Changed the I var to just use the Result, shorter}
function xCurrentBankTab: Integer;
begin
if not BankScreen then
Exit;
for Result := 1 to 9 do
if GetColor(40 + 48 * (Result - 1), 83) = 2896954 then
Exit;
Result := 0;
end;
{*******************************************************************************
function CloseBank: Boolean;
By: Starblaster100
Description: Closes the bank window - Tries twice before exiting
*******************************************************************************}
{Added Random wait into the main loop, just because as it waits exact time.. we don't want that now do we?}
function xCloseBank: Boolean;
var
i, Timer, Points: Integer;
begin
if BankScreen then
begin
Timer := GetTimeRunning + 8000;
repeat
Mouse(483, 28, 10, 12, True);
for i := 0 to 30 do
begin
if not bankscreen then
begin
Result:= True;
Break;
end;
Wait(100);
end;
Wait(Random(100));
until (Points < 170) or (GetTimeRunning > Timer);
end;
end;
{*******************************************************************************
function OpenBankGlass(WhichBank: String; ChangeCompass, ChangeAngle: Boolean): Boolean;
By: Wizzup? and modified by Ron
Description: Opens the bank.
Valid arguments are:
'feb' (Falador East Bank)
'fwb' (Falador West Bank)
'veb' (Varrock East Bank)
'vwb' (Varrock West Bank)
'db' (Draynor Bank)
'akb' (Al-Kharid Bank)
*******************************************************************************}
{Randomness...}
function xOpenBankGlass(WhichBank: string; ChangeCompass, ChangeAngle: Boolean): Boolean;
var
OBC: TPoint;
c, Speed: Integer;
begin
Speed := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if ChangeAngle then SetAngle(True);
if ChangeCompass then
begin
c := Random(2);
case WhichBank of
'feb', 'fwb', 'veb': if c = 0 then MakeCompass('N') else MakeCompass('S');
'akb', 'db', 'eb', 'vwb': if c = 0 then MakeCompass('E') else MakeCompass('W');
end;
end;
if FindColorTolerance(OBC.x, OBC.y, 10070458, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(OBC.x, OBC.y, 4, 4);
Wait(RandomRange(80, 110));
if IsUpTextMultiCustom(['nk', 'bo', 'ot']) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
Wait(RandomRange(80, 110));
ChooseOption('uickly');
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
end else
if FindObj(OBC.x, OBC.y, 'ank', 10070458, 20) then
begin
Mouse(OBC.x, OBC.y, 0, 0, False);
Wait(RandomRange(80, 110));
ChooseOption('uickly');
FFlag(0);
Wait(2000 + Random(500));
if (Length(Players) > 0) then
if (Players[CurrentPlayer].Pin <> '') then
InPin(Players[CurrentPlayer].Pin);
Result := (BankScreen) or (PinScreen);
end;
ColorToleranceSpeed(Speed);
end;
The following is done by LordSaturn not myself...
scar Code:
// DoorProfiles.scar
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Door Routines --//
//-----------------------------------------------------------------//
// * function IsDropDot(Pt: TPoint): Boolean; // * by lordsaturn
// * function FilterDropDots(P: TPointArray): TPointArray; // * by lordsaturn
// * function GetDoorPoints: T2DPointArray; // * by lordsaturn
// * function GetDoorColors: TIntegerArray; // * by lordsaturn
// * function GetDoorColor: integer; // * by lordsaturn
// * function RearrangeTPA(TPA: TPointArray; sortX, up: Boolean): TPointArray; // * by lordsaturn
// * function MiddleDoor(var P: TPointArray; var s: extended): TPoint; // * by lordsaturn
// * function GetDoors: array of DoorProfile; // * by lordsaturn
// * function GetDoorsIn(x1, y1, x2, y2: integer): array of DoorProfile; // * by lordsaturn
// * procedure SortDoorsFrom(var d: array of DoorProfile; From: TPoint); // * by lordsaturn
type
DoorProfile = record
Points: TPointArray;
MidPoint: TPoint;
PixelCount: Integer;
Slope: Extended;
Color: Integer;
end;
{ 3553023 789758
3553023 2105598 395004 237
789758 395004 237 206
65536 217 188 65536
65536 65536 }
{*******************************************************************************
function IsDropDot(Pt: TPoint): Boolean;
By: lordsaturn
Description: Returns true if a point is in a drop dot.
*******************************************************************************}
function IsDropDot(Pt: TPoint): Boolean;
var
x, y, Col: integer;
begin
Col := GetColor(Pt.x, Pt.y);
if (Col = 206) or (Col = 217) or (Col = 237) then
if FindColor(x, y, Col, MMX1, MMY1, MMX2, MMY2) then
case Col of
206: Result := (GetColor(Pt.x-2, Pt.y) = 395004) or (GetColor(Pt.x-1, Pt.y) = 237);
217: Result := (GetColor(Pt.x, Pt.y-1) = 395004) or (GetColor(Pt.x+1, Pt.y-1) = 237);
237: Result := (((GetColor(Pt.x-1, Pt.y+1) = Col) or (GetColor(Pt.x+1, Pt.y-1) = Col)) and
(GetColor(x, y+2) = 65536)) or ((GetColor(Pt.x-2, Pt.y-1) = 3553023) or
(GetColor(x-1, y-2) = 3553023)) or (GetColor(Pt.x-1, Pt.y) = 395004);
else Exit;
end;
end;
{*******************************************************************************
function FilterDropDots(P: TPointArray): TPointArray;
By: lordsaturn
Description: Returns a TPointArray filtered of drop dots.
*******************************************************************************}
function FilterDropDots(P: TPointArray): TPointArray;
var
i, Hi, L: integer;
begin
Hi := High(P);
if Hi < 0 then Exit;
SetLength(Result, Hi+1);
for i := 0 to Hi do
if (not(IsDropDot(P[i]))) and rs_OnMinimap(P[i].x, P[i].y) and
(InRange(GetColor(P[i].x, P[i].y), 200, 254))then
begin
Result[L] := P[i];
Inc(L);
end;
SetLength(Result, L);
end;
{*******************************************************************************
function GetDoorPoints: T2DPointArray;
By: lordsaturn
Description: Returns all door points on the minimap in a T2DPointArray.
*******************************************************************************}
function GetDoorPoints: T2DPointArray;
var
CTS: integer;
P: TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.0, 0.0);
FindColorsTolerance(P, 227, MMX1, MMY1, MMX2, MMY2, 6);
SetColorspeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
if Length(P) < 1 then Exit;
Result := SplitTPA(FilterDropDots(P), 6);
SortATPAFrom(Result, Point(MMCX, MMCY));
end;
{*******************************************************************************
function GetDoorColors: TIntegerArray;
By: lordsaturn
Description: Returns all door colors on the minimap in an array.
*******************************************************************************}
function GetDoorColors: TIntegerArray;
var
aP: T2DPointArray;
Hi, i, c: integer;
begin
aP := GetDoorPoints;
Hi := High(aP);
if Hi < 0 then Exit;
for i := 0 to Hi do
begin
c := GetColor(aP[i][0].x, aP[i][0].y);
if InIntArray(Result, c) then Continue;
Result := CombineIntArray(Result, [c]);
end;
end;
{*******************************************************************************
function GetDoorColor: integer;
By: lordsaturn
Description: Returns the first door color found from the center of the minimap.
*******************************************************************************}
function GetDoorColor: integer;
var
a: TIntegerArray;
begin
a := GetDoorColors;
if Length(a) < 1 then Exit;
Result := a[0];
end;
{*******************************************************************************
function RearrangeTPA(TPA: TPointArray; sortX, up: Boolean): TPointArray;
By: lordsaturn
Description: Sorts a TPA according to params.
*******************************************************************************}
function RearrangeTPA(TPA: TPointArray; sortX, up: Boolean): TPointArray;
var
i, Hi, j: integer;
ints, indexes: TIntegerArray;
P: TPointArray;
begin
Hi := High(TPA);
SetLength(Result, Hi+1);
if Hi < 1 then
begin
Result := TPA;
Exit;
end;
P := TPA;
SetLength(ints, Hi+1);
SetLength(indexes, Hi+1);
for i := 0 to Hi do
begin
indexes[i] := -1;
if sortX then
ints[i] := P[i].x
else
ints[i] := P[i].y;
end;
QuickSort(ints);
for i := 0 to Hi do
for j := 0 to Hi do
if (sortX and (ints[i] = P[j].x)) or ((not(sortX)) and (ints[i] = P[j].y)) then
if not InIntArray(indexes, j) then
begin
if up then
Result[i] := P[j]
else
Result[Hi-i] := P[j];
Inc(i);
if i > Hi then Exit;
indexes[i] := j;
j := -1;
end;
end;
{*******************************************************************************
function MiddleDoor(var P: TPointArray; var s: extended): TPoint;
By: lordsaturn
Description: Returns the slope and midpoint of a door.
*******************************************************************************}
function MiddleDoor(var P: TPointArray; var s: extended): TPoint;
var
Hi, i, minX, maxX, minY, maxY: integer;
d, tD, PtX, PtY: extended;
begin
Hi := High(P);
if Hi < 0 then Exit;
if Hi = 0 then
begin
Result := P[0];
s := 1;
Exit;
end;
RearrangeTPA(P, True, True);
minX := P[0].x;
maxX := P[Hi].x;
RearrangeTPA(P, False, True);
minY := P[0].y;
maxY := P[Hi].y;
SortTPAFrom(P, Point(minX, minY));
PtX := (minX+maxX)/2;
PtY := (minY+maxY)/2;
for i := 0 to Hi do
begin
tD := Sqrt(Sqr(P[i].x-PtX)+Sqr(P[i].y-PtY));
if (tD < d) or (i = 0) then
begin
Result := P[i];
d := tD;
end;
end;
try
s := (maxY-minY)/(maxX-minX)*-1;
except s := 150; end;
end;
{*******************************************************************************
function GetDoors: array of DoorProfile;
By: lordsaturn
Description: Returns information about the doors on the minimap in an array of
DoorProfile.
*******************************************************************************}
function GetDoors: array of DoorProfile;
var
aP: T2DPointArray;
Hi, i, L, j: integer;
begin
aP := GetDoorPoints;
SortATPAFrom(aP, Point(MMCX, MMCY));
Hi := High(aP);
if Hi < 0 then Exit;
SetLength(Result, Hi+1);
for i := 0 to Hi do
begin
Result[i].Midpoint := MiddleDoor(aP[i], Result[i].Slope);
Result[i].Points := aP[i];
L := Length(aP[i]);
Result[i].PixelCount := L;
for j := 0 to L-1 do
begin
Result[i].Color := GetColor(aP[i][j].x, aP[i][j].y);
if InRange(Result[i].Color, 200, 254) then Break;
end;
if j = L then Result[i].Color := 0;
end;
end;
{*******************************************************************************
function GetDoorsIn(x1, y1, x2, y2: integer): array of DoorProfile;
By: lordsaturn
Description: Returns information about the doors on a portion of the minimap in
an array of DoorProfile.
*******************************************************************************}
function GetDoorsIn(x1, y1, x2, y2: integer): array of DoorProfile;
var
d: array of DoorProfile;
Hi, i, L: integer;
begin
d := GetDoors;
Hi := High(d);
if Hi < 0 then Exit;
SetLength(Result, Hi+1);
for i := 0 to Hi do
if InRange(d[i].MidPoint.x, x1, x2) and InRange(d[i].MidPoint.y, y1, y2) then
begin
Result[L] := d[i];
Inc(L);
end;
SetLength(Result, L);
end;
{*******************************************************************************
procedure SortDoorsFrom(var d: array of DoorProfile; From: TPoint);
By: lordsaturn
Description: Sorts an array of DoorProfile from a TPoint.
*******************************************************************************}
procedure SortDoorsFrom(var d: array of DoorProfile; From: TPoint);
var
P: TPointArray;
clone: array of DoorProfile;
i, j, L: integer;
begin
L := Length(d);
if L < 2 then Exit;
SetLength(clone, L);
clone := d;
SetLength(P, L);
for i := 0 to L-1 do
P[i] := clone[i].Midpoint;
SortTPAFrom(P, From);
for i := 0 to L-1 do
for j := 0 to L-1 do
if (P[i].x = clone[j].Midpoint.x) and (P[i].y = clone[j].Midpoint.y) then
d[i] := clone[j];
end;
scar Code:
// FlagChat.scar
{*******************************************************************************
function IsMoving(WaitTime: Integer): Boolean;
By: Bullzeye95; Edits by Nava2
Description: Checks if the currently loaded player is moving. Uses Minimap,
ignoring all dots which can move without the player moving.
Nava2 edit: Added try..finally, also changed to work with SMART,
as well added WaitTime Parameter.
*******************************************************************************}
function IsMoving(WaitTime: Integer): Boolean;
var
BMP, BMP2, I, H, x, y: Integer;
ReplaceCols: TIntegerArray;
P: TPointArray;
DC: HDC;
begin
WaitTime := Max(100, WaitTime);
try
DC := GetTargetDC;
ReplaceCols:= [65536, 16711422, 12961221, 14869218, 16777215, 15527148, 195836, 56797, 60909, 52428,
13816530, 982782, 1310462, 62965, 2105598, 395004, 789758, 3553023, 217, 188, 241,
206, 233, 64768, 58880, 51456, 49152, 44800, 61440, 16215571, 9716750, 13129742];
BMP:= BitmapFromString(100, 100, '');
BMP2:= BitmapFromString(100, 100, '');
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(BMP), MMCX - 50, MMCY - 50, MMCX + 50, MMCY + 50, 0, 0, 100, 100);
H := High(ReplaceCols);
for I:= 0 to H do
FastReplaceColor(BMP, ReplaceCols[I], 0);
wait(WaitTime);
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(BMP2), MMCX - 50, MMCY - 50, MMCX + 50, MMCY + 50, 0, 0, 100, 100);
SetTargetDC(GetBitmapDC(BMP2));
for I:= 0 to H do
begin
FindColorsTolerance(P, ReplaceCols[I], 0, 0, 99, 99, 0);
for x:= 0 to High(P) do
FastSetPixel(BMP2, P[x].x, P[x].y, FastGetPixel(BMP, P[x].x, P[x].y));
end;
Result:= not FindBitmapIn(BMP, x, y, 0, 0, 100, 100);
finally
SetTargetDC(DC);
FreeBitmap(BMP);
FreeBitmap(BMP2);
end;
end;
{*******************************************************************************
function Flag: Boolean;
By: PPLSUQBAWLZ, Odie533, Nava2, and Bullzeye95
Description: Waits while flag exists.
*******************************************************************************}
function xFlag: Boolean;
var
x, y, TimeOut: Integer;
begin
Result := False;
if (FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) then
begin
Result := True;
TimeOut := GetTimeRunning + 3000;
while IsMoving(200) and (FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) and LoggedIn and (GetTimeRunning < TimeOut) do
begin
if (SRL_Procs[srl_AntiBan] <> nil) then
SRL_Procs[srl_AntiBan]();
Wait(100);
end;
end;
Wait(Random(100));
end;
{*******************************************************************************
Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: If the flag is not present it will click at (ax, ay) increasing by
(xmod, ymod) 5 times or until the flag appears.
*******************************************************************************}
Function xMFF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y, BreakOutTime: Integer;
begin
if (not LoggedIn) then Exit;
if (not (FlagPresent)) then
begin
xx := ax - xmod;
yy := ay - ymod;
MarkTime(BreakOutTime);
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(10);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True
Exit;
end;
Wait(Random(100));
until TimeFromMark(TT) > 3000;
end;
Result := False;
end;
end;
{*******************************************************************************
Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: Like MFF except it will click even if the flag is present when the
function is called.
*******************************************************************************}
Function xMFNF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y: Integer;
begin
Result := False;
if (not LoggedIn) then Exit;
xx := ax - xmod;
yy := ay - ymod;
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(100);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True;
Exit;
end;
Wait(Random(100));
until TimeFromMark(TT) > 3000;
end;
end;
{*******************************************************************************
procedure SetChat(state: String; chat: Integer);
By: Wizzup? modded by WT-Fakawi and Starblaster100
Description: Sets Chat to desired state
*******************************************************************************}
// Shaved a few ms, made it more efficient. Could switch the string case to a Type Const but w/e
// I'm not a fan of this one... =/
type
TChatState = (srl_On, srl_Off, srl_Friends, srl_Hide, srl_None);
procedure xSetChat(ChatState: TChatState; chat: Integer);
var
x, y, mx, TheColor: Integer;
State: String;
begin
case chat of
1: mx := 145;
2: mx := 200;
3: mx := 260;
4: mx := 320;
5: mx := 373;
else
begin
srl_Warn('SetChat', 'chat(' + IntToStr(chat) + ') does not exist.', warn_AllVersions);
Exit;
end;
end;
case ChatState of
srl_On: begin TheColor := 65280; State :='On'; end;
srl_Off: begin TheColor := 255; State :='Off'; end;
srl_Hide: begin TheColor := 16776960; State :='Hide'; end;
srl_Friends: begin TheColor := 65535; State :='Friends'; end;
else srl_Warn('SetChat', state + ' does not exist.', warn_AllVersions);
end;
if not FindColor(x, y, TheColor, mx - 10, 486, mx + 10, 506) then
begin
Mouse(mx, 486, 8, 8, False);
Wait(450 + Random(175));
ChooseOption(State);
end;
end;
{ W/o the Type...
procedure SetChat(state: string; chat: Integer);
var
x, y, mx, Color: Integer;
begin
case chat of
1: mx := 145;
2: mx := 200;
3: mx := 260;
4: mx := 320;
5: mx := 373;
else
begin
srl_Warn('SetChat', 'chat(' + IntToStr(chat) + ') does not exist.', warn_AllVersions);
Exit;
end;
end;
State := LowerCase(State);
case State of
'on': Color := 65280;
'off': Color := 255;
'hide': Color := 16776960;
'friends': Color := 65535;
else srl_Warn('SetChat', state + ' does not exist.', warn_AllVersions);
end;
State := Capitalize(State);
if not FindColor(x, y, Color, mx - 10, 486, mx + 10, 506) then
begin
Mouse(mx, my, 8, 8, False);
Wait(450 + Random(175));
ChooseOption(State);
end;
end;}
procedure xSetAllChats(Pub, Priv, Clan, Trade, Assist: TChatState);
var
States: array of TChatState;
II: Integer;
begin
if (not(LoggedIn)) then Exit;
States := [srl_none, Pub, Priv, Clan, Trade, Assist];
for II := 1 to 5 do
begin
if ((II <> 1) and (States[II] = srl_Hide)) or ((States[II] <> srl_On) and
(States[II] <> srl_Friends) and (States[II] <> srl_Off) and (States[II] <> srl_Hide)) then
begin
srl_Warn('SetAllChats', 'ChatState does not exist for chat ''' + IntToStr(II) + ''' ', warn_AllVersions);
Continue;
end;
SetChat(States[II], II);
end
end;
{*******************************************************************************
procedure ChatsOff;
By: Starblaster100
Description: Sets all Chats to off.
*******************************************************************************}
Procedure xChatsOff;
var
i: Integer;
Begin
For i := 1 to 5 do
SetChat(srl_off, i);
end;
scar Code:
//GameTab.scar
{*******************************************************************************
function GetCurrentTab: Integer;
By: Wizzup?
Description: Returns current tab
*******************************************************************************}
// Removed unecessary integer
function xGetCurrentTab: Integer;
var
b: Boolean;
begin
b := False;
for Result := 1 to 15 do
begin
case Result of
1: b := (GetColor(543, 178) = 1580634);
2: b := (GetColor(570, 179) = 1778795);
3: b := (GetColor(604, 174) = 1910385);
4: b := (GetColor(632, 172) = 1910385);
5: b := (GetColor(666, 182) = 1647204);
6: b := (GetColor(699, 177) = 1910385);
7: b := (GetColor(735, 177) = 1778795);
8: b := (GetColor(569, 471) = 1910385);
9: b := (GetColor(598, 471) = 1910385);
10: b := (GetColor(633, 478) = 1778795);
11: b := (GetColor(668, 476) = 1778795);
12: b := (GetColor(703, 481) = 1580634);
13: b := (GetColor(740, 471) = 1778795);
14: b := (GetColor(555, 275) = 2070783);
15: b := (GetColor(533, 475) = 1581150);
end;
if b then
Exit;
end;
Result := 0;
end;
{*******************************************************************************
function GameTab(tabnumber: Integer): Boolean;
By: Starblaster100
Description: Switches between tabs.
*******************************************************************************}
// changed a lot.. added the case, changed the result loop
function xGameTab(tabnumber: Integer): Boolean;
var
c: Integer;
Coords: TPoint;
begin
if not InRange(TabNumber, 1, 15) then
begin
srl_Warn('GameTab', IntToStr(tabnumber) + ' is no valid GameTab', warn_AllVersions);
Result := False;
Exit;
end;
if not TabExists(tabnumber) then
begin
srl_Warn('GameTab', IntToStr(tabnumber) + ' does not exist', warn_Notice);
Result := False;
Exit;
end;
case TabNumber of
1..7: Coords := Point(540 + ((tabnumber -1) * 33), 185);
14: Coords := Point(752, 12);
15: Coords := Point(538, 485);
else
Coords := Point(540 + ((tabnumber mod 7) * 33), 485);
end;
while not Result and (c < 4) do
Begin
Mouse(Coords.x, Coords.y, 8, 8, true);
Wait(RandomRange(100, 200));
Result := (GetCurrentTab = tabnumber);
Inc(c);
end;
end;
{GameTab 1}
// Narcle Edit by Nava2
// Sets the Combat to the Kind string, will accept any partial of the hovering text.
function SetCombat(Kind : string) : Boolean;
var
x, y, i, ii, T: integer;
Xarr, Yarr: array of integer;
TB: TBox;
TP: TPointArray;
begin
Xarr := [595, 680, 595, 680];
Yarr := [270, 270, 325, 325];
GameTab(1);
for i := 0 to 3 do
begin
MMouse(Xarr[i], Yarr[i], 12, 12);
T := GetSystemTime + 3000;
repeat
Wait(200);
if GetSystemTime > T then
Exit;
until FindColor(x, y, 10551295, 540, 205, 750, 465);
wait(200);
GetClientDimensions(TB.X2, TB.Y2);
TB := IntToBox(0, 0, TB.X2, TB.Y2);
FindColorsTolerance(TP, 10551295, TB.X1, TB.Y1, TB.X2, TB.Y2, 0);
if Length(TP) = 0 then
Exit;
TB := GetTPABounds(TP);
TB.Y1 := TB.Y1 + 1;
for ii := 0 to 3 do
begin
Result := Pos(Kind, LowerCase(GetTextAtEx(TB.X1 + 1, TB.Y1, 0, SmallChars, False, True, 0, 1, - 1, 30, False, tr_AlphaNumericChars))) <> 0;
if Result then
begin
Result := SetFightMode(I + 1);
Exit;
end;
TB.Y1 := TB.Y1 + 13;
end;
end;
end;
{*******************************************************************************
function GetCombatLevel: Integer;
By: Nielsie95
Description: Returns the players combat level. Returns -1 if failed.
*******************************************************************************}
// changed to IntToStrDef, removing the need for the Try..Except..End nest.
function xGetCombatLevel: Integer;
var
x, y: Integer;
begin
Gametab(1);
Wait(100 + Random(100));
if IsTextInAreaEx(590, 225, 690, 245, x, y, 'Combat', 0, StatChars, False,
False, 0, 2, 2070783) then
Result := StrToIntDef(Trim(GetTextAtEx(x, y, 0, StatChars, False, False, 0,
2, 2070783, 20, True, tr_Digits)), -1);
end;
{GameTab 5}
// Next 2 are good, you decide whether good enough
function GetEquippedItemBounds(Which : String) : TBox;
var
P : TPoint;
I : Byte;
begin
case Lowercase(Which) of
'1', 'helm', 'helmet' :
I := 1;
'2', 'cape' :
I := 2;
'3', 'amulet', 'neck', 'necklace' :
I := 3;
'4', 'arrows', 'bolts' :
I := 4;
'5', 'right hand', 'weapon' :
I := 5;
'6', 'plate', 'chest', 'platebody' :
I := 6;
'7', 'left hand', 'sheild' :
I := 7;
'8', 'legs', 'platelegs', 'skirt', 'plateskirt' :
I := 8;
'9', 'gloves', 'gauntlets' :
I := 9;
'10', 'ring' :
I := 10;
else
begin
SRL_Warn('GetEquiptItemBounds', 'Invalid entry.', Warn_AllVersions);
Result := IntToBox(0, 0, 0, 0);
Exit;
end;
end;
P := EquipmentCoords(I);
Result := IntToBox(P.x - 11, P.y - 11, P.x + 11, P.y + 11);
end;
procedure MouseEquippedItem(Which : String; Left : Integer);
var
B : TBox;
begin
B := GetEquippedItemBounds(Which);
if (B.x1 = 0) and (B.x2 = 0) then Exit;
GameTab(5);
MouseBox(B.x1, B.y1, B.x2 - B.x1 + 1, B.y2 - B.y1 + 1, Left);
end;
{*******************************************************************************
function CheckEquipItems(number: Integer): Boolean;
By: SDcit
Description: Sees if there are number items equiped and returns true if yes.
*******************************************************************************}
// Modded a few things...
function xCheckEquipItems(number: Integer): Boolean;
var
CheckCoords: Integer;
x: integer;
begin
x := 0;
for CheckCoords := 1 to 11 do
begin
if WearingItem(CheckCoords) then
Inc(x);
end;
Result := x > number;
if not Result then
SRL_Warn('CheckEquipItems', 'You have more than ' + IntToStr(number) +' items equiped. Currently have '
+ IntToStr(x) + ' equipped.', Warn_AllVersions);
end;
{GameTab 8}
{*******************************************************************************
function CurrentWorld: Integer;
By: Cheesehunk, Ron and fixed by ZephyrsFury
Description: Returns the current world you are on.
*******************************************************************************}
// changed to SRL_Warn, and removed unecessary GetCurrentTab
function xCurrentWorld: Integer;
var
TextX, TextY: Integer;
begin
Result := -1;
GameTab(8);
Wait(RandomRange(50, 100));
if (IsTextInAreaEx(635, 205, 727, 226, TextX, TextY, 'RuneSca', 0, SmallChars, False, False, 0, 0, -1)) then
Result := StrToIntDef(Trim(GetTextAtEx(TextX + 65, TextY, 0, SmallChars, True,
False, 0, 0, -1, 3, False, tr_AllChars)), -1);
if (Result = -1) then
SRL_Warn('CurrentWorld', 'Could not get Current World.', Warn_AllVersions);
end;
scar Code:
// Globals.scar
//Typo
{*******************************************************************************
procedure FreeSRLBitMaps;
By: Ron
Description: Frees SRL Bitmaps from memory.
*******************************************************************************}
scar Code:
// Inventory.scar
{*******************************************************************************
Function InvBox(i :Integer): TBox;
By: WT-Fakawi/Wizzup?
Description: Returns TBox of surrounding Inventory SlotBox
1-2-3-4
5-6-7-8
etc.
*******************************************************************************}
// InRange
Function xInvBox(i :Integer): TBox;
var
row, col: Integer;
begin
if not InRange(I, 1, 28) then
begin
srl_Warn('InvBox', 'Incorrect index: ' + IntToStr(i), warn_AllVersions);
exit;
end;
row :=i mod 4; if row = 0 then row := 4;
col := i / 4 ; if i mod 4 <> 0 then Inc(col);
Result.x1 := 518 + (row * 42); // First X coord - 42 - 5 for proper Tbox
Result.y1 := 172 + (col * 36); // First Y coord - 36 - 5 for proper Tbox
Result.x2 := 560 + (row * 42);
Result.y2 := 210 + (col * 36);
end;
{*******************************************************************************
Function CoordsToItem(x,y : integer) : Integer;
By: Raymond
Description: Returns the invetory spot at x and y.
If x or y are incorrect it returns 0.
*******************************************************************************}
// InRange
Function xCoordsToItem(x,y : integer) : Integer;
var
TP : TPoint;
begin;
result := 0;
if not (InRange(x, MIX1, MIX2) and InRange(y, MIY1, MIY2)) then
begin
srl_Warn('CoordsToItem', 'Point not in Inventory', warn_AllVersions);
Exit;
end;
TP.x := x - 560;
TP.y := y - 208;
Result := TP.x div 42 + 1;
Result := Result + (TP.y div 36) * 4;
end;
{*******************************************************************************
Function InvCount: Integer;
By: RsN
Description: Returns amount of items in your inventory
*******************************************************************************}
//Inc
function xInvCount: Integer;
var
i: Integer;
begin
GameTab(4);
Result := 0;
for i := 1 to 28 do
if (ExistsItem(i)) then
Inc(Result);
end;
{*******************************************************************************
function InvFull: Boolean;
By: n3ss3s
Description: Returns True if inventory is full
*******************************************************************************}
// Removed GameTab, unneeded
Function xInvFull: Boolean;
Begin
Result := InvCount = 28;
End;
// Is this not the same as...
{*******************************************************************************
function CountItems(identifier: Integer; identifiertype: string; tol: TIntegerArray): Integer;
By: WT-Fakawi / Sumilion
Description: Performs a count of inventory items by "identifier" with tol[0]
as color tolerance, tol[1] as contour tolerance in case of bmp masks. Valid identifiertypes are :
bmp, mask, color, dtm.
*******************************************************************************}
// This:
{*******************************************************************************
function ItemCoordinates(Area, ItemType: string; Item, Tol: TIntegerArray): TPointArray;
By: masquerader modified by ZephyrsFury
Description: Returns a TPA with the positions of all occurances of Item.
Parameters:
Area - 'inv', 'shop', 'bank', 'trade', 'your trade'.
ItemType - DTM, Color, BitmapMask, Bitmap
Item - name/value of your dtm/bmp/color/bmpmask.
Tol - DTM - [] (dtm's can't have tolerance).
Bitmap - [BMPTol].
Color - [COLOUR Tol].
BitmapMask - [BMPTol, ContourTol].
*******************************************************************************}
// so...
function xCountItems(ItemType: SRL_Item; Identifier: Integer; Tol: TIntegerArray): Integer;
begin
Result := CountItemsIn('inv', ItemType, Identifier, Tol);
end;
{*******************************************************************************
function ClickAllItems(identifier: Integer; identifiertype, option: string; waitnum: Integer; tol: TIntegerArray):Integer;
By: WT-Fakawi / Sumilion
Description: Performs "option" popupmenu action on all items
with "identifier" and "tol[0]" as color tolerance and col[1]
as contour tolerance in case bmp masks are used in inventory. (e.g. 'store all')
Returns number of performed operations. Valid identifiertypes are :
bmp, mask, color, dtm.
*******************************************************************************}
// Implemented FindItem, changed quite a bit..
function xClickAllItems(ItemType: SRL_Item; Identifier: Integer; Option: string; waitnum: Integer; tol: TIntegerArray):Integer;
var
i, x, y: Integer;
TB: Tbox;
arr:array of Integer;
begin
Result := 0;
arr :=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
18,19,20,21,22,23,24,25,26,27,28];
for i := 1 to 28 - 4 do
Swap(arr[RandomRange(i - 1, i + 4)], arr[RandomRange(i - 1, i + 4)] );
SetLength(Tol, 2);
GameTab(4);
for i := 0 to 27 do
begin
TB := InvBox(arr[i]);
if ExistsItem(arr[i]) then
try
if not FindItemEx(x, y, Identifier, ItemType, TB, Tol) then Continue;
if Option <> '' then
begin
MouseItem(arr[i], False);
Wait(waitnum);
ChooseOption(option);
Inc(Result);
end
else
MouseItem(arr[i], True);
Wait(waitnum);
except end;
end;
end;
{*******************************************************************************
Function CountItemsBlackLine(Count, Tol: Integer): Integer;
By: n3ss3s
Description: Returns the number of items in inventory with Count amount of
blackline points and Tol tolerance in the amount of points.
*******************************************************************************}
// High in array changed
Function xCountItemsBlackLine(Count, Tol: Integer): Integer;
Var
TPA: TPointArray;
I, H: Integer;
TPAA: T2DPointArray;
Begin
GameTab(2);
FindColorsTolerance(TPA, 65536, MIX1, MIY1, MIX2, MIY2, 0);
TPAA := TPAToATPAEx(TPA, 42, 36);
H := High(TPAA);
For I := 0 To H Do
If InRange(Length(TPAA[i]), Count - Tol, Count + Tol) Then
Inc(Result);
End;
{*******************************************************************************
Function ClickAllItemsBlackLine(Count, Tol: Integer; Option: String): Integer;
By: n3ss3s
Description: Finds all items in inventory with blackline points amount of Count
with Tol tolerance, and returns the amount of items could choose the
option Option to. Waits the WaitT amount of millisecs between items, with
WaitR randomness of milliseconds.
*******************************************************************************}
// High in array changed, Inc
Function xClickAllItemsBlackLine(Count, Tol, WaitT, WaitR: Integer; Option: String): Integer;
Var
TPA: TPointArray;
X, Y, Z, H: Integer;
TPAA: T2DPointArray;
Begin
GameTab(2);
FindColorsTolerance(TPA, 65536, MIX1, MIY1, MIX2, MIY2, 0);
TPAA := TPAToATPAEx(TPA, 42, 36);
H := High(TPAA);
For z := 0 To H Do
If InRange(Length(TPAA[z]), Count - Tol, Count + Tol) Then
Begin
MiddleTPAEx(TPAA[z], X, Y);
Mouse(X, Y, 2, 2, False);
If ChooseOption(Option) Then
Begin
Inc(Result);
Wait(WaitT + Random(WaitR));
End;
End;
End;
scar Code:
// Not mine, might be RMagicians? (Next 2)
Procedure xLoginPlayerEx(PVP: Boolean);
var
Mark, Attempts, t, x, y: Integer;
Actions: TVariantArray;
RetryLogin: Boolean;
label
ProcStart;
begin
ActivateClient;
Wait(100);
TypeByte(vk_Escape);
if (GetColor(212, 327) = 238301) then
begin
Wait(1000 + Random(3000));
MouseBox(227, 337, 555, 364, 1);
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end;
if (not(RSReady)) then
begin
MarkTime(Mark);
while (not(RSReady)) do
begin
Wait(100);
if (TimeFromMark(Mark) > 180000) then
begin
WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
TerminateScript;
end;
end;
WriteLn('Welcome to Runescape.');
end;
LoginScreenMusic(True);
if (not(GraphicsSet)) then
begin
SetAutoingDefaults;
GraphicsSet := True;
end;
ProcStart:
if (not(LoggedIn)) then
begin
if (not(Players[CurrentPlayer].Active)) then
begin
WriteLn('Player is not Active...');
NextPlayer(False);
Exit;
end;
Wait(900 + Random(60));
while (GetColor(343, 175) <> 7750) do
begin
MouseBox(360, 180, 400, 185, 1);
Wait(100 + Random(100));
end;
Mouse(315, 272, 10, 5, True);
while (CountColor(7750, 311, 269, 452, 284) > 13) do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
for Mark := 0 to 3 do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
Wait(100 + Random(50));
Mouse(315, 334, 10, 5, True);
while (CountColor(7750, 311, 337, 452, 352) > 13) do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
for Mark := 0 to 3 do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
TypeSend(Players[CurrentPlayer].Pass);
Wait(500 + Random(300));
if (not(FindTextTPA(12509695, 0, 288, 205, 475, 247, 'login', StatChars, Nothing))) then
begin
MouseBox(355, 359, 403, 372, 1);
Wait(250 + Random(100));
end;
If PVP then
begin
MarkTime(t);
Repeat
Wait(100+random(50));
If FindColor(x, y, 197552, 0, 0, 700, 700) then
Break;
Until(TimeFromMark(t) >= 30000);
Mouse(435, 420, 45, 10, true);
Wait(3000 + Random(3500));
end;
MarkTime(Mark);
repeat
SetLength(Actions, 0);
if (TimeFromMark(Mark) > 60000) then
Actions := ['One minute has passed...', 0, 2, 'NextPlayer', 'Login Failed']
else
case (CountColor(12509695, 288, 205, 475, 247)) of //Number of text colour points
// Actions := ['WriteLn Text', TimeToWait, NumberOfRetries, 'FinalAction', 'PlayerStatus'];
760: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
711: Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
598: Actions := ['Invalid Username / Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
787: Actions := ['Not a Members Account', 0, 0, 'NextPlayer', 'Non-member'];
408: Actions := ['World is full.', 5000, 20, 'Terminate', ''];
623: Actions := ['Your account is already logged in', 5000, 0, 'RandomNextPlayer', ''];
555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
737: Actions := ['You are standing in a members-only area.', 0, 0, 'NextPlayer', 'In Mems-Only Area'];
//10: Actions := ['Error loading your profile.', 5000, 10, 'NextPlayer', 'Profile Loading Failed']; // Error loading your profile. Will attempt to re-login 5 more times.)
//11: Actions := ['Login server rejected session.', 1000, 10, 'NextPlayer', 'Login Serv. Rejected']; // Login server rejected session.
end;
if (Length(Actions) > 0) then
begin
WriteLn(Actions[0]);
Wait(Actions[1] + Random(100));
if (Actions[2] <> 0) then
if (Attempts < Actions[2]) or (Actions[2] = -1) then
begin
RetryLogin := True;
Break;
end;
if (Actions[4] <> '') then
Players[CurrentPlayer].Loc := Actions[4];
case Actions[3] of
'NextPlayer': NextPlayer(False);
'RandomNextPlayer': RandomNextPlayer(True);
'Terminate': TerminateScript;
end;
Exit;
end;
Wait(100);
until(GetColor(212, 327) = 238301);
if (RetryLogin) then
begin
RetryLogin := False;
Inc(Attempts);
goto ProcStart;
end;
if (GetColor(212, 327) = 238301) then
begin
Wait(1000 + Random(2000));
MouseBox(227, 337, 555, 364, 1);
end;
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end;
if (LoggedIn) then
begin
PlayerStartTime := (GetSystemTime div 1000);
if Length(Players[CurrentPlayer].NickTPA) < 2 then
begin;
WriteLn('Creating the NickTPA.');
if Players[CurrentPlayer].Nick <> '' then
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Nick, UpChars)
else
begin;
WriteLn('Nickname isn''t set, taking the username instead..');
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Name, UpChars);
end;
end;
AddToSRLLog('Current player: ' + Capitalize(Players[CurrentPlayer].Name));
end;
end;
{*******************************************************************************
procedure LoginPlayer;
By: SRL Developers
Description: Logs in the Player[CurrentPlayer]. Detects most Client Login Errors
*******************************************************************************}
procedure xLoginPlayer;
begin
LoginPlayerEx(False);
end;
//END OF NOT MINE
{*******************************************************************************
procedure CheckUserNicks;
By: Sumilion / Raymond Edit by Nava2
Description: Checks if all nicks are set correct.
*******************************************************************************}
// Shortened and Restructured... A lot..
procedure xCheckUserNicks;
var
CorrectString: string;
I, II: Integer;
Wrong : Boolean;
Strs : TStringArray;
begin
Strs := ['Please fill in your nickname.', 'Please Uncapitalise your nickname.',
'Dont use the first letter in your nick.', 'Dont use spaces in your Nick.',
'Nick does NOT match the name.'];
for i := 0 to HowManyPlayers - 1 do
begin
if (not(Players[i].Active)) then Continue;
Wrong := False;
CorrectString := Capitalize(Players[i].Name);
for II := 0 to 4 do
begin
case II of
0: Wrong := Players[i].Nick = '';
1: Wrong := Players[i].Nick <> LowerCase(Players[i].Nick);
2: Wrong := Pos(Players[i].Nick, LowerCase(Players[i].Name)) = 1;
3: Wrong := Pos(' ', Players[i].Nick) > 0;
4: Wrong := not (Pos(LowerCase(Players[i].Nick), CorrectString) > 0);
end;
if Wrong then
begin
Writeln('--');
Writeln('Error: ' + Strs[II]);
if (Length(Players[i].Name) > 0) then
Writeln('Warning occured with player : ' + Players[i].Name);
//Writeln('For more information, visit [url]http://www.srl-forums.com/forum/set-up-your-t6267.html');[/url] // Maybe lookfor new site?
end;
end;
end;
end;
scar Code:
// MapWalk.scar
{*******************************************************************************
procedure StoreToRoadColorArray;
By: Wizzup? / WT-Fakawi.
Description: Stores RoadColor to Array. Debugging and logging purposes.
*******************************************************************************}
// got rid of uneeded nest
procedure xStoreToRoadColorArray;
var
I: Integer;
begin
for I := 1 to 256 do
if RoadColor = RoadColors[I] then
Exit
else
if RoadColors[I] = 0 then
begin
RoadColors[I] := RoadColor;
Exit;
end;
end;
{*******************************************************************************
function GetOldRoadColors: Boolean;
By: Wizzup? / WT-Fakawi.
Description: Tries to find the stored Roadcolor on the minimap and sets RoadColor.
*******************************************************************************}
// unneeeded nests
function xGetOldRoadColors: Boolean;
var
EC, FX, FY: Integer;
begin
Result := False;
for EC := 1 to 256 do
if RoadColors[EC] <> 0 then
if FindColorTolerance(FX, FY, RoadColors[EC], MMX1, MMY1, MMX2, MMY2, 10) then
begin
RoadColor := RoadColors[EC];
Result := True;
Exit;
end;
end;
{*******************************************************************************
procedure SetAngle(Highest : Boolean);
By: Raymond
Description: Sets the mainscreen at highest\lowest angle (Depends on the boolean)
*******************************************************************************}
// Changed last wait...
procedure xSetAngle(Highest : Boolean);
var
Key : Byte;
begin;
if Highest then
Key := 38
else
Key := 40;
if (LoggedIn) then
begin
KeyDown(Key);
Sleep(1000 + Random(100) + Random(200));
KeyUp(Key);
Wait(500 + Random(100));
end;
end;
// Broken, look for one on the forums...
{*******************************************************************************
function PlayersOnMap(xx1, yy1, xx2, yy2 : integer) : integer;
By: footballjds
Description: Counts the players on the minimap, not including your own player.
*******************************************************************************}
scar Code:
// Objects.scar
{*******************************************************************************
function FindAllObjsRecord(var Objects: TPointArray; AutoInfo: TAutoColorInfo; x1, y1, x2, y2: Integer; QuickSorting, RGBXYZCheck: Boolean): Boolean;
By: Sumilion
Description: Finds an Object using a TAutoColorInfo record, returns the center of the found objects.
*******************************************************************************}
// Already committed, thanks to zeph.
scar Code:
// Players.scar
{*******************************************************************************
procedure NumberOfPlayers(Number: Integer);
By: BenLand100 / Wizzup?
Description: Makes the Players array have Number indexes, also sets strings and
other player array's too standard 100.
*******************************************************************************}
//Changed Length in loop
procedure xNumberOfPlayers(Number: Integer);
var
I: Integer;
begin
SetLength(Players, Number);
HowManyPlayers := Number;
for I := 0 to HowManyPlayers - 1 do
begin
SetLength(Players[i].Strings, 100);
SetLength(Players[i].Integers, 100);
SetLength(Players[i].Booleans, 100);
SetLength(Players[i].Extendeds, 100);
end;
end;
{*******************************************************************************
function RC: Boolean;
by: WT-Fakawi
Description: High Level Remote Control Command. Handles Remote Control.
Works as follows:
Checks for existence of red color in chat window.
If red color is found, it checks for the existence of the MasterBitMapMask.
If found it waits 60 seconds for pm "status" or pm "reset".
Then RC sleeps five minutes to get rid of the red text.
*******************************************************************************}
// removed extra SetChats
function xRC: Boolean;
var
Masx, Masy, RCMark: Integer;
begin
if (Trim(RCMaster) = '') then Exit;
if RCPrivateMessageColorFound then // check for Color 128
begin
RunControl(False);
Result := True;
if TimeFromMark(RCTimeMark) > 300000 then // check once every five minutes
begin
MasterBitMapMask := CreateBitmapMaskFromText(RCMaster, smallChars);
MarkTime(RCTimeMark);
SetChat(SRL_Off, 1);
if RCFindMaster(Masx, Masy, MCX1, MCY1, MCX2, MCY2) then
// check for MasterBitMapMask
begin
MarkTime(RCMark);
GameTab(8);
if RCHowManyOnline <> 0 then
begin
RCFindMaster(Masx, Masy, MIX1, MIY1, MIX2, MIY2);
Mouse(Masx + 2, Masy + 2, 10, 0, True);
TypeSend('hi');
repeat // wait 60 secs for command
if RCReadCommand = RCStatus then
begin
Wait(1000 + Random(500));
RCFindMaster(Masx, Masy, MIX1, MIY1, MIX2, MIY2);
Mouse(Masx + 2, Masy + 2, 10, 0, True);
TypeSend(RCReturnStatus);
SetChat(SRL_On, 1);
FreeBitmap(MasterBitMapMask);
Exit;
end;
if RCReadCommand = RCReset then
begin
GameTab(8);
Wait(1000 + Random(500));
RCResetStatus;
RCFindMaster(Masx, Masy, MIX1, MIY1, MIX2, MIY2);
Mouse(Masx + 2, Masy + 2, 10, 0, True);
TypeSend('reset');
SetChat(SRL_On, 1);
FreeBitmap(MasterBitMapMask);
Exit;
end;
if RCReadCommand = RCLogout then
begin
Logout;
FreeBitmap(MasterBitMapMask);
Exit;
end;
if RCReadCommand = RCStop then
begin
TerminateScript;
end;
Wait(1000);
until (TimeFromMark(RCMark) > 20000);
end;
end;
SetChat(SRL_On, 1);
FreeBitmap(MasterBitMapMask);
end;
end;
end;
scar Code:
// Symbols.scar
function xGetSymbolColorIn(var rx, ry: Integer; Name: string; xs, ys, xe, ye: Integer): Integer;
var
TheColor, c, Speed, x, y: Integer;
acc: Extended;
begin
Speed := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
TheColor := LoadSymbolBitmapColor(LowerCase(Name));
if (SymbolBitmap <> 0) and (TheColor <> 0) then
begin
FindDeformedBitmapToleranceIn(SymbolBitmap, x, y, xs, ys, xe, ye, 70, 0, True, acc);
if (acc > SymbolAccuracy) then
begin
repeat
c := c + 5;
if (FindColorTolerance(x, y, TheColor, x, y, x + 15, y + 5, c)) then
begin
Result := GetColor(x, y);
rx := x;
ry := y;
end;
until (Result > 0) or (c > 70);
end;
end else
srl_Warn('GetSymbolColorIn', Name + ' is not a valid name.', warn_AllVersions);
try
FreeBitmap(SymbolBitmap);
finally
ColorToleranceSpeed(Speed);
except
Result := 0;
end;
end;
{*******************************************************************************
procedure FindSymbolsMulti(var aTPA: TPointArray; Symbols: TStringArray);
By: Nava2
Description: Finds multiple symbols in multiple places.
*******************************************************************************}
procedure xFindSymbolsMulti(var aTPA: TPointArray; Symbols: TStringArray);
var
gTPA: TPointArray;
I, H: Integer;
begin
H := High(Symbols);
for I := 0 to H do
begin
FindSymbols(gTPA, Symbols[I]);
aTPA := CombineTPA(gTPA, aTPA);
end;
end;
scar Code:
// Text.scar
{*******************************************************************************
procedure TypeSend(Text: string);
By: SKy Scripter
Description: Sends human like text.
*******************************************************************************}
// Length in for loop
procedure xTypeSend(Text: string);
var
S: string;
I, L: Integer;
C: Byte;
Shift: Boolean;
begin
S:= 'ABCDEFGHIJKLMNOPQRSTUVWXZ' + '~!@#$%^&*()_+{}|:"<>?';
L := Length(Text);
for I:= 1 to L do
begin
Shift:= (Pos(Text[i], S) > 0);
if(Shift)then
begin
KeyDown(VK_SHIFT) Wait(40 + Random(40));
while(Pos(Text[i], S) > 0)and(I <= Length(Text))do
begin
C := GetKeyCode(StrGet(Text, I));
TypeByte(c);
I:= I + 1;
if(I > Length(Text))then Break;
end;
end;
if(Shift)then
KeyUp(VK_SHIFT);
Wait(40 + Random(40));
if(I <= Length(Text))then
begin
C:= GetKeyCode(StrGet(Text, I));
TypeByte(C);
Wait(40 + Random(40));
end;
end;
C := GetKeyCode(Chr(13));
TypeByte(C);
end;
{*******************************************************************************
function AddMistakes(Orig: string; Chance: Integer): string;
By: ZephyrsFury
Description: Adds human mistakes to Orig such as mistypes, missing letters,
wrong cases. For a human-like chance of making a mistake make Chance 10 - 30.
Smaller values of Chance = More mistakes.
Use: TypeSend(AddMistakes('Hello', 20));
*******************************************************************************}
// Silly little things, length in loop extra nest
function xAddMistakes(Orig: string; Chance: Integer): string;
var
Line1, Line2, Line: array [0..3] of string;
i, j, TPos, Prob, Mist, L: Integer;
Norm, Caps, Excp, TLine, NewKey: string;
begin
Norm := '`1234567890-=qwertyuiop[]\asdfghjkl;''zxcvbnm,./';
Caps := '~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?';
Excp := '`1234567890-=[]\;'',./~!@#$%^&*()_+{}|:"<>?';
Line1[0] := '`1234567890-= '; Line2[0] := '~!@#$%^&*()_+ ';
Line1[1] := ' qwertyuiop[]\'; Line2[1] := ' QWERTYUIOP{}|';
Line1[2] := ' asdfghjkl;'' '; Line2[2] := ' ASDFGHJKL:" ';
Line1[3] := ' zxcvbnm,./ '; Line2[3] := ' ZXCVBNM<>? ';
L := Length(Orig);
for i := 1 to L do
begin
Prob := Chance + Mist; //More mistakes = less chance of another mistake
if (Pos(Orig[i], Excp) <> 0) then Prob := Chance - 2; //If char is hard to type (numbers/symbols) - more chance
if (i = 1) then Prob := Chance + 5; //The first letter - less chance
if (Orig[i] <> ' ') and (Random(Prob) = 0) and (Prob >= 0) then
begin
if (Pos(Orig[i], Norm) <> 0) then
Line := Line1
else
if (Pos(Orig[i], Caps) <> 0) then
Line := Line2;
for j := 0 to 3 do
begin
TPos := Pos(Orig[i], Line[j]);
if (TPos <> 0) then
case Random(19) of
0..5: //Same line
begin
TLine := Line[j];
try
NewKey := TLine[TPos - 1 + Random(3)];
except end;
if (NewKey = '') or (NewKey = ' ') then
NewKey := TLine[TPos];
end;
6..8: //Line above
begin
try
TLine := Line[j - 1]
except TLine := Line[j]; end;
try
NewKey := Line[j - 1][TPos + Random(2)];
except end;
if (NewKey = '') or (NewKey = ' ') then
NewKey := TLine[TPos];
end;
9..11: //Line below
begin
try
TLine := Line[j + 1]
except TLine := Line[j]; end;
try
NewKey := TLine[TPos - 1 + Random(2)]; //Wrong case
except end;
if (NewKey = '') or (NewKey = ' ') then
NewKey := TLine[TPos];
end;
12..16:
begin
if (i - 1 >= 1) then
begin
if (Pos(Orig[i - 1], Caps) <> 0) then
NewKey := Line2[j][TPos]
else
if (Pos(Orig[i - 1], Norm) <> 0) then
NewKey := Line1[j][TPos]
end else
if (i + 1 <= Length(Orig)) then
begin
if (Pos(Orig[i + 1], Caps) <> 0) then
NewKey := Line2[j][TPos]
else
if (Pos(Orig[i + 1], Norm) <> 0) then
NewKey := Line1[j][TPos];
end;
end;
17, 18: if (i <> 1) then NewKey := ''; //Missing letters
end;
end;
end else
NewKey := Orig[i];
if (NewKey <> Orig[i]) then Inc(Mist);
Result := Result + NewKey;
end;
end;
{*******************************************************************************
function IsUpTextMultiCustom(Text: TStringArray): Boolean;
By: Starblaster100 / Nielsie95 / Freddy1990
Description: Checks for the occurance of any of the strings in the array.
Use: IsUpTextMultiCustom(['Att', 'ttac', 'ack', 'monst', 'ster'])
*******************************************************************************}
// Length in loop
function xIsUpTextMultiCustom(Text: TStringArray): Boolean;
var
TheText: string;
i, n: Integer;
begin
TheText := rs_GetUpText;
n := High(Text);
for i := 0 to n do
if (Pos(Text[i], TheText) <> 0) then
begin
Result := True;
Exit;
end;
end;
{*******************************************************************************
Function InStrArrEx(S: String; StrArr: TStringArray; Var Where: Integer): Boolean;
By: n3ss3s
Description: Returns true if the string S was found in the StrArr, and if so
stores the index into Where.
*******************************************************************************}
// High in loop...
Function xInStrArrEx(S: String; StrArr: TStringArray; Var Where: Integer): Boolean;
Var
I, H: Integer;
Begin
H := High(StrArr);
For I := 0 To H Do
If LowerCase(StrArr[i]) = LowerCase(S) Then
Begin
Where := i;
Result := True;
Break;
End;
End;
Questions? Post. Suggestions? Post.