BobboHobbo
2008-07-06 05:06:49
Ive started my Compost Buyer yesterday and today its all being going bad..
Fixed The AutoColour THANKS TO tutroruals!.
If anyone could help make me a AutoColour for the shop or some other way your help woyuld be great.
Heres the script.
And this script will only stay in members when its fixed.
- Bank DTM fails for catherby bank alot.
- Skips procedures then does then later WTF? like the setupplayers one.
- Clicking the farm shop symbol with no randomness event though i add it?
Fixed The AutoColour THANKS TO tutroruals!.
function FindShopColor: Integer;
var
GC, a, l, TestColor, Red, Green, Blue : integer;
var
P:array of Tpoint;
begin
GC :=5276044;
Flag;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 60);
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,25) then
begin
ColorToRGB(TestColor, Red, Green, Blue);
if InRange(Blue - Green, -64, -34) then
if InRange(Green - Red, -26, 4) then
if InRange(Blue - Red, -75, -45) then
if GetColor(P[a].x + 2, P[a].y + 2) = TestColor then
if GetColor(P[a].x + 1, P[a].y + 1) = TestColor then
if GetColor(P[a].x, P[a].y + 2) = TestColor then
if GetColor(P[a].x + 2, P[a].y) = TestColor then
if GetColor(P[a].x, P[a].y + 1) = TestColor then
if GetColor(P[a].x + 1, P[a].y) = TestColor then
if GetColor(P[a].x + 2, P[a].y + 1) = TestColor then
if GetColor(P[a].x + 1, P[a].y + 2) = TestColor then
begin
Result := TestColor;
WaterColor := TestColor;
WriteLn('ShopRoad Colour = ' + IntToStr(TestColor));
Exit;
end;
end;
end;
end;
WriteLn('Could not Shop Road Colour!');
Result := 0;
end;If anyone could help make me a AutoColour for the shop or some other way your help woyuld be great.
Heres the script.
And this script will only stay in members when its fixed.
program NewScript;
{.include SRL/SRL.scar}
var
x, y, Bankedd, Banked, got, HP, HPTime: integer;
ColorSign: string;
const
Version = '1.00';
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := ''; // 3/4 of name.
Players[0].Active := True;
Players[0].Integers[1] := 0000; //Bank Pin.
Players[0].Integers[0] := 10; //Loads
end;
function FindShopRoadColourBH: Integer;
var
StupidShop,Shopfloor:integer;
begin
StupidShop := BitmapFromString(2, 2, 'beNpLdq1Kdv2fDCKrACDH' +
'BQ4=');
ShopFloor := AutoColorThis(StupidShop, 50, MMX1, MMY1, MMX2, MMY2);
Writeln('Shop Floor Colour' + IntToStr(ShopFloor));
If ShopFloor < 1 Then
begin
Writeln('AutoColour Failed.');
end;
end;
function FindShopRoadColor: Integer;
var
GC, a, l, TestColor, Red, Green, Blue: integer;
var
P: array of Tpoint;
begin
GC := 4679037;
Flag;
FindColorsSpiralTolerance(MMCX, MMCY, P, GC, MMX1, MMY1, MMX2, MMY2, 60);
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) then
begin
ColorToRGB(TestColor, Red, Green, Blue);
if InRange(Red - Blue, 5, 10) then
if InRange(Red - Green, 5, 10) then
if GetColor(P[a].x + 5, P[a].y + 5) = TestColor then
if GetColor(P[a].x + 3, P[a].y + 3) = TestColor then
if GetColor(P[a].x, P[a].y + 5) = TestColor then
if GetColor(P[a].x + 5, P[a].y) = TestColor then
if GetColor(P[a].x, P[a].y + 3) = TestColor then
if GetColor(P[a].x + 3, P[a].y) = TestColor then
if GetColor(P[a].x + 5, P[a].y + 3) = TestColor then
if GetColor(P[a].x + 3, P[a].y + 5) = TestColor then
begin
Result := TestColor;
RoadColor := TestColor;
WriteLn('RoadColor = ' + IntToStr(TestColor));
Exit;
end;
end;
end;
end;
WriteLn('Could not find Road Color!');
Result := 0;
end;
function InFight: Boolean; //Credits to Frozen Soul
begin
if not (LoggedIn) then
Exit;
if Players[CurrentPlayer].Integers[4] = 0 then
begin
Players[CurrentPlayer].Integers[4] := GetSkillInfo('hitpoints', False);
GameTab(4);
end else
if Players[CurrentPlayer].Integers[4] > HP then
if TimeFromMark(HPTime) >= 60000 then
begin
x := TimeFromMark(HPTime) - 60000;
MarkTime(HPTime);
DecEx(HPTime, x);
Inc(HP);
end;
if FindColor(x, y, 65280, 217, 129, 297, 209) then
begin
x := GetMMLevels('hp', ColorSign);
if x = -1 then
begin
Result := FindFight;
Exit;
end;
if (x < HP) then
begin
Result := True;
WriteLn('******** FOUND FIGHTING RANDOM ********');
WriteFileString(TheFile, '******** FOUND FIGHTING RANDOM ********' + Chr(13));
TakeScreen('Found Fight');
Inc(Fights);
MarkTime(HPTime);
HP := GetMMLevels('hp', ColorSign);
if HP = -1 then
HP := Players[CurrentPlayer].Integers[4];
end;
end;
end;
procedure FindRandoms;
begin
if (not (LoggedIn)) then
Exit;
FindNormalRandoms;
if (InFight) then
begin
RunAway('W', True, 3, 100)
FFlag(3);
Wait(100 + random(500));
end;
end;
function MouseColour(xb, yb, colour, x1, y1, x2, y2: integer): boolean;
begin
Result := FindColor(xb, yb, colour, x1, y1, x2, y2);
if (result) then
begin
Mouse(xb, yb, 10, 10, true);
Wait(4000 + random(500));
FFlag(2);
end;
end;
function ShopisOpened: boolean;
begin
Result := findcolor(x, y, 65535, 30, 93, 368, 274);
end;
function AutoColor: Integer; //Sulimon's and Nieleses AutoColour thingy.
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
H, S, L: Extended;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
if not (FindColorsTolerance(arP, 4744830, MMX1, MMY1, MMX2, MMY2, 15)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
if (rs_OnMinimap(arP[i].x, arP[i].y)) then
begin
ColorToHSL(arC[i], H, S, L);
if (H >= 9.24) and (H <= 9.41) and (S >= 27.53) and (S <= 27.66) and (L >= 38.41) and (L <= 39.04) then
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 14.23) and (X <= 14.79) and (Y >= 14.10) and (Y <= 14.70) and (Z >= 7.92) and (Z <= 8.20) then
begin
Result := arC[i];
Writeln('Farming Shop Road Colour = ' + IntToStr(arC[i]));
Break;
end;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
function FindNub: Boolean;
var
Bx, By: Integer;
TPA: array of TPoint;
ATPA: T2DPointArray; //Used to contain TPA after splitting;
I: Integer; // Set the Point Array Length
begin
Writeln('Finding The Nub');
FindColorsSpiralTolerance(Bx, By, TPA, 9876668, MSX1, MSY1, MSX2, MSY2, 16)
begin
ATPA := SplitTPA(TPA, 10);
for I := 0 to High(ATPA) do //Just set the array length of ATPA ( the split points)
if MiddleTPAEX(ATPA[i], Bx, By) then
MMouse(Bx, By, 1, 1);
if IsUpText('Van') then
begin
Mouse(Bx, By, 1, 1, False);
FFlag(0);
Result := True;
end else
Result := False; // need to make sure it exits If not found!
Exit;
end;
end;
procedure FindShopDude;
var
d, f, g, xx: integer;
begin
if not (LoggedIn) then
Exit;
FindRandoms;
repeat
g := g + 1;
if FindNub then
begin
Clickoption('Trade', 1);
Wait(100 + random(100));
D := D + 1;
FindRandoms;
end;
until ((ShopisOpened) or (D = 10) or (g = 5));
if Shopisopened then
Exit;
repeat
FindShopDude;
f := F + 1;
until ((ShopIsOpened) or (F = 5));
if F = 5 then
Logout;
Exit;
end;
function BuyTheGear: boolean;
var
D, z: integer;
begin
if not (LoggedIn) then
Exit;
FindRandoms;
wait(500 + random(500));
MouseBox(337, 99, 359, 125, 2);
wait(50 + random(150));
ClickOption('Buy X', 1);
wait(540 + random(500));
repeat
Z := Z + 1;
Wait(300 + random(123));
if Findcolor(x, y, 8388608, 252, 422, 266, 433) then
begin
D := 27 + random(985);
TypeSend(IntToStr(D));
Result := True;
CloseBank;
end;
until ((Result = True) or (Z = 15));
if Result then
Exit;
if z = 5 then
Logout;
end;
procedure WalkToShop;
begin
if not (LoggedIn) then
Exit;
FindRandoms;
if FindSymbol(x, y, 'Water') then
begin
mouse(x - 20, y - 20, 12, 12, true);
Wait(9000);
FFlag(Random(5));
FindRandoms;
end else
if FindSymbolIn(x, y, 'Cook', 556, 11, 699, 55) then
begin
mouse(x - 20, y - 20, 15, 15, true);
Wait(9000);
FFlag(Random(5));
FindRandoms;
end else
Mouse(628, 19, 5, 5, true);
wait(9000);
FFlag(random(5));
if MouseColour(x, y, FindShopRoadColourBH, MMx1, MMy1, MMx2, MMy2) then
begin
Writeln('Found Shop Colour');
Exit;
end;
if FindSymbol(x, y, 'farming shop') then
begin
mouse(x, y, 4, 4, true);
Wait(9000);
FFlag(Random(5));
FindRandoms;
Exit;
end else
Logout;
end;
var
BankDTM: integer;
procedure WalkToBank;
begin
if not (LoggedIn) then
Exit;
FindRandoms;
if MouseColour(x, y, FindRoadColor, 570, 90, 628, 159) then
begin
Writeln('Using Mouse Colour, for walking.');
Exit;
end else
if FindSymbol(x, y, 'Water') then
begin
mouse(x - 20, y + 15, 5, 5, true);
Wait(3000);
FFlag(Random(5));
Writeln('Used Water symbol to walk to bank');
Exit;
end else
if FindSymbolIn(x, y, 'Cook', 556, 11, 699, 55) then
begin
mouse(x - 20, y + 10, 5, 5, true);
Wait(3000);
FFlag(Random(5));
Writeln('Used Cook symbol to walk to bank');
Exit;
end;
end;
procedure Walk2;
var
bankDTMTHING, bankDTMTHING1, xd, yd: integer;
begin
Writeln('Searching for BankDTM 1.');
bankDTMTHING := DTMFromString('78DA6314606060E06640017FFE30816946289' +
'F910748B01350C34184399284D5000049150856');
if FindDTM(BankDTMThing, Xd, Yd, MMX1, MMY1, MMX2, MMY2) then
begin
Mouse(xD + 7, yD, 3, 6, true);
writeln('Found Bank DTM');
FreeDTM(BankDTMTHING);
FFlag(0);
Exit;
end;
Writeln('Searching for BankDTM 2.');
BankDTMThing1 := DTMFromString('78DA630C626260C86740016FDF3230B002694' +
'620FE0F048CD1403579B8D580000065F5094D');
if FindDTM(BankDTMThing1, Xd, Yd, MMX1, MMY1, MMX2, MMY2) then
begin
Mouse(xD + 7, yD, 3, 6, true);
writeln('Found Bank DTM 1');
FreeDTM(BankDTMTHING1);
FFlag(0);
Exit;
end;
if FindSymbol(x, y, 'bank') then
begin
mouse(x, y, 8, 8, true);
FreeDTM(BankDTM);
FFlag(2);
Exit;
end else
Writeln('Couldnt Find Bank Symbol or Bank DTM!');
Logout;
end;
function OpenBankFastBH(Location: string): Boolean;
var
x, y, i, l, c, z: Integer;
Info: TIntegerArray;
Booths, t: TPointArray;
begin
if not (LoggedIn) then
Exit;
Wait(400);
case LowerCase(Location) of
'akb', 'al kharid': Info := [MSCX, MSCY, 606291, 4, 1];
'lb', 'lumbridge': Info := [MSCX, MSCY, 6196388, 9, 1];
'veb', 'varrock east': Info := [MSCX, MSCY, 2971236, 10, 1];
'vwb', 'varrock west': Info := [270, 270, 5689318, 25, 1];
'feb', 'falador east': Info := [MSCX, MSCY + 50, 4612728, 14, 1];
'fwb', 'falador west': Info := [MSCY, MSCY, 4612728, 14, 1];
'db', 'draynor': Info := [MSCX, MSCY, 605006, 4, 1];
'cb', 'catherby': Info := [MSCX, MSCY, 605006, 4, 1];
'eb', 'edgeville bank': Info := [MSCX + 50, MSCY, 3230295, 9, 2];
else
begin
srl_Warn('OpenBankFast', 'Unknown bank: ' + Location, warn_AllVersions);
Exit;
end;
end;
MakeCompass('n');
z := GetColorToleranceSpeed;
ColorToleranceSpeed(Info[4]);
FindColorsSpiralTolerance(Info[0], Info[1], Booths, Info[2], MSX1, MSY1, MSX2, MSY2, Info[3]);
ColorToleranceSpeed(z);
SetArrayLength(t, 0);
t := Booths;
SetArrayLength(Booths, 0);
Booths := ReArrangeAndShortenArray(t, 14);
l := GetArrayLength(Booths) - 1;
for i := 0 to l do
begin
if (not LoggedIn) or BankScreen or PinScreen then
Break;
if (LowerCase(Location) = 'vwb') or (LowerCase(Location) = 'varrock west') then
begin
Booths[i].X := Booths[i].X + 5;
Booths[i].Y := Booths[i].Y - 20;
end;
MMouse(Booths[i].X, Booths[i].Y, 3, 3);
Wait(75 + Random(75));
if IsUpText('ooth') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, False);
Wait(70 + Random(75));
if ClickOption('uickly', 1) then
begin
FFLag(0);
MarkTime(c);
repeat
Wait(100);
until (BankScreen) or (PinScreen) or (TimeFromMark(c) > 3000);
end;
end;
end;
Result := (BankScreen) or (PinScreen);
end;
function CountItemDTM(DTM: Integer): boolean;
var
i, x, y: Integer;
TB: Tbox;
begin
GameTab(4);
for i := 1 to 28 do
begin
TB := InvBox(i);
if ExistsItem(i) then
if FindDTM(DTM, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
Inc(Got);
Result := true;
end;
end;
procedure ProgressReport;
begin
WriteLn('[====================================================]');
WriteLn('[ ~ Progress Report ~ V' + Version + ' ]');
WriteLn('[====================================================]');
Writeln('[ Script Worked for ' + TimeRunning);
Writeln('[ Banked ' + IntToStr(Banked) + ' Bucket[s].');
Writeln('[ Bought ' + IntToStr(Got) + ' Bucket[s].');
writeln('[====================================================]');
end;
procedure Banking;
var
composts: integer;
begin
if not (LoggedIn) then
Exit;
OpenBankFast('db');
FindRandoms;
if (BankScreen) then
begin
Composts := DTMFromString('78DA637462626078C98002DAEB6A19B880342' +
'310FF0702466BA09A3B0C6880118904D22073AE1150E34D84399E' +
'40351F08A8B126428D2550CD33FC6A003ABD0DAF');
CountItemDTM(Composts);
FreeDTM(Composts);
Deposit(2, 28, true);
wait(20 + random(20));
Bankedd := Bankedd + 1;
Banked := Banked + 1;
ProgressReport;
Writeln('Finished Banking');
end;
end;
function GetTheCashOut: boolean;
var
z, D: integer;
begin
if not (LoggedIn) then
Exit;
if not (bankscreen) then
begin
OpenBankFastBH('cb');
end;
if (BankScreen) then
begin
FixBank;
Wait(400 + random(500));
MouseBox(82, 65, 106, 88, 2);
Wait(300 + random(650));
ClickOption('X', 1);
repeat
Z := Z + 1;
Wait(300);
if Findcolor(x, y, 8388608, 252, 422, 266, 433) then
begin
D := 560;
Wait(400 + random(500));
TypeSend(IntToStr(D));
Result := True;
case Random(2) of
1: CloseBank;
2: wait(10 + random(100));
end;
end;
until ((Result = True) or (Z = 5));
if Result then
Exit;
if z = 5 then
Logout;
end;
end;
procedure Setup;
begin
SetupSRL;
ActivateClient;
DeclarePlayers;
if (not (loggedIn)) then
LoginPlayer;
end;
procedure SetupPlayer;
begin
MakeCompass('N');
SetAngle(true);
SetRun(true);
FindRandoms;
end;
begin
Setup;
repeat
repeat
GetTheCashOut;
SetupPlayer;
WalkToShop;
FindShopDude;
BuyTheGear;
WalkToBank;
Walk2;
Banking;
until (Bankedd >= (Players[CurrentPlayer].Integers[0])) or (not (loggedIn));
if (Bankedd >= (Players[CurrentPlayer].Integers[0])) then
begin
writeln('Loads done, Chaning player');
Disguise('Loads Done, Chaning Player');
Players[CurrentPlayer].Loc := 'Bank. Loads done.';
ProgressReport;
Logout;
Bankedd := 0;
end;
if not (LoggedIn) then
begin
RandomNextPlayer(false);
Bankedd := 0;
end;
until (false);
end.