Heavenguard
2010-03-28 11:37:09
Testers Needed!
Hey all, I came back just recently and decided to re work my Varrock East Mine and banker, so far I think I got the base of it down. I need Testers though to run the script as much as they can and give me there feedback.
Ill post the code here as a tag since its just in Beta forms.
You can move the functions in the mainloop around so it does what you want it to do. Its initially made to start in the varrock east bank.
Just keep your pickaxe either Equipped or in your Inventory [First Slot].
Thanks so much to the testers, Im not spending so much time scripting so the more errors I get from you the better.
So far the problems I see are:
Opening the bank correctly.
Tweak the Walk To Mine with a little more precision.
Hey all, I came back just recently and decided to re work my Varrock East Mine and banker, so far I think I got the base of it down. I need Testers though to run the script as much as they can and give me there feedback.
Ill post the code here as a tag since its just in Beta forms.
program HGVEMB;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}
//{.include srl/srl/reflection/reflection.scar}
{*******************************************************************************
Auto Color
*******************************************************************************}
function BankPlaceCheckColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.20);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 1186687, MSX1, MSY1, MSX2, MSY2, 6);
if (Length(arP) = 0) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 5.95) and (X <= 13.26) and (Y >= 3.47) and (Y <= 7.60) and (Z >= 0.79) and (Z <= 1.54) then
begin
Result := arC[i];
Writeln('Bank Check Color = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('Could Not Find the Place Check Color for the Bank.');
end;
const
VARROCK_ROAD = 0;
GE_ROAD = 1;
GE_CENTRE = 2;
function ZephyrAutoColor(What : Integer): Integer; // Made 100% by Zephyr [Varrock Auto Color]
var
Info: TVariantArray;
II, Count, PCount: Integer;
TPA: TPointArray;
TIA: TIntegerArray;
begin
Result := 0;
case What of
VARROCK_ROAD: Info := [8816001, 6, 11.95, 0.36, 30];
GE_ROAD: Info := [6587538, 5, 0.65, 0.86, 30];
GE_CENTRE: Info := [8092275, 4, 22.77, 0.87, 800];
end;
SetColorSpeed2Modifiers(Info[2], Info[3]);
ColorToleranceSpeed(2);
if (FindColorsTolerance(TPA, Info[0], MMX1, MMy1, MMx2, MMy2, Info[1])) then
begin
FilterPointsPie(TPA, 0.0, 360.0, 0.0, 73.0, MMCX, MMCY);
TIA := GetColors(TPA);
ClearSameIntegersAndTPA(TIA, TPA);
for II := 0 to High(TIA) do
begin
Count := CountColor(TIA[II], MMX1, MMY1, MMX2, MMY2);
if (Count < Info[4]) or (Count <= PCount) then Continue;
PCount := Count;
Result := TIA[II];
end;
end;
if (Result > 0) then Status('Varrock Road Color = ' + IntToStr(Result));
end;
function IronOreColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.15);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 2238782, MSX1, MSY1, MSX2, MSY2, 7);
if (Length(arP) = 0) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 1.37) and (X <= 5.60) and (Y >= 1.23) and (Y <= 4.94) and (Z >= 0.91) and (Z <= 3.36) then
begin
Result := arC[i];
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
{*******************************************************************************
Dynamic DTM
*******************************************************************************}
function IntersectionDDTM: Integer;
var
dtmMainPoint: TDTMPointDef;
dtmSubPoints: Array [0..4] of TDTMPointDef;
TempTDTM: TDTM;
begin
dtmMainPoint.x := 871;
dtmMainPoint.y := 282;
dtmMainPoint.AreaSize := 1;
dtmMainPoint.AreaShape := 0;
dtmMainPoint.Color := ZephyrAutoColor(Varrock_Road);
dtmMainPoint.Tolerance := 10;
dtmSubPoints[0].x := 871;
dtmSubPoints[0].y := 282;
dtmSubPoints[0].AreaSize := 1;
dtmSubPoints[0].AreaShape := 0;
dtmSubPoints[0].Color := ZephyrAutoColor(Varrock_Road);
dtmSubPoints[0].Tolerance := 10;
dtmSubPoints[1].x := 900;
dtmSubPoints[1].y := 282;
dtmSubPoints[1].AreaSize := 1;
dtmSubPoints[1].AreaShape := 0;
dtmSubPoints[1].Color := ZephyrAutoColor(Varrock_Road);
dtmSubPoints[1].Tolerance := 10;
dtmSubPoints[2].x := 903;
dtmSubPoints[2].y := 265;
dtmSubPoints[2].AreaSize := 1;
dtmSubPoints[2].AreaShape := 0;
dtmSubPoints[2].Color := ZephyrAutoColor(Varrock_Road);
dtmSubPoints[2].Tolerance := 10;
dtmSubPoints[3].x := 915;
dtmSubPoints[3].y := 306;
dtmSubPoints[3].AreaSize := 1;
dtmSubPoints[3].AreaShape := 0;
dtmSubPoints[3].Color := ZephyrAutoColor(Varrock_Road);
dtmSubPoints[3].Tolerance := 10;
dtmSubPoints[4].x := 861;
dtmSubPoints[4].y := 282;
dtmSubPoints[4].AreaSize := 3;
dtmSubPoints[4].AreaShape := 0;
dtmSubPoints[4].Color := 66547;
dtmSubPoints[4].Tolerance := 10;
TempTDTM.MainPoint := dtmMainPoint;
TempTDTM.SubPoints := dtmSubPoints;
Result := AddDTM(TempTDTM);
end;
{*******************************************************************************
procedure DeclarePlayers;
By: The SRL Team
Description: Saves Player Data and Arrays. Data Could be used for Logging In or
Misc things such as Bank Pins, Etc.
*******************************************************************************}
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
Players[0].Pin := '';
Players[0].Integers[0] := 3; {Max. Seconds to Wait while Mining an Ore}
end;
{*******************************************************************************
procedure BankMyLoot;
By: Heavenguard
Description: Banks inventory slots 2 - 28.
*******************************************************************************}
procedure BankMyLoot;
var TimeToBank : Integer;
begin
Wait(Random(15000));
MarkTime(TimeToBank);
while (TimeFromMark(TimeToBank) < 30000) do
begin
if (not(LoggedIn)) then
begin
while (not(RSReady)) do Wait(200);
LoginPlayer;
end;
Writeln('Banking Loot.');
if (OpenBankQuiet('veb')) then
begin
if (PinScreen) then InPin(Players[CurrentPlayer].Pin);
Deposit(2, 28, True);
Writeln('Banked All Items Except for Slot 1');
Exit;
end else
begin
Writeln('Could not Find or Open the Bank');
Logout;
NextPlayer(False);
Exit;
end
end;
end;
{*******************************************************************************
procedure WalkBankToMine;
By: Heavenguard
Description: Walks From VE Bank to VE Mine.
*******************************************************************************}
procedure WalkBankToMine;
var X, Y, MiningAreaX, MiningAreaY, TimeToWalk : Integer;
begin
MarkTime(TimeToWalk);
while (TimeFromMark(TimeToWalk) < 30000) do
begin
if (not(FindColor(X, Y, BankPlaceCheckColor, MSX1, MSY1, MSX2, MSY2))) then Exit;
Writeln('Ready to walk to the mine.');
if (FindColor(X, Y, FindRockColor, MMCX, MMY1, MMX2, MMY2)) then
begin
Writeln('Found Rock Color');
while not (Rs_OnMinimap(X, Y)) do DecEx(X, 5);
Mouse(X, Y + 10, 4 ,4, True);
Flag;
if (FindColor(X, Y, FindRockColor, MMCX, MMY1, MMX2, MMY2)) then Mouse(X + Random(50), Y + Random(50), 4, 4, True);
Flag;
repeat
if (FindColor(X, Y, ZephyrAutoColor(Varrock_Road), MMCX, MMCY, MMX2, MMY2)) then
begin
while not (Rs_OnMinimap(X, Y)) do DecEx(X, 5);
Mouse(X, Y + Random(60), 4, 4, True);
Writeln('Walking Toward Mine...');
Flag;
end;
until (FindSymbol(MiningAreaX, MiningAreaY, 'mining spot')) and (FindColor(X, Y, FindRockColor, MMX1, MMCY, MMCX, MMY2));
Writeln('Found Mining Area');
Mouse(MiningAreaX, MiningAreaY, 4, 4, True);
Flag;
Exit;
end else
begin
Writeln('Couldnt find Rock color, exiting');
Logout;
NextPlayer(False);
Exit;
end;
end;
Writeln('Time Exceeded for walking to the mine, exiting');
Logout;
NextPlayer(False);
Exit;
end;
{*******************************************************************************
procedure WalkMineToBank;
By: Heavenguard
Description: Walks From VE Mine to VE Bank.
*******************************************************************************}
procedure WalkMineToBank;
var X, Y, BankerDots, BankAreaX, BankAreaY, Intersection, TimeToWalk : Integer;
begin
MarkTime(TimeToWalk);
while (TimeFromMark(TimeToWalk) < 43000) do
begin
if (not(FindColor(X, Y, ZephyrAutoColor(Varrock_Road), MMCX, MMY1, MMX2, MMY2))) then Exit;
Writeln('Ready to walk to the bank.');
if (not(FindColor(X, Y, FindTreeColor, MMCX, MMY1, MMX2, MMCY))) then Mouse(659, 34, 4, 4, True);
begin
Intersection := IntersectionDDTM;
Mouse(X, Y, 4, 4, True);
Flag;
repeat
if not RadialWalkTolerance(ZephyrAutoColor(Varrock_Road), 342, 360, 61, 1, 1, 10) then
if not RadialWalkTolerance(ZephyrAutoColor(Varrock_Road), 0, 5, 61, 1, 1, 10) then
if (FindColor(X, Y, ZephyrAutoColor(Varrock_Road), MMX1, MMY1, MMX2, MMCY)) then Mouse(X, Y, 4, 4, True);
Writeln('Walking toward the bank...');
Flag;
until (DTMRotated(Intersection, X, Y, MMX1, MMY1, MMX2, MMY2));
Mouse(X, Y, 4, 4, True);
Flag;
Wait(Random(4000));
FreeDTM(Intersection);
if not (RadialWalkTolerance(ZephyrAutoColor(Varrock_Road), 277, 259, 59, 1, 1, 10)) then
if (FindColor(X, Y, ZephyrAutoColor(Varrock_Road), 564, 79, 590, 89)) then Mouse(X, Y, 4, 4, True);
Writeln('Approaching Bank...');
BankerDots := DTMFromString('78DA63AC646260286140019525250C3A8C0C0' +
'C40C4F01F0818416A2A20724C50357FFE40588C503E632D116A4A' +
'89505348580D005A351238');
if (FindDTM(BankerDots, BankAreaX, BankAreaY, MMX1, MMY1, MMCX, MMY2)) then
begin
Mouse(BankAreaX, BankAreaY, 4, 4, True);
Writeln('Walking into bank...');
Flag;
FreeDTM(BankerDots);
Exit;
end else
if (FindSymbol(X, Y, 'bank')) then
begin
Mouse(X, Y, 4, 4, True);
Flag;
Writeln('Walking into Bank...');
end else
begin
Writeln('Could not Walk into the Bank, Exiting');
Logout;
NextPlayer(False);
Exit;
end;
end;
end;
Writeln('Time Exceeded for walking to the bank, Exiting');
Logout;
NextPlayer(False);
Exit;
end;
{*******************************************************************************
procedure MineIronOre;
By: Heavenguard
Description: Mines Iron Ore until Inventory is Full.
*******************************************************************************}
procedure MineIronOre;
var X, Y, ItemsInInv, TimeToMine : Integer;
var IronOreTPA : TPointArray;
var IronOreATPA : T2DPointArray;
begin
SetRun(True);
SetAngle(True);
Writeln('Mining Ore');
repeat
MarkTime(TimeToMine);
InvCount;
ItemsInInv := InvCount;
FindColorsSpiralTolerance(X, Y, IronOreTPA, IronOreColor, MSX1, MSY1, MSX2, MSY2, 7);
if (Length(IronOreTPA) >= 10) then
begin
IronOreATPA := TPAtoATPAEx(IronOreTPA, 9, 10);
MiddleTPAEx(IronOreATPA[0], X, Y);
MMouse(X, Y, 4, 4);
if (WaitUpText('ine', 300)) then
begin
Mouse(X, Y, 4, 4, True);
repeat
InvCount;
until (InvCount = ItemsInInv + 1) or (TimeFromMark(TimeToMine) >= Players[CurrentPlayer].Integers[0] * 1000);
end;
end;
until (InvFull);
Writeln('Inventory Full');
end;
{*******************************************************************************
procedure Mainloop;
By: Heavenguard
Description: Tasklist; Tells Scar What to Do.
*******************************************************************************}
procedure Mainloop;
begin
if (not(LoggedIn)) then
begin
while (not(RSReady)) do Wait(200);
LoginPlayer;
end;
repeat
BankMyLoot;
WalkBankToMine;
MineIronOre;
WalkMineToBank;
until (False);
end;
begin
ClearDebug;
DeclarePlayers;
SetupSRL;
ActivateClient;
Mainloop;
end.You can move the functions in the mainloop around so it does what you want it to do. Its initially made to start in the varrock east bank.
Just keep your pickaxe either Equipped or in your Inventory [First Slot].
Thanks so much to the testers, Im not spending so much time scripting so the more errors I get from you the better.
So far the problems I see are:
Opening the bank correctly.
Tweak the Walk To Mine with a little more precision.