Do enough SRL members have RS membership to make it worth making MSI P2P?
I have a catherby mage cutter already started that would be
extremely easy to convert to MSI. It's no where near done yet but so you have an idea at how simple it would be..:
program NCDS_MageTreeCutter;
{.include SRL/SRL.scar}
type
MS_Obj = record
w, h, Accuracy, Tol: Integer;
Colors: TIntegerArray;
UpText, Option: string;
end;
AxeRec = record
Inv, Eqpt: Boolean;
iSlot: Integer;
end;
const
MS_Tree = 0;
MS_Bank = 1;
TotalLogs = 0;
LoadsBeforeBreak = 1;
Normal_Hatchet_BL = 74;
Dragon_Hatchet_BL = ;
var
TreeInfo, BankInfo: MS_Obj;
AxeInfo: AxeRec;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Nick := ''; // 3-4 LOWERCASE letters from your username.
Active := True; // True = use this player.
Loc := 'Bank';
Integers[TotalLogs] := 1000; //Total amount to cut
Integers[LoadsBeforeBreak] := 4; //Plus Random(4);
end;
SetArrayLength(PlayerReport, HowManyPlayers);
// SetPlayerNameTPAs;
end;
function LoadMS_ObjInfo:(Obj: Integer): MS_Obj;
begin
case Obj of
MS_Tree:
with Result do
begin
w := 100;
h := 93;
Accuracy := 10;
Tol := 5;
Colors := [9424851, 10545132, 10743025];
Option := 'hop';
UpText := 'agic tree';
end;
MS_Bank:
with Result do
begin
w := 28;
h := 6;
Accuracy := 6;
Tol := 5;
Colors := [10460833, 12500157, 11118512];
Option := 'uickly';
UpText := 'ooth';
end;
end;
end;
function SortATPASizeToTPA(MDAr: T2DPointArray; Accuracy: Integer): TPointArray;
var
i: Integer;
begin
for i := 0 to High(MDAr) do
if Length(MDAr[i]) >= Accuracy then
Result := CombineTPA(Result, MDAr[i]);
end;
procedure N_AntiBan;
begin
case Random(2850) of
1, 3, 5:
begin
HoverSkill('woodcutting', False);
PlayerReport[CurrentPlayer].ELevel := GetSkillInfo('woodcutting', False);
PlayerReport[CurrentPlayer].EExp := GetXP('woodcutting');
end;
12:
PickUpMouse;
50, 53:
RandomRClick;
60, 65:
HoverSkill('random', False);
80..82:
begin
WTime := RandomRange(2000, 8000);
MarkTime(t);
repeat
Status('Waiting '+IntToStr((WTime - TimeFromMark(t)) / 1000)+' seconds randomly..');
Wait(1000);
until(TimeFromMark(t) >= WTime);
Status('');
end;
end;
end;
function N_FindMSObjects(x, y: Integer; Colors: TIntegerArray; var MDAr: T2DPointArray;
SearchBox: TBox; Width, Height, Accuracy, Tol: Integer): Boolean;
var
i, cts: Integer;
Arr: array of TPoint;
begin
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetLength(MDAr, Length(Colors));
for i := 0 to High(Colors) do
FindColorsSpiralTolerance(x, y, Colors[i], MDAr[i], SearchBox.x1,
SearchBox.y1, SearchBox.x2, SearchBox.y2, Tol);
ColorToleranceSpeed(cts);
for i := 0 to High(MDAr) do
if Length(MDAr[i]) > Accuracy then
Arr := CombineTPA(MDAr[i], Arr);
Result := (Length(Arr) > 1);
if not Result then
begin
Writeln('N_FindMSObjects(); Failed to find Object.');
Exit;
end;
MDAr := TPAToATPAEx(Arr, Width, Height);
end;
procedure WaitWhileChopping;
var
MDAr, MDArr: array of array of TPoint;
Arr, Arr2: array of TPoint;
i, cCount: Integer;
SearchBox: TBox;
begin
Flag;
t := GetSystemTime + 60000;
SearchBox := IntToBox(
MSCx - Round(TreeInfo.w * 0.75),
MSCy - Round(TreeInfo.h * 0.75),
MSCx + Round(TreeInfo.w * 0.75),
MSCy + Round(TreeInfo.h * 0.75)
);
if N_FindMSObjects(MSCx, MSCy, TreeInfo.Colors, MDAr, SearchBox,
TreeInfo.w, TreeInfo.h, TreeInfo.Tol) then
begin
for i := 0 to High(MDAr) do
FilterPointsDist(MDAr[i], 5, 75, MSCx, MSCy);// Just as a fail safe.
Arr := SortATPASizeToTPA(MDAr, TreeInfo.Accuracy);
cCount := Length(Arr);
repeat
if N_FindMSObjects(MSCx, MSCy, TreeInfo.Colors, MDArr, SearchBox,
TreeInfo.w, TreeInfo.h, TreeInfo.Tol) then
begin
Arr2 := SortATPASizeToTPA(MDArr, TreeInfo.Accuracy);
if (Length(Arr2) < Round(cCount * 0.50)) then
Exit;
end else
Exit;
FindNormalRandoms;
N_AntiBan;
Wait(RandomRange(200, 500));
until(not (N_FindMSObjects(MSCx, MSCy, TreeInfo.Colors, MDArr, SearchBox,
TreeInfo.w, TreeInfo.h, TreeInfo.Tol))) or (t > GetSystemTime);
end;
end;
function ChopTree: Boolean;
var
i, x, y: Integer;
MDAr: array of array of TPoint;
Arr: TPointArray;
TreePoint: TPoint;
SearchBox: TBox;
Click: Boolean;
begin
if not LoggedIn then
Exit;
SearchBox := IntToBox(MSx1, MSy1, MSx2, MSy2);
for i := 0 to High(TreeInfo.Colors) do
if N_FindMSObjects(MSCx, MSCy, TreeInfo.Colors[i], MDAr, SearchBox,
TreeInfo.w, TreeInfo.h, TreeInfo.Tol) then
begin
SortATPAFrom(MDAr, Point(MSCx, MSCy));
for i := 0 to High(MDAr) do
begin
TreePoint := MiddleTPA(MDAr[i]);
MMouse(TreePoint.x, TreePoint.y, 1, 1);
if WaitUpText(TreeInfo.UpText, 100, 2000) then
begin
GetMousePos(x, y);
Click := (InRange(Random(10), 0, 5);
Mouse(x, y, 1, 1, Click);
if Click then
Result := True
else
Result := WaitOption(TreeInfo.Option, 100, 2000);
WaitWhileChopping;
end;
end;
end;
end;
function ChopInvFull: Boolean;
var
t: Integer;
begin
t := (GetSystemTime + (5 * 60000));
while (not(InvFull) and (LoggedIn) and (GetSystemTime < t) do
begin
if ChopTree then
t := (t + (4 * 60000));
Wait(RandomRange(200, 600));
FindNormalRandoms;
end;
Result := InvFull;
end;
function N_OpenBank: Boolean;
var
MDAr: array of array of TPoint;
i, ii, x, y, bBooth: Integer;
begin
if not LoggedIn then
Exit;
for i := 0 to High(BankInfo.Colors) do
if N_FindMSObjects(MSCx, MSCy, BankInfo.Colors[i], MDAr[i], SearchBox,
BankInfo.w, BankInfo.h, BankInfo.tol) then
begin
SortATPAFrom(MDAr, Point(MSCx, MSCy));
for ii := 0 to High(MDAr) do
begin
bBooth := Round(Length(MDAr[ii]) * 0.5);
MMouse(MDAr[ii][bBooth].x, MDAr[ii][bBooth].y, 3, 3);
if WaitUpText(BankInfo.UpText, 200, 2000) then
begin
GetMousePos(x, y);
Mouse(x, y, 1, 1, False);
if WaitOption(BankInfo.Option, 200, 2000) then
if WaitFunc(@BankScreen, 200, 2000) then
begin
Result := True;
Exit;
end;
end;
end;
end;
end;
function LocateHatchet: Boolean;
var
i, cCount: Integer;
tEtry: Boolean;
iBox: TBox;
begin
repeat
case GetCurrentTab of
tab_Inv:
begin
for i := 1 to 28 do
begin
iBox := InvBox(i);
cCount := CountColor(iBox.x1, iBox.y1, iBox.x2, iBox.y2, srl_outline_black);
if cCount = Normal_Hatchet_BL or cCount = Dragon_Hatchet_BL then
begin
Result := True;
AxeInfo.Inv := True;
AxeInfo.iSlot := i;
Exit;
end;
if i = 28 then
GameTab(tab_Equip);
end;
end;
tab_Equip:
begin
cCount := CountColor(569, 288, 602, 321, srl_outline_black);
if cCount = Normal_Hatchet_BL or cCount = Dragon_Hatchet_BL then
begin
Result := True;
AxeInfo.Eqpt := True;
Exit;
end;
tEtry := True;
GameTab(tab_Magic);
end;
else
begin
if i = 0 then
begin
GameTab(tab_Inv);
Continue;
end;
if i > 0 and tEtry then
begin
Writeln('Failed to find hatchet.');
Exit;
end;
end;
end;
until(Result);
end;
function N_Deposit: Boolean;
var
i: Integer;
iBox: TBox;
begin
if (not (LoggedIn)) or InvEmpty then
Exit;
if AxeInfo.Inv then
begin
if AxeInfo.iSlot > 1 then
for i := 1 to AxeInfo.iSlot - 1 do
if ExistsItem(i) then
begin
iBox := InvBox(i);
Mouse(RandomRange(iBox.x1, iBox.x2), RandomRange(iBox.y1, iBox.y2), 0, 0, False);
WaitOption('ll', 200, 2000);
end;
for i := AxeInfo.iSlot + 1 to 28 do
if ExistsItem(i) then
begin
iBox := InvBox(i);
Mouse(RandomRange(iBox.x1, iBox.x2), RandomRange(iBox.y1, iBox.y2), 0, 0, False);
WaitOption('ll', 200, 2000);
end;
Result := (InvCount = 1);
end;
if AxeInfo.Eqpt then
begin
DepositAll;
Result := InvEmpty;
end;
if InRange(Random(10), 3, 5) then
CloseBank;
end;
I was planning to release to SSRL when finished, but if MSI goes p2p then I'll put it in there