SCAR Code:
//////////////////////////////////////////////////////////////////////////
////////////////////////////ALL BY BULLZEYE95!////////////////////////////
//////////////////////////////////////////////////////////////////////////
{
Procedure WaitB(lowest: Integer; highest: Integer);
Function ModFound: Boolean;
Function IsUpTextMultiArr(text: array of string): Boolean;
Function IsMouseIn(x1, y1, x2, y2: Integer): Boolean;
Procedure DropAllRan;
Function GetDate(getTime, displayWords, militaryTime: Boolean): String;
Procedure TargetRS;
Function Reverse(Text: String): String;
Function IsPrime(Num: Integer): Boolean;
Function IsComposite(Num: Integer): Boolean;
Function RandomCase(Text: String): String;
Function GetNumbers(Text: String): String;
Function GetLetters(Text: String): String;
Function ReArrange(Text: String): String;
Function TrimAllSpaces(Text: String): String;
Function DeleteAll(Str, Del: String): String;
Function Average(Num: Array of Integer): Integer;
Function StrContains(Find, InString: String): Boolean;
Function BitmapFromColor(Width, Height, Color: Integer): Integer;
Function GetTradeAmount(TradePos: Integer; Side: String): Integer;
Function Range(Num1, Num2: Integer): Integer;
Function MixColors(col1, col2: Integer): Integer;
Function Place(I: Integer): String;
Function FindColorRightTol2(var cx, cy: Integer; Color, x1, y1, x2, y2, Tolerance: Integer): Boolean;
}
{*******************************************************************************
Procedure WaitB(lowest, highest: Integer);
By: Bullzeye95
Description: Waits a time between "lowest" and "highest".
*******************************************************************************}
procedure waitB(lowest, highest: Integer);
var
waitTime: Integer;
begin
if(lowest >= highest)then
begin
writeln('Lowest number is greater than or equal to your highest.');
exit;
end;
repeat
WaitTime:= random(highest);
until(not(waitTime<= lowest))
wait(waittime);
end;
{*******************************************************************************
Function ModFound: boolean;
By: Bullzeye95
Description: Returns true if a mod is present.
*******************************************************************************}
function ModFound: boolean;
var
tx, ty: Integer;
begin
if (not (GetColor(20, 434) = 0)) then Exit;
Wait(100);
if (BmpMod = 0) or (BmpAdmin = 0) then
LoadSRLBitMaps;
if (FindBitmapToleranceIn(bmpMod, tx, ty, 1, 345, 110, 430, 15)) or
(FindBitmapToleranceIn(bmpAdmin, tx, ty, 1, 345, 110, 430, 15)) then
begin
Result := True;
end;
end;
{*******************************************************************************
Function IsUpTextMultiArr(text: array of string): Boolean;
By: Bullzeye95
Description: This is like IsUpTextMulti, but you can have however many
different strings to check for as you want.
REMEMBER: Use like if(MyIsUpTextMulti(['hi', 'hi', 'hi', 'hi']))then
*******************************************************************************}
function IsUpTextMultiArr(text: array of string): boolean;
var
tempx, tempy, I: Integer;
begin
for I := 0 to getarraylength(text)-1 do
begin
if IsTextInAreaEx(7, 7, 334, 20, tempx, tempy, text[i], 100, UpChars, True, True, 0, 2, -1)then
Result := True;
end;
end;
{*******************************************************************************
Function IsMouseIn(x1, y1, x2, y2: Integer): Boolean;
By: Bullzeye95
Description: This checks if your mouse is in a defined box.
*******************************************************************************}
function IsMouseIn(x1, y1, x2, y2: integer) : Boolean;
begin
getmousepos(x, y);
if(x >= x1) and (x <= x2) and (y >= y1) and (y <= y2)then
Result:= true;
end;
{*******************************************************************************
Procedure DropAllRan;
By: Bullzeye95
Description: This chooses a random drop procedure each time. There are
currently three different ones it can choose from.
*******************************************************************************}
procedure DropAllRan;
begin
case Random(3) of
0: begin
dropall;
end;
1: begin
DropTo(1, 4);
DropInvPosition(8);
DropInvPosition(12);
DropInvPosition(16);
DropInvPosition(20);
DropInvPosition(24);
DropInvPosition(28);
DropInvPosition(27);
DropInvPosition(26);
DropInvPosition(25);
DropInvPosition(21);
DropInvPosition(17);
DropInvPosition(13);
DropInvPosition(9);
DropTo(5, 7);
DropInvPosition(11);
DropInvPosition(15);
DropInvPosition(19);
DropInvPosition(23);
DropInvPosition(22);
DropInvPosition(18);
DropInvPosition(14);
DropInvPosition(10);
end;
2: begin
dropto(1, 4);
DropInvPosition(8);
DropInvPosition(7);
DropInvPosition(6);
DropInvPosition(5);
dropto(9, 12);
DropInvPosition(16);
DropInvPosition(15);
DropInvPosition(14);
DropInvPosition(13);
dropto(17, 20);
DropInvPosition(24);
DropInvPosition(23);
DropInvPosition(22);
DropInvPosition(21);
dropto(23, 28);
end;
end;
end;
{*******************************************************************************
Function GetDate(getTime, displayWords, militaryTime: Boolean): String;
By: Bullzeye95
Description: This function returns a string containing the date, with
some options.
How to use the booleans:
-getTime: Return the time also.
-displayWords: Make it look like January 14th, 2007, instead of 1/14/2007
-militaryTime: Make the time look like 16:27:32, not 4:27:32
USED RON'S FUNCTION TO MAKE THIS! I JUST BUILT ON TO IT!
*******************************************************************************}
function GetDate(getTime, displayWords, militaryTime: Boolean): String;
var
Year, Month, Day, Hour, Min, Sec, MSec: Word;
M, D: String;
begin
if(displayWords)then
begin
DecodeDate(Date, Year, Month, Day);
case Month of
1 : M := 'January';
2 : M := 'February';
3 : M := 'March';
4 : M := 'April';
5 : M := 'May';
6 : M := 'June';
7 : M := 'July';
8 : M := 'August';
9 : M := 'September';
10 : M := 'October';
11 : M := 'November';
12 : M := 'December';
end;
case Day of
1 : D := 'st';
2 : D := 'nd';
3 : D := 'rd';
end;
if(Day > 3)then
D := 'th';
if(getTime)then
begin
DecodeTime(time, Hour, Min, Sec, MSec);
if(not(militaryTime))then
begin
if(Hour > 12)then
begin
Hour:= Hour-12;
Result:= M+' '+IntToStr(Day)+D+', '+IntToStr(Year) + ' ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
exit;
end;
end;
Result:= M+' '+IntToStr(Day)+D+', '+IntToStr(Year) + ' ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
end
else
Result := M+' '+IntToStr(Day)+D+', '+IntToStr(Year);
end;
if(not(displayWords))then
begin
if(getTime)then
begin
DecodeTime(time, Hour, Min, Sec, MSec);
if(not(militaryTime))then
begin
if(Hour > 12)then
begin
Hour:= Hour-12;
Result:= DateToStr(date) + ' ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
exit;
end;
if(not(Hour > 12))then
begin
Result:= DateToStr(date) + ' ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
exit;
end;
end;
if(militaryTime)then
begin
Result:= DateToStr(date) + ' ' + IntToStr(Hour)+':'+IntToStr(Min)+':'+IntToStr(Sec);
exit;
end;
end;
if(not(getTime))then
begin
Result:= DateToStr(date);
end;
end;
end;
{*******************************************************************************
Function CapitalizeIt(theWord: String): String;
By: Bullzeye95
Description: Capitalizes the first letter of the first word in your string.
*******************************************************************************}
function CapitalizeIt(theWord: String): String;
var
tWord, firstLetter: String;
begin
tWord:= theWord;
if(tWord = '')then
begin
writeln('Your string is blank');
exit;
end;
tWord:= Trim(tWord);
firstLetter:= uppercase(copy(tWord, 1, 1));
delete(tWord, 1, 1);
tWord:= firstLetter + tWord;
Result:= tWord;
end;
{*******************************************************************************
Procedure TargetRS;
By: Bullzeye95
Description: Does the same thing as selecting the RS screen with the
crosshairs.
*******************************************************************************}
Procedure TargetRS;
begin
FindWindowBySize(766, 504);
end;
{*******************************************************************************
Function Reverse(Text: String): String;
By: Bullzeye95
Description: This reverses a string. For example, asdf would become fdsa.
*******************************************************************************}
function Reverse(Text: String): String;
var
I: Integer;
S: String;
begin
Text:= Trim(Text);
for I:= Length(Text) downto 1 do
S:= S + copy(Text, I, 1);
Result:= S;
end;
{*******************************************************************************
Function IsPrime(Num: Integer): Boolean;
By: Bullzeye95
Description: Returns true if a number is prime.
*******************************************************************************}
function IsPrime(Num: Integer): Boolean;
var
I: Integer;
begin
if(Num = 2)then
begin
Result:= True;
exit;
end;
for I:= 2 to Num - 1 do
begin
if((Num mod I) = 0)then
begin
Result:= False;
exit;
end;
end;
Result:= True;
end;
{*******************************************************************************
Function IsComposite(Num: Integer): Boolean;
By: Bullzeye95
Description: Returns true if a number is composite.
*******************************************************************************}
function IsComposite(Num: Integer): Boolean;
begin
Result:= not(IsPrime(Num));
end;
{*******************************************************************************
Function RandomCase(Text: String): String;
By: Bullzeye95
Description: Makes all letters of a string a different case. For example,
'hello bob' might become 'hELlO boB'
*******************************************************************************}
function RandomCase(Text: String): String;
var
S: Array of String;
I: Integer;
begin
setarraylength(S, Length(Text));
for I:= 0 to Length(Text) - 1 do
case Random(2) of
0: S[I]:= Uppercase(copy(Text, I + 1, 1));
1: S[I]:= Lowercase(copy(Text, I + 1, 1));
end;
for I:= 0 to Length(Text) - 1 do
Result:= Result + S[I];
end;
{*******************************************************************************
Function GetNumbers(Text: String): String;
By: Bullzeye95
Description: Returns only the numbers in a string.
*******************************************************************************}
function GetNumbers(Text: String): String;
var
I: Integer;
CE: String;
begin
Text:= Trim(Text);
for I:= 1 to Length(Text) do
if(Lowercase(copy(Text, I, 1)) = Uppercase(copy(Text, I, 1)))then
try
CE:= inttostr(strtoint(copy(Text, I, 1)));
Result:= Result + copy(Text, I, 1);
except
end;
end;
{*******************************************************************************
Function GetLetters(Text: String): String;
By: Bullzeye95
Description: Returns only the letters in a string.
*******************************************************************************}
function GetLetters(Text: String): String;
var
I: Integer;
begin
Text:= Trim(Text);
for I:= 1 to Length(Text) do
if(not(Lowercase(copy(Text, I, 1)) = Uppercase(copy(Text, I, 1))))then
Result:= Result + copy(Text, I, 1);
end;
{*******************************************************************************
Function ReArrange(Text: String): String;
By: Bullzeye95
Description: It mixes up a string. For example, 'hello' might become 'loleh'
*******************************************************************************}
function ReArrange(Text: String): String;
var
Str: Array of String;
I, TempRan: Integer;
Finish: Boolean;
begin
Text:= Trim(Text);
SetArrayLength(Str, Length(Text));
for I:= 0 to GetArrayLength(Str) - 1 do
Str[I]:= copy(Text, I + 1, 1);
while Finish = False do
begin
TempRan:= Random(GetArrayLength(Str));
Result:= Result + Str[TempRan];
Str[TempRan]:= '';
for I:= 0 to GetArrayLength(Str) - 1 do
begin
if(not(Str[I] = ''))then
begin
Finish:= False;
break;
end;
if(I = GetArrayLength(Str) - 1)then
exit;
end;
end;
end;
{*******************************************************************************
Function TrimAllSpaces(Text: String): String;
By: Bullzeye95
Description: Takes out all spaces in your string.
*******************************************************************************}
function TrimAllSpaces(Text: String): String;
var
I: Integer;
begin
Text:= Trim(Text);
for I:= 1 to Length(Text) do
while pos(' ', Text) <> 0 do
delete(Text, pos(' ', Text), 1);
Result:= Text;
end;
{*******************************************************************************
Function DeleteAll(Str, Del: String): String;
By: Bullzeye95
Description: Deletes all of the string Del in the string Str, then
returns it.
*******************************************************************************}
function DeleteAll(Str, Del: String): String;
var
I: Integer;
begin
for I:= 1 to Length(Str) do
begin
delete(Str, pos(Del, Str), Length(Del));
end;
Result:= Str;
end;
{*******************************************************************************
Function Average(Num: Array of Integer): Integer;
By: Bullzeye95
Description: Returns the average of an array of integers.
*******************************************************************************}
function Average(Num: Array of Integer): Integer;
var
TAns, I: Integer;
begin
try
SetArrayLength(Num, GetArrayLength(Num));
for I:= 0 to GetArrayLength(Num) - 1 do
TAns:= TAns + Num[I];
Result:= TAns div GetArrayLength(Num);
except
end;
end;
{*******************************************************************************
Function StrContains(Find, InString: String): Boolean;
By: Bullzeye95
Description: Returns true if string InString contains string Find.
*******************************************************************************}
Function StrContains(Find, InString: String): Boolean;
begin
Result:= pos(Find, InString) <> 0;
end;
{*******************************************************************************
Function BitmapFromColor(Width, Height, Color: Integer): Integer;
By: Bullzeye95
Description: Returns a bitmap of one color.
*******************************************************************************}
function BitmapFromColor(Width, Height, Color: Integer): Integer;
var
Buffer: Integer;
begin
Buffer:= BitmapFromString(Width, Height, '');
FastDrawClear(Buffer, Color);
Result:= Buffer;
end;
{*******************************************************************************
Function GetTradeAmount(TradePos: Integer; Side: String): Integer;
By: Bullzeye95
Description: Returns the amount of an item on either side of the trade
screen.
TradePos - The position of the item. Used like inventory position.
Side - Tells it on what side of the trade screen to look. Left or right.
*******************************************************************************}
function GetTradeAmount(TradePos: Integer; Side: String): Integer;
var
CoordPoint: TPoint;
begin
case lowercase(Side) of
'left': CoordPoint:= AmountCoords('your trade', TradePos);
'right': CoordPoint:= AmountCoords('trade', TradePos);
else Exit;
end;
Result:= GetAmount(CoordPoint.x, CoordPoint.y);
end;
{*******************************************************************************
function Range(Num1, Num2: Integer): Integer;
By: Bullzeye95
Description: Returns the range of two numbers.
*******************************************************************************}
function Range(Num1, Num2: Integer): Integer;
begin
if(Num1 - Num2 >-1)then
Result:= Num1 - Num2
else
Result:= Num2 - Num1;
end;
{*******************************************************************************
function MixColors(col1, col2: Integer): Integer;
By: Bullzeye95
Description: Mixes two colors.
*******************************************************************************}
function MixColors(col1, col2: Integer): Integer;
var
H1, S1, L1, H2, S2, L2, H3, S3, L3: Extended;
begin
ColortoHSL(col1, H1, S1, L1);
ColortoHSL(col2, H2, S2, L2);
H3:= abs((H1 + H2) div 2);
S3:= abs((S1 + S2) div 2);
L3:= abs((L1 + L2) div 2);
Result:= HSLtoColor(H3, S3, L3);
end;
{*******************************************************************************
function Place(I: Integer): String;
By: Bullzeye95
Description: Returns the number as a string, with either a 'st', 'nd', 'rd', or
'th' at the end of it.
*******************************************************************************}
function Place(I: Integer): String;
begin
case Copy(IntToStr(I), Length(IntToStr(I)), 1) of
'1': Result:= IntToStr(I) + 'st';
'2': Result:= IntToStr(I) + 'nd';
'3': Result:= IntToStr(I) + 'rd';
else Result:= IntToStr(I) + 'th';
end;
end;
{*******************************************************************************
function FindColorRightTol2(var cx, cy: Integer; Color, x1, y1, x2, y2, Tolerance: Integer): Boolean;
By: Bullzeye95
Description: Faster version of FindColorRightTol.
*******************************************************************************}
function FindColorRightTol2(var cx, cy: Integer; Color, x1, y1, x2, y2, Tolerance: Integer): Boolean;
var
Boxes: TBoxArray;
I: Integer;
tX1, tY1, tX2, tY2: Integer;
begin
SetLength(Boxes, x2 - x1);
tX1:= x2 - 1;
tY1:= y1;
tX2:= x2;
tY2:= y2;
for I:= 0 to Length(Boxes) - 1 do
begin
tX1:= tX1 - 1;
tX2:= tX2 - 1;
Boxes[I]:= IntToBox(tX1, tY1, tX2, tY2);
end;
for I:= 0 to Length(Boxes) - 1 do
if(FindColorTolerance(cx, cy, Color, Boxes[I].x1, Boxes[I].y1, Boxes[I].x2, Boxes[I].y2, Tolerance))then
begin
Result:= True;
exit;
end;
end;