Boreas
2007-11-15 00:25:22
{So I read here on the forums that if you buy 1k green dragon hides for 1.6mil, you
can tan them for 20k in about half an hour, and then sell for about 200k more than you
bought them for. I was making cammy tele tabs at the time, and it with so many doing the
same, it was hard to find buyers, so I took TABs cow hide tanner updated by TSN and
modified it to work with green dragon hides. I started with 1.6mil, and repeated until I could
buy 2k at a time, adding some failsafes along the way. I did it a few times with 2k, rewriting
most of it so that it was ok to leave for an hour with my main. I only had enough cash to run
it for an hour without refilling, and it was hard to find buyers. I considered releasing a
crafter/alcher to the public to increase demand for the tanned hides, but I'd rather make
money while making skills. But you guys might have a use for it, if you have at least 1.6 mil,
need some quick cash, and don't mind spending a while on the forums. }
Anyways, put in user/pass and how many hides to tan (start with that X 20gp in first inv slot), start with some hides in inv. Al Kharid btw. You can actually start it at any point during the tanning process, on the way to ellis with hides, or on the way to bank with leathers, dude to the way the main loop works.
Worked fine for me, but consider it a beta because I didn't use it that much, so keep an eye on it every so often.
program AutoTanAndBank;
{
UPDATED BY The Scar Noob!!
}
////////////////////////////////////////////////////////////////////////////
{ INSTRUCTIONS }
////////////////////////////////////////////////////////////////////////////
// //
// - Start in Al-Kharid bank and have hides in the first bank spot. //
// - Make sure you have enough coins on you for the amount of hides. //
// - Start in the far right bank booth, the one closest to the Furnace. //
// - Hides in 1st spot in bank, and coins in 1st inventory spot. //
// - Set up lines 40-49. //
// - Have fun! (PS. Special thanks to all at SRL for helping with this. //
// //
////////////////////////////////////////////////////////////////////////////
{.include SRL/SRL.scar}
////////////////////////////////////////////////////////////////////////////
{ VARS AND CONSTS. }
////////////////////////////////////////////////////////////////////////////
var x, y, TannedLeather : Integer;
const
//color from that dude over there
EllisColor = 4285103;
// Set all these up...
BankBoothColor = 7236464;
ShopSymbolColor = 3562360;
BankSymbolColor = 5822182;
KebabSymbolColor= 3223026;
Procedure DeclarePlayers;
begin
HowManyPlayers:=1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Integers[0]:= 300; // Total ammount of leather you want to tan.
Players[0].Booleans[0]:= true;//True if green leather, false if hard leather.
Players[0].Active :=True;
end;
procedure Progress;
begin
SRLRandomsReport;
Writeln(' Total time Tanning = '+inttostr(ScriptTime(2))+'.' );
Writeln(' Total Hides Tanned = '+IntToStr(TannedLeather)+'.');
end;
////////////////////////////////////////////////////////////////////////////
{ WALKS FROM THE TANNER, BACK TO THE BANK. }
////////////////////////////////////////////////////////////////////////////
function nearbank:boolean;
begin
if FindSymbol{In}(x,y,'bank'{,620,67,669,115}) then
begin
result:=true;
exit;
end;
if not (findsymbol(x,y,'quest') or(findsymbol(x,y,'fish'))) then
exit;
result:=true;
end;
Function GetCompassAngle: Extended; //Wizzup?
Var
Compass: TPointArray;
tmpPoint: TPoint;
Begin
FindColorsTolerance(Compass, 1911089, 540, 2, 590, 40, 0);
If Length(Compass) < 1 Then
Exit;
tmpPoint := MiddleTPA(Compass);
Result := Degrees(ArcTan2(tmpPoint.Y - 20, tmpPoint.X - 561)) + 90;
If (Result < 0) Then
Result := 90 - (Result * -1) + 270
End;
Function FindFourBankers(Direction:string):Tpoint;
var myy,myx,dist,DTMBankers:integer;
angle:extended;
begin
DTMBankers := DTMFromString('78DA636C66626058CB8002FEFFFFCFF01F483' +
'342D8FF195B116A98A16AFEFC6102D38C503E6323116ABA885053' +
'4D580D005F4D15F0'); //3 akbank4
{
DTMBankers := DTMFromString('78DA636C66626058CB8002FEFFFFCFF01F483' +
'342D8FF195B116A98A06AFEFC81B018A17CC64622D47411A1A69A' +
'B01A005E1515EC'); //2}
{ DTMBankers := DTMFromString('78DA636C66626058CB8002FEFFFFCFF01F483' +
'342D8FF195B116A18A16AFEFC6142E1333612A1A68B0835D584D5' +
'00005CDD15E8'); }
if not FindDTMRotated(DTMBankers,myx,myy,mmx1,mmy1,mmx2,mmy2,0,180,2.0,angle) then
begin
freedtm(DTMBankers);
exit;
end;
freedtm(DTMBankers);
angle:=GetCompassAngle;
case lowercase(Direction[1]) of
'e': angle:=angle-270.0;
'w': angle:=angle-90.0;
's': angle:=angle-180.0;
end;
dist:=5+random(7);
result.x:=myx+round((dist)*sin(radians(angle)));
result.y:=myy-round((dist)*cos(radians(angle)));
end;
function TanScreen: Boolean;
var TanText, Tx, Ty:Integer;
begin
TanText := BitmapFromString(29, 1, 'z78DA7373B3B430747303' +
'930660E04684888985B1ABB131A6384EF5962606C626101259169' +
'344568F290E0045F426A7');
Result := FindBitMapToleranceIn(TanText, Tx, Ty, 127, 28, 180, 48 ,40);
FreeBITMap(TanText);
end;
Function NPCFindNClick( NPCColor1, NPCColor2:integer; UpText1,UpText2, COption:string;RepeatUntil, RightOrLeft:boolean;
HMTolerance:integer):boolean;
var
TMT :Integer;
Coord123X :Integer;
Coord123Y :Integer;
T:integer;
begin
TMT:=0;
repeat
if repeatuntil then
begin
result:=true;
exit;
end;
FindTalk;
TMT:=TMT + 1
Wait(50+random(10));
if FindObjCustom(Coord123X, Coord123Y, [Uptext1, Uptext2], [NPCColor1, NPCColor2],HMTolerance) then//Thanks killerDou!:)
begin
T := GetSystemTime;
Wait(50+random(10));
Mouse(Coord123X, Coord123Y, 1, 1, RightOrLeft);
Wait(50+random(10));
if (RightOrLeft=False) then
begin
if ChooseOption(COption) then
begin
Result:=True;
WriteLn('Found Npc');
fflag(0);
ftwait(3);
if repeatuntil then Break;
end;
end;
end;
until (RepeatUntil) or (TMT>5)
if RepeatUntil then Result:=true;
Writeln(IntToStr(GetSystemTime - T));
end;
var HideDTM:integer;
procedure SetupScript;
begin
SetUpSRL;
symbolaccuracy:=0.6;
DeclarePlayers;
activateclient;
if (not(LoggedIn)) then
LoginPlayer;
MouseSpeed:=15;
makecompass('w');
HideDTM:= DTMFromString('78DA63FCC1C8C090CA800618914820FD87083' +
'5EC4C0C0CD904D47000D5E411A1269F801A36A09A72026A58806A' +
'6A89F057030135DF80AC3A026A3E00595504D4BC6724EC2F90398' +
'4C2F02D90558C5F0D0017680DC8');
end;
function HaveHides:boolean;
var tmpx,tmpy:integer;
begin
gametab(4);
if not FindDTM(HideDTM,tmpx,tmpy,mix1,miy1,mix2,miy2) then
exit;
if getcolor(tmpx+2,tmpy+4)<>getcolor(tmpx+2,tmpy+5) then
result:=true;
end;
function HaveLeathers:boolean;
var tmpx,tmpy:integer;
begin
gametab(4);
if not FindDTM(HideDTM,tmpx,tmpy,mix1,miy1,mix2,miy2) then
exit;
if getcolor(tmpx+2,tmpy+4)=getcolor(tmpx+2,tmpy+5) then
result:=true;
end;
function ToTanShop:boolean;
var tmpx,tmpy:integer;
begin
if not loggedin then exit;
writeln('ToTanShop-Start');
if (not HaveHides) and (not HaveLeathers) then
begin
writeln('ToTanShop-No hides/leathers, false');
result:=false;
exit;
end;
if FindSymbolIn(tmpx,tmpy,'tanner',mmx1,mmy1,692,mmy2) then
begin
writeln('ToTanShop-Already close enough to tannery, true');
result:=true;
exit;
end;
if FindSymbolIn(tmpx,tmpy,'furnace',mmx1,52,660,mmy2) then
begin
writeln('ToTanShop-Already close enough to furnace, true');
result:=true;
exit;
end;
if HaveLeathers or TanScreen then
begin
writeln('ToTanShop-Already done tanning, true')
result:=true;
exit;
end;
if FindSymbolIn(tmpx,tmpy,'quest',mmx1,mmy1,mmx2,mmy2) then
begin
if rs_OnMinimap(tmpx+56,tmpy+35) then
begin
writeln('ToTanShop- clicking NW of quest');
mouse(tmpx+56,tmpy+35,3,3,true);
SetRun(true);
fflag(2);
end;
end;
if FindSymbolIn(tmpx,tmpy,'tanner',mmx1,mmy1,692,mmy2) then
begin
writeln('ToTanShop-Already close enough to tannery, true');
result:=true;
exit;
end;
if FindSymbolIn(tmpx,tmpy,'furnace',mmx1,52,667,mmy2) then
begin
writeln('ToTanShop-Already close enough to furnace, true');
result:=true;
exit;
end;
if {FindSymbol(tmpx,tmpy,'cook')
or }FindSymbol(tmpx,tmpy,'kebab shop') then
begin
if rs_OnMinimap(tmpx,tmpy+35) then
begin
writeln('ToTanShop- clicking E of cook/kebab');
mouse(tmpx,tmpy+35,3,7,true);
fflag(5);
end;
end;
if FindSymbolIn(tmpx,tmpy,'minigame',mmx1,mmy1,mmx2,mmy2) then
begin
if rs_OnMinimap(tmpx+32,tmpy-7) then
begin
writeln('ToTanShop- clicking NW of minigame');
mouse(tmpx+32,tmpy-7,3,3,true);
fflag(2);
end;
end;
if FindSymbolIn(tmpx,tmpy,'tanner',mmx1,mmy1,692,mmy2) then
begin
writeln('ToTanShop-Already close enough to tannery, true');
result:=true;
exit;
end;
if FindSymbolIn(tmpx,tmpy,'furnace',mmx1,52,667,mmy2) then
begin
writeln('ToTanShop-Already close enough to furnace, true');
result:=true;
exit;
end;
end;
function ToEllis:boolean;
var yellows,yellows3:tpointarray;
var tmpx,tmpy:integer;
begin
if not loggedin then exit;
writeln('ToEllis-Start');
if HaveLeathers or TanScreen then
begin
writeln('ToEllis-Already done tanning, true')
result:=true;
exit;
end;
if not FindSymbolIn(tmpx,tmpy,'tanner',mmx1,34,mmx2,mmy2)then
if not FindSymbolIn(tmpx,tmpy,'furnace',mmx1,53,mmx2,mmy2) then
begin
writeln('ToEllis-Cant find tannery or furnace, false');
result:=false;
exit;
end;
if FindSymbolIn(tmpx,tmpy,'tanner',mmx1,34,mmx2,mmy2)then
begin
FindColorsTolerance(yellows,195836,mmx1,mmy1,mmx2,mmy2,0);
writeln(inttostr(getarraylength(yellows))+' yellow pixels');
yellows3:=ReArrangeandShortenArrayEx(yellows,4,4);
writeln(inttostr(getarraylength(yellows3))+' yellow dots');
SortTPAFrom(yellows3,IntToPoint(tmpx,tmpy));
setarraylength(yellows3,2);
SortTPAFrom(yellows3,IntToPoint(mmx2,mmcy));
Mouse(yellows3[0].x,yellows3[0].y,1,1,true);
highestangle;
fflag(0);
end;
if HaveLeathers or TanScreen then
begin
writeln('ToEllis-Already done tanning, true')
result:=true;
exit;
end;
result:=true;
end;
function FindEllis:boolean;
begin
if not loggedin then exit;
writeln('FindEllis-Start');
if HaveLeathers or TanScreen then
begin
writeln('FindEllis-Already done tanning, true')
result:=true;
exit;
end;
if (not HaveHides) and (not HaveLeathers) then
begin
writeln('FindEllis-No hides/leathers, false');
result:=false;
exit;
end;
NPCFindNClick(5208281,4747209,'alk-to Ellis','Ellis','Trade',TanScreen,false,13);
if TanScreen then
writeln('FindEllis-Tanscreen, true')
else
writeln('FindEllis-Failed to find Ellis, false');
result:=tanscreen;
end;
function TanHides:boolean;
begin
writeln('TanHides-Start');
if not loggedin then exit;
if HaveLeathers then
begin
result:=true;
writeln('TanHides-Already got leathers, true');
exit;
end;
if (Players[CurrentPlayer].Booleans[0]) then
begin
writeln('TanHides-Tanning all your hides to green leather.');
//MMouse(93, 237{105},5,5);
ftwait(1);
Mouse(93, 237{105},5,5,false);
Wait(500+random(300));
ChooseOption('All');
Ftwait(4);
result:=HaveLeathers;
end;
if not(Players[CurrentPlayer].Booleans[0]) then
begin
Status('Tanning all your hides to hard leather.');
// MMouse(208, 104,5,5);
Mouse(208, 104,5,5,false);
Wait(500+random(300));
ClickOption('All', 1);
FindNormalRandoms;
Wait(1000+random(250));
end;
end;
function ToBank:boolean;
var i,tmpx,tmpy:integer;
begin
if not loggedin then exit;
writeln('ToBank-Start');
if (HaveHides and (not HaveLeathers)) or TanScreen then
begin
writeln('ToBank- Not done tanning yet, false');
result:=false;
exit;
end;
if BankScreen then
begin
writeln('ToBank-Bank already open, true');
result:=true;
exit;
end;
if findsymbol(tmpx,tmpy,'kebab shop') then
begin
writeln('ToBank-heading SW of kebab shop');
mouse(tmpx-(15+random(10)),tmpy+10+random(5),0,0,true);
fflag(5);
end;
if nearbank then
begin
result:=true;
exit;
end;
if FindSymbolIn(tmpx,tmpy,'minigame',mmx1,mmy1,mmx2,mmy2) then
begin
if rs_OnMinimap(tmpx-21,tmpy-40) then
begin
writeln('ToBank- clicking NE of minigame');
mouse(tmpx-21,tmpy-40,3,3,true);
fflag(2);
end;
end;
if nearbank then
begin
result:=true;
exit;
end;
repeat
i:=i+1;
Mouse(590,100,5,5,True);
FindNormalRandoms;
fflag(5);
until (nearbank) or (i>4);
result:=nearbank;
end;
function FindBankers:boolean;
var pt:tpoint;
begin
writeln('FindBankers-Start');
if BankScreen then
begin
writeln('ToBank-Bank already open, true');
result:=true;
exit;
end;
if FindSymbol(x,y,'bank') then
begin
writeln('FindBankers-clicking near bank symbol');
Mouse(x,y,3,3,true);
fflag(5);
end;
pt:=FindFourBankers('e');
if (pt.x<>0) and (pt.y<>0) then
begin
writeln('FindBankers-Found DTM, true');
mouse(pt.x,pt.y,0,0,true);
lowestangle;
fflag(0);
result:=true;
end;
end;
function MyOpenBank:boolean;
var i:integer;
begin
if not loggedin then exit;
writeln('OpenBank-Start');
if BankScreen then
begin
writeln('ToBank-Bank already open, true');
result:=true;
exit;
end;
repeat
i:= + 1;
mousespeed:=10;
mmouse(88+random(160),80+random(50),0,0);
OpenBankGlass('akb', false, false);
mousespeed:=15;
if (not BankScreen) and (i >=2) then
begin
FindBankers;
end
until (GetColor(238, 43) = 2070783) or (i >= 4) or (BankScreen);
if BankScreen then
begin
writeln('OpenBank-Opened bank, true');
result:=true;
exit;
end;
if not BankScreen then
begin
writeln('OpenBank-failed to find bank, false');
result:=false;
exit;
end;
end;
function DepositLeathers:boolean;
begin
if not loggedin then exit;
writeln('DepositLeathers-Start');
if HaveLeathers then
begin
getmousepos(x,y);
if not( ((y>221)and(y<239)) and ((x>611)and(x<634)) ) then
Mmouse(665,227,5,5)
getmousepos(x,y);
mouse(x,y,0,0,false);
ClickOption('All', 2);
mmouse(35+49,27+38,1,1);
repeat
Wait(100+random(50));
until (not Bankscreen) or (Not Haveleathers);
TannedLeather:= TannedLeather + 27;
Progress;
end;
FixBank;
Withdraw(1, 1, 0);
CloseBank;
repeat
Wait(100+random(50));
until (not Bankscreen) or (HaveHides);
result:=HaveHides;
end;
procedure Reset;
begin
writeln('Reset');
Logout;
wait(1000);
LoginPlayer;
MouseSpeed:=15;
makecompass('w');
end;
var errors:integer;
begin
SetupScript;
repeat
//yea i know, not indented, but it looks neater this way
if ToTanShop then
if ToEllis then
if FindEllis then
if TanHides then
if ToBank then
if FindBankers then
if MyOpenBank then
if DepositLeathers then
errors:=0;
errors:=errors+1;
if errors>4 then
Reset;
until(Players[CurrentPlayer].Integers[0]<(TannedLeather));
end.btw I changed my openbankglass to this but I doubt you absolutely have to
function OpenBankGlass(WhichBank: string; ChangeCompass, ChangeAngle: Boolean): Boolean;
var
OBC: TPoint;
c, Speed: Integer;
begin
Speed := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if ChangeAngle then HighestAngle;
if ChangeCompass then
begin
c := Random(2);
case WhichBank of
'feb', 'fwb', 'veb': if c = 0 then MakeCompass('N') else MakeCompass('S');
'akb', 'db', 'eb', 'vwb': if c = 0 then MakeCompass('E') else MakeCompass('W');
end;
end;
Wait(100);
if IsUpTextMulti('nk', 'bo', 'ot') then
begin
getmousepos(obc.x,obc.y);
Mouse(OBC.x, OBC.y, 0, 0, False);
Wait(100);
if ChooseOption('uickly')then
mmouse(611+random(23),221+random(18),0,0);
FFlag(0);
Wait(2000 + Random(500));
if BankScreen or PinScreen then Result := True;
exit;
end;
if FindColorTolerance(OBC.x, OBC.y, 10594993, MSX1, MSY1, MSX2, MSY2, 4) then
begin
MMouse(OBC.x, OBC.y, 4, 4);
if IsUpTextMulti('nk', 'bo', 'ot') then
begin
getmousepos(obc.x,obc.y);
Mouse(OBC.x, OBC.y, 0, 0, False);
Wait(100);
if ChooseOption('uickly') then
mmouse(611+random(23),221+random(18),0,0);
FFlag(0);
Wait(2000 + Random(500));
if BankScreen or PinScreen then Result := True;
end;
end else
if FindObj(OBC.x, OBC.y, 'ank', 10594993, 19) then
begin
if not(IsUpTextMulti('nk', 'bo', 'ot'))then
Mouse(OBC.x, OBC.y, 0, 0, False);
Wait(50);
ChooseOption('uickly');
FFlag(0);
mmouse(611+random(23),221+random(18),0,0);
Wait(2000 + Random(500));
if BankScreen or PinScreen then Result := True;
end;
ColorToleranceSpeed(Speed);
end;