Nava2
2008-09-05 15:26:05
Text.scar:
Its in my AutoResponder. :)
Bank.Scar:
WithdrawItem is now in Bank.Scar, if you would like to look at it, please see your include.
Yay me! :)
GameTab.scar
Misc:
Unknown.scar
WorldSwitch.Scar
Due to older reglulations, I removed my AutoResponder as SRL will not place it in, EVER.
Core / Math.scar
Post suggestions please, everything here has been tested heavily.
{*******************************************************************************
function InChatArr(Text: Array of String) : Boolean;
By: WT-Fakawi, Nava2 & EvilChicken!
Description: Grabs Last Chat Line and performs checks on occurence of text
*******************************************************************************}
function InChatArr(Text: TStringArray): Boolean;
var
I, H : integer;
s : string;
begin
H := High(Text);
if (not (GetLastChatText(s))) then LastChatter(s);
for I := 0 to H do
begin
if (Pos(Lowercase(Text[i]), (Lowercase(s)) > 0) then
begin
Result := true;
Exit;
end;
end;
end;
Its in my AutoResponder. :)
Bank.Scar:
function WithdrawMod(col, row, Amount: Integer): boolean;
Var
ResInt, I, Count : Integer;
P : TPoint;
BBox: TBox;
begin
FixBank;
//FixBankTab;
Result := false;
ResInt := InvCount;
BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
BBox := IntToBox(BBox.x1 + 8, BBox.y1 + 8, BBox.x2 - 8, BBox.y2 - 8);
GetMousePos(P.x, P.y);
if PointInBox(P, BBox) then
BBox := IntToBox(P.x - 8, P.y - 8, P.x + 8, P.y + 8);
case Amount of
0: begin
MouseBox(BBox.X1, BBox.Y1, BBox.X2, BBox.Y2, 2);
Wait(RandomRange(75, 125));
ChooseOption('Withdraw-All');
end;
1: begin
MouseBox(BBox.X1, BBox.Y1, BBox.X2, BBox.Y2, 1);
Wait(RandomRange(50, 150));
end;
else
begin
MouseBox(BBox.X1, BBox.Y1, BBox.X2, BBox.Y2, 2);
Wait(RandomRange(75, 125));
if not ChooseOption('Withdraw-' +IntToStr(Amount)) then
begin
GetMousePos(P.x, P.y);
MouseBox(P.x - 3, P.y - 3, 3, 3, 2);
Wait(RandomRange(75, 125));
if (ChooseOption('Withdraw-X')) then
begin
Wait(RandomRange(700, 1200));
TypeSend(IntToStr(Amount));
end;
end;
end;
end;
Count := InvCount;
while (Count <= ResInt) or (I < 200) do
begin
Wait(RandomRange(15, 40));
Inc(i);
Count := InvCount;
if Count > ResInt then Break;
end;
Result := ResInt < InvCount;
end;procedure GetTabBounds(var B : TBox; T : Integer);
begin
if not InRange(T, 1, 9) then Exit;
B := IntToBox(27 + (T - 1) * 48, 51, 75 + (T - 1) * 48, 81);
end;
// Narcle / Nava2
Function ExistsBankTab(T: Integer): Boolean;
var
x, y: integer;
begin
Result := (FindColor(x, y, 65536, 27+(T-1)*48, 51, 75+(T-1)*48, 81) or (T = 1)) and BankScreen;
end;
// Very useful, as users can put all used items into last tab and script can draw from there
function GetLastTab : Integer;
begin
for Result := 9 downto 1 do
if ExistsBankTab(I) then
Break;
end;
// Narcle / Nava2
function BankTab(T: Integer): Boolean;
var
B : TBox;
begin
if not BankScreen then
Exit;
if T = CurrentBankTab then
Begin
Result := True;
Exit;
end;
if not ExistsBankTab(T) then
srl_Warn('BankTab', 'Bank Tab '+inttostr(T) +' does not Exist.', warn_AllVersions)
else
begin
GetTabBounds(B, T);
MouseBox(B.x1, B.y1, B.x2, B.y2, 1);
end;
Result := T = CurrentBankTab;
end;
// P is the MSTPoint.
function AddItemToTab(P : TPoint; T : Integer) : Boolean;
var
B : TBox;
begin
if CurrentBankTab = T then
begin
Result := True;
Exit;
end;
B := BankIndexToMSBox(BankPointToBankIndex(MSTPointToBankPoint(P)));
MouseBox(B.x1, B.y1, B.x2, B.y2, 3);
Wait(RandomRange(150, 200));
GetMousePos(P.x, P.y);
HoldMouse(P.x, P.y, True);
Wait(RandomRange(100, 150));
GetTabBounds(B, T);
MouseBox(B.x1, B.y1, B.x2, B.y2, 3);
GetMousePos(P.x, P.y);
ReleaseMouse(P.x, P.y, True);
Wait(RandomRange(300, 500));
Result := CurrentBankTab = T;
end;WithdrawItem is now in Bank.Scar, if you would like to look at it, please see your include.
Yay me! :)
GameTab.scar
function GetEquiptItemBounds(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 - 14, P.y - 14, P.x + 14, P.y + 14);
end;
procedure MouseEquiptItem(Which : String; Left : Integer);
var
B : TBox;
begin
B := GetEquiptItemBounds(Which);
if (B.x1 = 0) and (B.x2 = 0) then Exit;
GameTab(5);
Wait(RandomRange(80, 100));
case Left of
0 : MMouse(B.x1, B.y1, B.x2 - B.x1 + 1, B.y2 - B.y1 + 1);
1 : Mouse(B.x1, B.y1, B.x2 - B.x1 + 1, B.y2 - B.y1 + 1, True);
2 : Mouse(B.x1, B.y1, B.x2 - B.x1 + 1, B.y2 - B.y1 + 1, False);
else
SRL_Warn('MouseEquiptItem', 'Invalid Integer inputted in Left.', Warn_AllVersions);
end;
end;Misc:
Unknown.scar
// ReArranges an array, from StartingIndex continueing throughout the array and then stopping adding all the point before that after. So: 4, 5, 6, 0, 1, 2, 3. Invert will do this, but invert it as well so that it is 4, 3, 2, 1, 0, 6, 5.
procedure ReArray(var Arr: TPointArray; StartingIndex: Integer; Invert: boolean);
var
I, I2, H, H2 : Integer;
ArrEx : TPointArray;
begin
SetLength(ArrEx, Length(Arr));
H := High(Arr);
case Invert of
true: begin
for I := StartingIndex downto 0 do
begin
ArrEx[I2] := Arr[i];
Inc(I2);
end;
H2 := StartingIndex + 1;
I2 := H2;
for i := H downto H2 do
begin
ArrEx[I2] := Arr[i];
Inc(I2);
end;
end;
false: begin
for I := StartingIndex to H do
ArrEx[i - StartingIndex] := Arr[i];
H2 := StartingIndex - 1;
I2 := H - StartingIndex + 1;
for i := 0 to H2 do
ArrEx[I2 + i] := Arr[i];
end;
end;
Arr := ArrEx;
end;WorldSwitch.Scar
//Mixster does have a better version to go along with his new parser! :)
(*=====================================================================)
| function RandomWorld(Free: Boolean): Integer; |
| By: Nava2 |
| Instructions: Set 'Free' parameter to which ever type of world |
| that you would like. Simple! |
(=====================================================================*)
function RandomWorld(Free: Boolean): integer;
var
w, Path : string;
i, z : byte;
begin
Path := AppPath + 'Includes\SRL\SCSS\Worlds.INI';
z := StrToInt(ReadINI('Worlds', 'Count', Path));
i := RandomRange(1, z);
if Free then
w := 'Free'
else
w := 'Members';
repeat
Inc(i);
if i = z then
i := 1;
until (ReadINI('World' + IntToStr(i), 'Type', Path) = w);
Result := StrToInt(GetNumbers(ReadINI('World' + IntToStr(i), 'Prefix', Path)));
Writeln('Your Randomly chosen ' + w + ' world is ' + IntToStr(Result) + '.');
end;Due to older reglulations, I removed my AutoResponder as SRL will not place it in, EVER.
Core / Math.scar
//Seeing as there is not one... :)
function RandomRangeE(From, Ending : Extended): Extended;
begin
Result := From + Rand * (Ending - From);
end;Post suggestions please, everything here has been tested heavily.