SCAR Code:
{
GuilderWorld v.0.0.1 PUB [SRL4][#6]
written by munk
mine some coal in the guild. no mith :/
put the mining 60+ players in east falador bank.
Setup the players in the script.
lemme know how it works.
}
program guilder;
{.include srl/srl.scar}
{.include srl/srl/skill/mining.scar}
var
x,y,k,s,hp,ns,p,
laddercolor,gas,missedgas,assembled,
coal,bankers,pick,bentpick,handle : integer;
pickcolors:array[0..2] of integer;
rP:Array of Tpoint;
reportID : string;
np,brk : boolean;
frmDesign : TForm;
Label1, Label2, Label3, Label4, Label5 : TLabel;
Label6, Label7, Label8, Label9 : TLabel;
Button1 : TButton;
Edit1, Edit2, Edit3, Edit4 : TEdit;
Edit5, Edit6, Edit7 : TEdit;
User5, Pass5, Nick5, SSRD, SSPW, SFUN, MTSP : String;
const
dbug = false;
SRLforumsUsername = + SFUN; //This is for proggy reporting.
minsTilSwitch = + MTSP;
yourSRLstatsID= + SSID; // please register for SRL-Stats at
yourSRLstatsPW= + SSPW; // [url]http://www.stats.srl-forums.com[/url]
versionNumber = '0.0.1';
procedure ButtonClick(Sender: TObject);
begin
User5:=Edit1.Text;
Pass5:=Edit2.Text;
Nick5:=Edit3.Text;
SSID:=Edit4.Text;
SSPW:=Edit5.Text;
SFUN:=Edit6.Text;
MTSP:=Edit7.Text;
end;
procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 262;
frmDesign.Top := 96;
frmDesign.Width := 425;
frmDesign.Height := 430;
frmDesign.Caption := 'GulderWorld 0.0.1 - by Munk';
frmDesign.Color := clBtnFace;
frmDesign.Font.Color := clWindowText;
frmDesign.Font.Height := -11;
frmDesign.Font.Name := 'MS Sans Serif';
frmDesign.Font.Style := [];
frmDesign.Visible := True;
frmDesign.PixelsPerInch := 96;
Label1 := TLabel.Create(frmDesign);
Label1.Parent := frmDesign;
Label1.Left := 8;
Label1.Top := 80;
Label1.Width := 95;
Label1.Height := 23;
Label1.Caption := 'Username:';
Label1.Font.Color := clWindowText;
Label1.Font.Height := -20;
Label1.Font.Name := 'Arial';
Label1.Font.Style := [];
Label1.ParentFont := False;
Label2 := TLabel.Create(frmDesign);
Label2.Parent := frmDesign;
Label2.Left := 8;
Label2.Top := 120;
Label2.Width := 94;
Label2.Height := 23;
Label2.Caption := 'Password:';
Label2.Font.Color := clWindowText;
Label2.Font.Height := -20;
Label2.Font.Name := 'Arial';
Label2.Font.Style := [];
Label2.ParentFont := False;
Label3 := TLabel.Create(frmDesign);
Label3.Parent := frmDesign;
Label3.Left := 8;
Label3.Top := 160;
Label3.Width := 91;
Label3.Height := 23;
Label3.Caption := 'Nickname:';
Label3.Font.Color := clWindowText;
Label3.Font.Height := -20;
Label3.Font.Name := 'Arial';
Label3.Font.Style := [];
Label3.ParentFont := False;
Label4 := TLabel.Create(frmDesign);
Label4.Parent := frmDesign;
Label4.Left := 8;
Label4.Top := 200;
Label4.Width := 122;
Label4.Height := 23;
Label4.Caption := 'SRL Stats ID:';
Label4.Font.Color := clWindowText;
Label4.Font.Height := -20;
Label4.Font.Name := 'Arial';
Label4.Font.Style := [];
Label4.ParentFont := False;
Label5 := TLabel.Create(frmDesign);
Label5.Parent := frmDesign;
Label5.Left := 8;
Label5.Top := 240;
Label5.Width := 190;
Label5.Height := 23;
Label5.Caption := 'SRL Stats Password:';
Label5.Font.Color := clWindowText;
Label5.Font.Height := -20;
Label5.Font.Name := 'Arial';
Label5.Font.Style := [];
Label5.ParentFont := False;
Label6 := TLabel.Create(frmDesign);
Label6.Parent := frmDesign;
Label6.Left := 8;
Label6.Top := 280;
Label6.Width := 201;
Label6.Height := 23;
Label6.Caption := 'SRL Forum Username:';
Label6.Font.Color := clWindowText;
Label6.Font.Height := -20;
Label6.Font.Name := 'Arial';
Label6.Font.Style := [];
Label6.ParentFont := False;
Label7 := TLabel.Create(frmDesign);
Label7.Parent := frmDesign;
Label7.Left := 8;
Label7.Top := 320;
Label7.Width := 257;
Label7.Height := 23;
Label7.Caption := 'Minute'#39's Until Switch Players:';
Label7.Font.Color := clWindowText;
Label7.Font.Height := -20;
Label7.Font.Name := 'Arial';
Label7.Font.Style := [];
Label7.ParentFont := False;
Label8 := TLabel.Create(frmDesign);
Label8.Parent := frmDesign;
Label8.Left := 16;
Label8.Top := 8;
Label8.Width := 399;
Label8.Height := 31;
Label8.Caption := 'GuilderWorld v0.0.1 made by Munk';
Label8.Font.Color := 33023;
Label8.Font.Height := -27;
Label8.Font.Name := 'Times New Roman';
Label8.Font.Style := [];
Label8.ParentFont := False;
Label8.WordWrap := True;
Label9 := TLabel.Create(frmDesign);
Label9.Parent := frmDesign;
Label9.Left := 120;
Label9.Top := 40;
Label9.Width := 273;
Label9.Height := 27;
Label9.Caption := 'Form'#39's made by IP-Drowner';
Label9.Font.Color := 16761378;
Label9.Font.Height := -24;
Label9.Font.Name := 'Times New Roman';
Label9.Font.Style := [];
Label9.ParentFont := False;
Label9.WordWrap := True;
Button1 := TButton.Create(frmDesign);
Button1.Parent := frmDesign;
Button1.Left := 72;
Button1.Top := 352;
Button1.Width := 257;
Button1.Height := 33;
Button1.Caption := 'Submit Current Details';
Button1.Font.Color := clWindowText;
Button1.Font.Height := -16;
Button1.Font.Name := 'Arial';
Button1.Font.Style := [];
Button1.ModalResult := 1;
Button1.ParentFont := False;
Button1.TabOrder := 8;
Edit1 := TEdit.Create(frmDesign);
Edit1.Parent := frmDesign;
Edit1.Left := 136;
Edit1.Top := 80;
Edit1.Width := 265;
Edit1.Height := 21;
Edit1.TabOrder := 9;
Edit1.Text := 'Your Runescape Username Here';
Edit2 := TEdit.Create(frmDesign);
Edit2.Parent := frmDesign;
Edit2.Left := 136;
Edit2.Top := 120;
Edit2.Width := 265;
Edit2.Height := 21;
Edit2.PasswordChar := #164;
Edit2.TabOrder := 10;
Edit3 := TEdit.Create(frmDesign);
Edit3.Parent := frmDesign;
Edit3.Left := 136;
Edit3.Top := 160;
Edit3.Width := 265;
Edit3.Height := 21;
Edit3.TabOrder := 11;
Edit3.Text := '3-4 Letter'#39's of your Username. NO CAPITALS.';
Edit4 := TEdit.Create(frmDesign);
Edit4.Parent := frmDesign;
Edit4.Left := 144;
Edit4.Top := 200;
Edit4.Width := 257;
Edit4.Height := 21;
Edit4.MaxLength := 4;
Edit4.TabOrder := 12;
Edit4.Text := 'If you don'#39't have, register at stats.srl-forums.com';
Edit5 := TEdit.Create(frmDesign);
Edit5.Parent := frmDesign;
Edit5.Left := 208;
Edit5.Top := 240;
Edit5.Width := 193;
Edit5.Height := 21;
Edit5.PasswordChar := #164;
Edit5.TabOrder := 13;
Edit6 := TEdit.Create(frmDesign);
Edit6.Parent := frmDesign;
Edit6.Left := 224;
Edit6.Top := 280;
Edit6.Width := 177;
Edit6.Height := 21;
Edit6.TabOrder := 14;
Edit6.Text :=
Edit7 := TEdit.Create(frmDesign);
Edit7.Parent := frmDesign;
Edit7.Left := 272;
Edit7.Top := 320;
Edit7.Width := 129;
Edit7.Height := 21;
Edit7.MaxLength := 4;
Edit7.TabOrder := 15;
Edit7.Text := '10';
end;
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
procedure declarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''+ User5 +''; //username
Players[0].Pass := ''+ Pass5 +''; //password
Players[0].Nick := ''+ Nick5 +''; //3-4 letters from your username
Players[0].loc := 'bank';
Players[0].Active := true;
end;
procedure loadDTMs;
begin
pick:=DTMFromString('78DA63FCCDC8C0B001889180AE3C2B8308900' +
'689FE0702C69F986A20B2301248FF2542CD57206B1F01350C4C0C' +
'0C8B08A8E101AA59875F0D009D700C91');
handle:=DTMFromString('78DA630C616260E86764400626CA0C0C3C401' +
'A24FA1F08188330D540646124900E07AAE923A02602A8A68D801A' +
'5FA09AF9F8D500005FC208F0');
bentpick:=DTMFromString('78DA63DCCFC8C0D003C44840478E818107488' +
'344FF0301E35E4C3510591809A40F0259BD04D4EC04B266115073' +
'09C86AC7AF060033DD0AF9');
coal:=DTMFromString('78DA634C67646090036224606DADC1C003A44' +
'1A2FF81803111C892415503918591403A0CC89227A0260BC85222' +
'A0A680B01A00C6F70754');
bankers:=DTMFromString('78DA634C626260B8C800068C108AE1CF1F263' +
'8FF3F1030A6E15703A6E308AB010054AE0D93');
end;
procedure brief;
var
i,c,connect:integer;
return:string;
begin
cleardebug;
writeln('-------------------- player report ----------------------');
for i:=0 to howmanyplayers-1 do
begin
writeln(' '+inttostr(i)+' '+players[i].nick+' = '+left(booltostr(players[i].active),1)+' | '+inttostr(players[i].banked)+' banks | '+inttostr(players[i].integers[0])+' coal | '+players[i].loc+' | '+players[i].rand);
c:=c+players[i].integers[0];
end;
writeln('---------------------------------------------------------');
writeln(' ');
writeln('GuilderWorld Progress Report');
writeln(' ');
writeln(' Ran For: '+timerunning);
writeln(' Has Mined: '+inttostr(c)+' coal');
writeln(' Has Avoided: '+inttostr(gas)+' Gas(es), and has missed '+inttostr(missedgas)+' gas(es)');
writeln(' Has Assembled '+inttostr(assembled)+' pickaxes');
writeln(' ');
writeln('---------------------------------------------------------');
connect:=InitializeHTTPClient(true,true);
return:=PostHTTPPage(connect,'http://www.headweight.net/projects/SRL/reports/guilderworld/upload.php','&id='+reportID+'&user='+SRLforumsUsername+'&time='+inttostr(GetTimeRunning/1000)+'&c='+inttostr(c)+'&gas='+inttostr(gas)+'&mgas='+inttostr(missedgas)+'&a='+inttostr(assembled));
if return='annul' then terminateScript else if dbug then writeln(return);
FreeHTTPClient(connect);
srlrandomsreport;
end;
function nextEmptySlot:integer;
var
i:integer;
begin
for i:=1 to 28 do
begin
if not(existsItem(i)) then
begin
result:=i;
exit;
end;
end;
result:=1;
end;
function fighting:boolean;
begin
result:=findColorSpiral(x,y,65280,200,100,300,200);
end;
procedure runAwayHP;
begin
if (not(loggedin)) then exit;
if dbug then writeln('hp drop, running...');
runawaydirection('w');
wait(8000);
logout;
np:=true;
brk:=true;
end;
procedure runaway;
begin
findnormalrandoms;
setrun(true);
runawaydirection('w');
wait(4000+random(2000));
runback;
end;
procedure nolog;
begin
if (not(loggedin)) then exit;
case random(3) of
0: mmouse(random(500),random(300),0,0);
1: gametab(random(14));
2: begin
mouse(random(msx2),random(msy2),0,0,false);
getmousepos(x,y);
mmouse(x+100+random(100),y-50-random(50),0,0);
end;
end;
gametab(4);
end;
function countCoal:integer;
var
i,c:integer;
slot:tbox;
begin
for i:=1 to 28 do
begin
slot:=invbox(i);
if finddtm(coal,x,y,slot.x1,slot.y1,slot.x2,slot.y2) then inc(c);
end;
players[currentplayer].integers[0]:=players[currentplayer].integers[0]+c;
reportVars[0]:=reportVars[0]+c;
result:=c;
end;
function msClick(rx,ry:integer): boolean;
var
i:integer;
begin
if (rx<msx1) or (rx>msx2) or (ry<msy1) or (ry>msy2) then exit;
mouse(rx,ry,0,0,true);
for i:=0 to 50 do
begin
if (findcolorspiral(x,y,255,rx-15,ry-15,rx+15,ry+15)) then
begin
result:=true;
exit;
end;
if (findcolorspiral(x,y,65535,rx-15,ry-15,rx+15,ry+15)) then
begin
result:=false;
exit;
end;
wait(20);
end;
end;
function isGuildColor(color:integer):boolean;
var
h,s,l:extended;
begin
result:=true;
if color=0 then exit;
colorToHSL(color,h,s,l);
if (h>9) and (h<14) then
if (s>46) and (s<65) then
if (l>12) and (l<27) then exit;
if (h>12) and (h<18) then
if (s>17) and (s<63) then
if (l>10) and (l<23) then exit;
if (h>0) and (h<3) then
if (s>2) and (s<6) then
if (l>12) and (l<37) then exit;
if (h>9) and (h<12) then
if (s>35) and (s<42) then
if (l>17) and (l<41) then exit;
result:=false;
end;
function isGasColor(color:integer):boolean;
begin
result:=true;
if similarColors(5928835,color,12) then exit;
if similarColors(8296866,color,20) then exit;
//i need to add more details to this
result:=false;
end;
function noPeople(rx,ry:integer):boolean;
var
i,c,px,py,tCol:integer;
begin
result:=false;
while(i<360)do
begin
i:=i+3;
px:=round(40*sine(i))+rx;
py:=round(-40*cose(i))+ry;
if (px>msx1) and (px<msx2) then
if (py>msy1) and (py<msy2) then
begin
tCol:=getColor(px,py);
if not(isGuildColor(tCol)) then inc(c);
end;
end;
if dbug then
if c>0 then writeln(inttostr(c)+' people colors');
if c<10 then result:=true;
end;
function assemblePick:boolean;
var
i,a:integer;
slot:tbox;
hand,head:tpoint;
begin
result:=false;
gametab(5);
wait(800);
mouse(585,300,3,3,true);
wait(300);
gametab(4);
wait(200);
for i:=1 to 28 do
begin
slot:=invbox(i);
if finddtm(handle,x,y,slot.x1,slot.y1,slot.x2,slot.y2) then hand:=itemcoords(i);
if findcolorspiral(x,y,pickcolors[random(3)],slot.x1,slot.y1,slot.x2,slot.y2) then head:=itemcoords(i);
end;
marktime(a);
repeat
mouse(head.x,head.y,3,3,true);
wait(100+random(200));
mouse(hand.x,hand.y,3,3,true);
nolog;
gametab(4);
if finddtm(pick,x,y,mix1,miy1,mix2,miy2) then
begin
mouse(x,y,3,3,true);
result:=true;
inc(assembled);
exit;
end;
until(timefrommark(a)>30000);
end;
{procedure brokenPicTalk;
begin
case random(7) of
0: typesend('god damit');
2: typesend('awww, i look away for one second');
4: typesend('damit, i was watching TV');
6: typesend('stupid gas, I wasnt paying attention');
end;
end; }
function pickupHead:boolean;
var
i:integer;
begin
result:=false;
for i:=0 to 20 do
begin
if findobjCustom(x,y,['head','ick','axe'],[pickcolors[0],pickcolors[1],pickcolors[2]],i) then
begin
mouse(x,y,0,0,false);
if chooseoption('ake') then
begin
writeln('Pick Head Found!');
result:=true;
exit;
end;
end;
wait(500+random(500));
if i=10 then radialwalk(395004,0,360,20,2,2);
end;
end;
function pickcheck:integer;
begin
gametab(5);
ftwait(5);
if (finddtm(pick,x,y,mix1,miy1,mix2,miy2)) then
begin
if dbug then writeln('pickcheck = 1');
result:=1;
exit;
end;
if (finddtm(bentpick,x,y,mix1,miy1,mix2,miy2)) then
begin
if dbug then writeln('pickcheck = 2');
result:=2;
exit;
end;
if (finddtm(handle,x,y,mix1,miy1,mix2,miy2)) then
begin
if dbug then writeln('pickcheck = 3');
result:=3;
exit;
end;
writeln('no pick found');
result:=0;
end;
function pickheadcolors:boolean;
begin
gametab(5);
wait(700);
if finddtm(pick,x,y,mix1,miy1,mix2,miy2) then
begin
pickcolors[0]:=getcolor(x-1,y-10);
pickcolors[1]:=getcolor(x+8,y-8);
pickcolors[2]:=getcolor(x+15,y-6);
result:=true;
if dbug then writeln('pick colors '+inttostr(pickcolors[0])+' '+inttostr(pickcolors[1])+' '+inttostr(pickcolors[2]));
end;
end;
function handleLostHead:boolean;
begin
result:=false;
if pickuphead then result:=assemblepick;
end;
function guildWalk(sr,er,radius,xm,ym,rx,ry:integer):boolean;
var
i,n,gx,gy:integer;
begin
{if radialWalkEx(gx,gy,mmcx,mmcy,0,0,sr,er,radius) then
begin
mouse(gx+xm,gy+ym,rx,ry,true);
fflag(5);
result:=true;
exit;
end;}
result:=false;
for i:=10 to radius do
begin
if sr<er then
begin
for n:=sr to er do
gx:=round(i*sine(n))+mmcx;
gy:=round(-i*cose(n))+mmcy;
if (getcolor(gx,gy)=65536) then
begin
mouse(gx+xm,gy+ym,rx,ry,true);
flag;
result:=true;
exit;
end;
end else
begin
for n:=sr downto er do
gx:=round(i*sine(n))+mmcx;
gy:=round(-i*cose(n))+mmcy;
if (getcolor(gx,gy)=65536) then
begin
mouse(gx+xm,gy+ym,rx,ry,true);
flag;
result:=true;
exit;
end;
end;
end;
end;
function byLadder:boolean;
var
i,mx,my:integer;
begin
result:=false;
{if getColor(mmcx-30,mmcy)=0 then
if getColor(mmcx,mmcy-40)=0 then
if getColor(mmcx,mmcy+40)=0 then result:=true; }
for i:=180 to 360 do
begin
mx:=round(40*sine(i))+mmcx;
my:=round(-40*cose(i))+mmcy;
if not(getcolor(mx,my)=0) then exit;
end;
result:=true;
end;
function findLadder(var rx,ry:integer;x1,y1,x2,y2:integer):boolean;
var
i,len,testCol:integer;
h,s,l:extended;
p:Array of Tpoint;
begin
if flagpresent then
begin
flag;
wait(1000);
end;
FindColorsSpiralTolerance(mmcx,mmcy,p,10317,x1,y1,x2,y2,55);
len:=length(p)-1;
for i:=0 to len do
begin
testCol:=getColor(p[i].x,p[i].y);
colorToHSL(testCol,h,s,l);
if (h < 12) and (h > 5) then
if (s > 60) and (l < 50) then
if countColor(testCol,p[i].x-5,p[i].y-5,p[i].x+5,p[i].y+5)>8 then
begin
rx:=p[i].x;
ry:=p[i].y;
result:=true;
laddercolor:=testcol;
if dbug then writeln('found ladder, color = '+inttostr(testcol));
exit;
end;
end;
{ flag;
result:=false;
for i:=0 to 10 do
begin
n:=0;
if findDTM(ladder,mx,my,x1,y1,x2,y2) then
begin
testcol:=getcolor(mx,my);
if not(getcolor(mx,my-1)=testcol) then inc(n);
if not(getcolor(mx,my+1)=testcol) then inc(n);
if not(getcolor(mx+1,my-1)=testcol) then inc(n);
if not(getcolor(mx+1,my+1)=testcol) then inc(n);
if n>1 then
begin
rx:=mx;
ry:=my;
result:=true;
laddercolor:=testcol;
laddertol:=1;
if dbug then writeln('found ladder, color = '+inttostr(testcol));
exit;
end;
end;
ladderTol:=ladderTol+2;
end;
resetDDTM;}
end;
function findEntrance(var rx,ry:integer):boolean;
var
i,mx,my,l,c:integer;
p:array of TPoint;
begin
flag;
FindColorsSpiralTolerance(x,y,P,65536,mmx1,mmcy,mmx2-40,mmy2,0);
l:=length(p)-1;
for i:=0 to l do
begin
if findLadder(mx,my,p[i].x-10,p[i].y-10,p[i].x+10,p[i].y+10) then
begin
c:=countColor(65536,mx-5,my-5,mx+5,my+5)+countColor(laddercolor,mx-5,my-5,mx+5,my+5);
if c>25 then
begin
if dbug then writeln('c = '+inttostr(c)+', entrance found');
rx:=mx;
ry:=my;
result:=true;
exit;
end;
end;
end;
result:=false;
end;
function openFEB:boolean;
var
i,t,cts:integer;
p:array of Tpoint;
msc:Tpoint;
begin
cts:=getcolortolerancespeed;
colorToleranceSpeed(0);
marktime(t);
FindColorsSpiralTolerance(mscx,mscy,p,7372941,msx1,msy1,msx2,msy2,10);
if dbug then writeln('color array found in '+inttostr(timefrommark(t))+'ms');
colorToleranceSpeed(cts);
msc.x:=mscx;
msc.y:=mscy+30;
marktime(t);
p:=RemoveDistTPointArray(msc.x,msc.y,100,p,true);
if dbug then writeln('shortening took '+inttostr(timefrommark(t))+'ms');
marktime(t);
p:=ReArrangeandShortenArrayEx(p,60,500);
if dbug then writeln('rearranging took '+inttostr(timefrommark(t))+'ms');
marktime(t);
SortTPAFrom(p,msc);
if dbug then writeln('sorting took '+inttostr(timefrommark(t))+'ms');
{ marktime(t);
pP:=TPAtoATPAEx(p,60,100);
if dbug then writeln('splitting took '+inttostr(timefrommark(t))+'ms');
middleTPAex(pP[0],fx,fy); }
if length(p)>0 then
begin
mmouse(p[0].x,p[0].y,0,0);
wait(20+random(30));
if isUpTextMulti('ank','booth','ooth') then
begin
mouse(p[0].x,p[0].y,0,0,false);
wait(20+random(50));
if chooseOption('quickly') then
begin
fflag(0);
for i:=1 to 10 do
begin
if ((bankscreen) or (pinscreen)) then
begin
result:=true;
exit;
end;
wait(500+random(100));
end;
end;
end;
end;
end;
procedure walktoGuild;
var
i,t:integer;
begin
if (not(loggedIn)) then exit;
if not(lowercase(players[currentplayer].loc)='walktoguild') then exit;
if dbug then writeln('walking to guild');
if findladder(x,y,mmcx+25,mmcy-30,mmx2,mmcy+30) then
begin
mouse(x-15,y+10,3,3,true);
flag;
end else
begin
mouse(mmcx+40,mmcy+20,3,3,true);
flag;
end;
for i:=0 to 10 do
begin
if findentrance(x,y) then
begin
mouse(x,y,5,5,true);
flag;
break;
end;
wait(500);
end;
for i:=0 to 20 do
begin
flag;
if findobjCustom(x,y,['adder','limb'],[2774387,14421,6184,2709368,15708],5) then
begin
mouse(x,y,1,1,false);
wait(100);
if chooseoption('down') then
begin
flag;
break;
end;
end;
wait(500);
end;
marktime(t);
repeat
wait(1000);
if timefrommark(t)>20000 then
begin
logout;
np:=true;
exit;
end;
until(countcolor(65536,mmx1,mmy1,mmx2,mmy2)>800);
setrun(False);
players[currentplayer].loc:='Guild';
end;
procedure walktobank;
var
i,t:integer;
ang:extended;
begin
if (not(loggedIn)) then exit;
if not(lowercase(players[currentplayer].loc)='walktobank') then exit;
if dbug then writeln('walking to bank');
if not(guildWalk(175,185,70,-40,-30,3,3)) then guildWalk(275,265,70,10,30,3,3);
for i:=0 to 5 do
begin
// if not(guildWalk(220,218,50,0,-25,3,3)) then guildWalk(280,330,50,0,20,3,3);
guildwalk(260,180,70,-30,-30,3,3);
if findladder(x,y,mmx1,mmy1,mmx2,mmy2) then
begin
mousefindflag(x,y,3,3);
flag;
break;
end;
if byLadder then break;
end;
for i:=0 to 30 do
begin
if findobjCustom(x,y,['adder','limb'],[2774387,14421,6184,2709368,15708],5) then
begin
mouse(x,y,1,1,false);
wait(100);
if chooseoption('up') then
begin
flag;
marktime(t);
repeat
wait(1000);
if timefrommark(t)>30000 then
begin
logout;
np:=true;
exit;
end;
until(countcolor(65536,mmx1,mmy1,mmx2,mmy2)<800);
break;
end;
end else wait(500);
if (i=20) or (i=25) then
begin
mouse(mmcx-50,mmcy,5,5,true);
flag;
end;
if i=30 then
begin
logout;
np:=true;
exit;
end;
end;
if findladder(x,y,mmcx+10,mmy1,mmx2,mmcy-50) then
begin
mouse(x-20,y+10,3,3,true);
flag;
end else
begin
mouse(mmcx+20,mmcy-55,3,3,true);
flag;
end;
for i:=0 to 20 do
begin
if findDTMrotated(bankers,x,y,mmx1,mmy1,mmx2,mmy2,-1.5,1.5,0.05,ang) then
begin
mouse(x-5,y-7,5,2,true);
flag;
players[currentplayer].loc:='bank';
exit;
end;
wait(500);
fflag(0);
end;
np:=true;
end;
procedure bank;
var
i:integer;
getpick:boolean;
begin
if (not(loggedIn)) then exit;
if not(lowercase(players[currentplayer].loc)='bank') then exit;
if dbug then writeln('banking....');
makecompass('n');
highestangle;
gametab(4);
if pickcheck=1 then
begin
if invcount<1 then
begin
players[currentplayer].loc:='walkToGuild';
exit;
end;
end else
begin
if pickcheck>1 then
begin
mouse(585,300,3,3,true);
wait(500);
end;
getpick:=true;
end;
for i:=0 to 5 do
begin
flag;
if ((bankscreen) or (pinscreen)) then break;
// wait(random(1000));
if not(openFEB) then OpenBankQuiet('feb');
if ((bankscreen) or (pinscreen)) then break;
if i=5 then
begin
logout;
np:=true;
exit;
end;
end;
wait(500);
if countcoal>0 then inc(players[currentplayer].banked);
depositall;
if (getpick) then
begin
if finddtm(pick,x,y,msx1,msy1,msx2,msy2) then
begin
mouse(x,y,3,3,true);
wait(800);
end else
begin
if dbug then writeln(players[currentplayer].name+' has no pick');
closebank;
logout;
np:=true;
exit;
end;
end;
closebank;
gametab(4);
wait(500);
if finddtm(pick,x,y,mix1,miy1,mix2,miy2) then mouse(x,y,3,3,true);
brief;
players[currentplayer].loc:='walkToGuild';
pickheadcolors;
end;
function gasFinder(sx,sy:integer):boolean;
var
p:array of Tpoint;
gCx,gCy,gP,cts,len,bmp,tCol:integer;
gC:Tcanvas;
gB:Tbox;
begin
if findGas(sx,sy) then
begin
result:=true;
exit;
end;
gB.x1:=sx-20;
if gB.x1<msx1 then gB.x1:=msx1+5;
gB.y1:=sy-20;
if gB.y1<msy1 then gB.y1:=msy1+5;
gB.x2:=sx+20;
if gB.x2>msx2 then gB.x2:=msx2-5;
gB.y2:=sy+20;
if gB.y2>msy2 then gB.y2:=msy2-5;
cts:=getColorToleranceSpeed;
colorToleranceSpeed(0);
findColorsSpiralTolerance(mmcx,mmcy,p,5928835,gB.x1,gB.y1,gB.x2,gB.y2,13);
colorToleranceSpeed(cts);
len:=length(p);
if dbug then
if len<>0 then writeln(inttostr(len)+' gas colors');
if len>5 then
begin
bmp:=bitmapFromString(40,40,'');
gC:=GetBitmapCanvas(bmp);
CopyCanvas(GetClientCanvas,gC,gB.x1,gB.y1,gB.x2,gB.y2,0,0,40,40);
for gCy:=0 to 49 do
for gCx:=0 to 49 do
begin
tCol:=gC.pixels[gCx,gCy];
if isGasColor(tCol) then inc(gP);
end;
if gP>80 then
begin
if dbug then
begin
writeln('gas found!!');
// DisplayDebugImgWindow(40,40);
// CopyCanvas(Gc,getdebugcanvas,0,0,40,40,0,0,40,40);
end;
result:=true;
end;
end;
end;
function rockUnderMouse:boolean;
var
cts,count:integer;
rB:Tbox;
begin
if isUpTextMulti('ock','ine','Rock') then
begin
getMousePos(x,y);
if gasFinder(x,y-20) then
begin
mouse(mmcx+20,mmcy,5,5,true);
flag;
inc(gas);
exit;
end;
rB.x1:=x-20;
if rB.x1<msx1 then rB.x1:=msx1;
rB.y1:=y-20;
if rB.y1<msy1 then rB.y1:=msy1;
rB.x2:=x+20;
if rB.x2>msx2 then rB.x2:=msx2;
rB.y2:=y+20;
if rB.y2>msy2 then rB.y2:=msy2;
cts:=getColorToleranceSpeed;
colorToleranceSpeed(0);
count:=countColorTolerance(4606029,rB.x1,rB.y1,rB.x2,rB.y2,18);
if count<50 then result:=true;
colorToleranceSpeed(cts);
end;
end;
function clickRock:boolean;
var
mx,my:integer;
begin
if rockUnderMouse then
begin
ns:=nextemptyslot;
getMousePos(mx,my);
result:=msClick(mx,my);
end;
end;
function middleOfRock(var rx,ry:integer;rock:Tpoint):boolean;
var
ps:Array of Tpoint;
begin
FindColorsSpiralTolerance(mscx,mscy,ps,2900546,rock.x-40,rock.y-40,rock.x+40,rock.y+40,4);
if length(ps)>0 then
if middleTPAex(ps,rx,ry) then result:=true;
end;
function findRock(var rocks:array of tpoint):boolean;
var
i,c,mx,my,len,cts:integer;
p,res:Array of Tpoint;
pp:array of array of Tpoint;
nope:boolean;
begin
nope:=false;
fflag(0);
wait(200);
cts:=getColorToleranceSpeed;
colorToleranceSpeed(2);
FindColorsSpiralTolerance(mscx,mscy,p,2900546,msx1,msy1,msx2,msy2,4);
pp:=TPAtoATPAEx(p,70,50);
len:=length(pp)-1;
if len<0 then exit;
for i:=0 to len do
begin
if middleOfRock(mx,my,pp[i][0]) then
begin
if not(gasFinder(mx,my-20)) then
begin
if (i<>0) then
begin
if noPeople(mx,my) then nope:=true;
end else nope:=true;
if nope then
begin
setArrayLength(res,c+1);
res[c].x:=mx;
res[c].y:=my;
inc(c);
if c>2 then break;
end;
end;
end;
end;
if c>0 then
begin
setArrayLength(rocks,c);
rocks:=res;
result:=true;
end;
colorToleranceSpeed(cts);
end;
procedure mining;
var
t,t2:integer;
bool:boolean;
begin
bool:=true;
gametab(4);
if invfull then exit;
flag;
marktime(t);
marktime(t2);
while(timefrommark(t)<10000+random(5000))do
begin
findnormalrandoms;
if invFull then exit;
if (existsitem(ns)) then
begin
if clickRock then
begin
if dbug then writeln('restarting mining internally');
mining;
end;
exit;
end;
if findBlackChatMessage('vailable') then break;
ftwait(1);
if timefrommark(k)>20000 then
begin
nolog;
marktime(k);
bool:=true;
end;
ftwait(1)
if (existsitem(ns)) then
begin
if clickRock then
begin
if dbug then writeln('restarting mining internally');
mining; // recursion, hopefully shouldnt cause any problems
end;
exit;
end;
if fighting then
begin
runaway;
exit;
end;
ftwait(1);
if ((timefrommark(p)>60000) or (FindText(x,y,'ickaxe',npcchars,400,350,500,400))) then
begin
case pickcheck of
0: begin
brk:=true;
exit;
end;
1: pickheadcolors;
2: begin
inc(missedgas);
brk:=true;
exit;
end;
3: if not(handlelosthead)then
begin
brk:=true;
exit;
end;
end;
marktime(p);
bool:=true;
end;
ftwait(1);
if timefrommark(hp)>90000 then
begin
if hppercent<60 then runawayHP;
marktime(hp);
bool:=true;
end;
ftwait(1);
if (existsitem(ns)) then
begin
if clickRock then
begin
if dbug then writeln('restarting mining internally');
mining; // recursion, hopefully shouldnt cause any problems
end;
exit;
end;
if findRock(rP) then
begin
if not(invCount=27) then
if bool then
begin
if length(rP)>1 then mmouse(rP[1].x,rP[1].y,0,0) else mmouse(rP[0].x,rP[0].y,0,0);
bool:=false;
end;
if length(rP)>0 then
if distance(mscx,mscy,rP[0].x,rP[0].y)>55 then
begin
if dbug then writeln('breaking out of mining');
ns:=nextemptyslot;
if clickRock then mining; // recursion, hopefully shouldnt cause any problems
exit;
end;
end;
end;
end;
procedure mineLoop;
var
i,t,len:integer;
begin
if (not(loggedIn)) then exit;
if not(lowercase(players[currentplayer].loc)='guild') then exit;
if dbug then writeln('in guild, mining....');
gametab(4);
ns:=nextemptyslot;
brk:=false;
marktime(t);
marktime(p);
repeat
gametab(4);
if brk then break;
if invfull then break;
if not(loggedIn) then exit;
if findRock(rP) then
begin
len:=length(rP)-1;
for i:=0 to len do
begin
mmouse(rP[i].x,rP[i].y,0,0);
wait(50+random(100));
if clickRock then
begin
gametab(4);
if dbug then writeln('starting mining from mineloop');
mining;
break;
end;
wait(50+random(100));
end;
end else
begin
if not(guildWalk(270,240,70,70,-3,3,3)) then guildWalk(60,90,40,-50,30,3,3);
end;
until(timefrommark(t)>900000);
players[currentplayer].loc:='walkToBank';
end;
begin
SafeInitForm;
SafeShowFormModal;
loadDTMs;
setupsrl;
reportID:=getPage('http://www.headweight.net/projects/SRL/reports/guilderworld/num.php');
if dbug then writeln(reportID);
ScriptID:='365';
if not(yourSRLstatsID = '') then SRLID := yourSRLstatsID;
if not(yourSRLstatsPW = '') then SRLPassword := yourSRLstatsPW;
declareplayers;
activateclient;
np:=false;
wait(500);
loginplayer;
marktime(s);
repeat
if (np) then
begin
brief;
nextplayer(loggedIn);
brief;
loginplayer;
marktime(s);
np:=false;
end;
findnormalrandoms;
bank;
walktoguild;
mineLoop;
walktobank;
if not(loggedIn)then np:=true;
if (timefrommark(s)>(minstilswitch*60000)) then
begin
// bank;
// logout;
np:=true;
end;
until(false);
end.