SCAR Code:
procedure lumbridgecastle; {START IN COURTYARD AT STAIRSish!}
var
x,y,i,stairwoodcol,xx,yy,inroom,itp,AirTalisman:integer;
TPAFount,TPABed:TPointArray;
barrelTbox:TboxArray;
TPFount,TPBed:Tpoint;
gotwoodcol,dooropen:boolean;
label
backup,secondfail,doorfailsafe;
begin
makecompass('n');
setangle(true);
if not(findcolorstolerance(TPAFount,11826800,MMX1,MMY1,MMX2,MMY2,40)) then
begin
FindSymbols(TPAFount,'water');
end;
try
TPFount:=MiddleTPA(TPAFount);
except
logout;
players[currentplayer].loc:='Lost/Less than one fountain point on MM';
Exit;
end;
Mouse(tpfount.x - 25,MMCY,5,5,true);
FFlag(0);
if not(RadialwalkTol(Findroadcolor,251,214,70,2,2,10,15,-14,2)) then
begin
if not(RadialWalkTol( 539494 , 251, 214, 60, 2, 2, 40 ,15,-14,1)) then
begin
Logout;
players[currentplayer].loc:='Cannot find ladder on MM';
Exit;
end;
end;
x:=156;
y:=251;
if findcolorspiraltolerance(x,y,1936096,MSX1,MSY1,MSX2,MSY2,30) then //Mind rune
begin
Mouse(x - 50, y + 10, 5 , 5,false);
wait(1000+random(500));
fflag(0);
if chooseoptionex('limb-up',false) then
begin
players[currentplayer].loc:='Up one flight of stairs';
getmousepos(x,y);
if findcolortolerance(xx,yy,602955,x-110,y-110,x,y + 110,30) then
begin
stairwoodcol:=getcolor(xx,yy);
gotwoodcol:=true;
end;
Mouse(x,y,0,0,false);
chooseoptionex('limb-up',true);
end else goto backup;
end else
begin
backup:
if FindObjTPA( x, y,602955,25, -1, 10, 10, 50, ['aircase']) then
begin
Mouse(x,y,5,5,false);
stairwoodcol:=getcolor(x,y);
if chooseoption('limb-up') then
begin
players[currentplayer].loc:='Up one flight of stairs using FindObjTPA';
gotwoodcol:=true;
end else goto secondfail;
end else
begin
secondfail: //EXPERMENTAL: Never knew if this works. Should in theory
Makecompass('284.036243467926');
Setangle(false);
setarraylength(BarrelTbox,4);
BarrelTbox[0].x1:=0;
BarrelTbox[0].y1:=0; //Kitchen and a few of the torches
BarrelTbox[0].x2:=184;
BarrelTbox[0].y2:=211;
inc(i);
repeat
if FindColorSkipBoxArrayTolerance(x, y, 803168, msx1, msy1, msx2, msy2, 40, BarrelTBox) then
begin
Mouse(x,y,0,0,false);
if chooseoption('limb-up') then
begin
players[currentplayer].loc:='Used last failsafe color to climb stairs'
break;
end else
begin
BarrelTbox[0].x1:= x - 50;
BarrelTbox[0].y1:= y - 50;
BarrelTbox[0].x2:= x + 50;
BarrelTbox[0].y2:= y + 50;
inc(i);
end;
end else
inc(i);
if i>5 then
begin
Logout;
players[currentplayer].loc:='Lost at first stairs';
Exit;
end;
until(i > 5 )
end;
end;
FFlag(0);
wait(1000+random(500));
if not(getcolor(563,92) = 65536) then
begin
logout;
players[currentplayer].loc:='Lost upstairs';
Exit;
end;
symbolaccuracy:=0.6;
if findsymbol(x,y,'quest') then
begin
Mouse(x,y,0,0,true);
if not(Flagthere(x,y)) then
goto doorfailsafe;
fflag(0);
end else
begin
fflag(0);
RoadCole:=GetLumbyUpstairs;
if not(RadialWalk( 231, 350, 362, 53, -2, 2)) then
begin
if not(RadialWalk( getlumbyupstairs, 350, 362, 53, -2, 2)) then
begin
Logout;
players[currentplayer].loc:='Cannot find upstairs corridor';
Exit;
end;
end;
doorfailsafe:
fflag(0);
MakeCompass('e');
Setangle(false);
keydown(vk_up);
wait(200+random(300));
keyup(vk_up);
repeat
if itp<20 then
begin
if FindObjCustom(x,y,['oor'], [4877457,5995927,3367043], 20) then
begin
Mouse(x,y,1,1,false);
if chooseoption('pen') then
writeln('Door is closed, Opening now.')
else
if IsUpTextMultiCustom(['Open','pen']) then
writeln('Door is closed');
dooropen:=true;
end;
if dooropen then break;
end;
if dooropen then break;
inc(itp);
if itp>20 then
begin
Makecompass('nw');
Setangle(true);
if FindObjCustom(x,y,['oor'], [4877457,5995927,3367043], 20) then
begin
Mouse(x,y,1,1,false);
if chooseoption('pen') then
writeln('Door is closed, Opening now.')
else
begin
if IsUpTextMultiCustom(['Open','pen']) then
writeln('Door is closed');
end;
dooropen:= true;
end;
if dooropen then break;
end;
if dooropen then break;
until(itp > 40)
end;
Makecompass('n');
setangle(true);
inroom:= DTMFromString('78DA636C666260C867400199C9490C3A8C0C0' +
'C40C4F01F0818BB806ADA51D57C04623906881A1060EC03AA6944' +
'55F3ECF90754353D44AAE9C5AF060078161444');
if findsymbol(x,y,'quest') then
begin
Mouse(x,y,2,2,true);
FFlag(0);
end else
begin
if dtmrotated(inroom,x, y, mmx1, mmy1, mmx2, mmy2) then
begin
Mouse(x,y,2,2,true);
FFlag(2);
end;
end;
freedtm(inroom);
itp:=0;
if findobjtpa(x,y, 857964, 40, -1, 40, 40, 100, ['alk here']) then
Mouse(x,y,10,10,true);
fflag(0);
Makecompass('217.874983651098');
keydown(VK_down);
wait(500+random(500));
keyup(vk_down);
repeat
if intalk then break;
if FindObjCustom(x, y, ['oracio','uke'],[7344398,6229771,4196352,3868935,4983817,2020337] ,50) then
begin
Mouse(x,y,2,2,true);
ftwait(6);
if intalk then break;
end else
begin
if not(FindObj(x,y,'oracio',6229771, 25)) then
begin
if FindObjTPA(x, y, 7344398, 25, -1, 10, 10, 20, ['oracio','uke']) then
begin
Mouse(x,y,2,2,true);
ftwait(6);
if intalk then break;
end;
end else
begin
Mouse(x,y,2,2,true);
ftwait(6);
if intalk then break;
end;
end;
writeln(inttostr(itp));
inc(itp)
until(itp > 40)
if (itp > 40) then
begin
Logout;
players[currentplayer].loc:='Cannot find Horacio';
Exit;
end;
if (InTalk) then
begin
{players[currentplayer].loc:='Talking to Horacio';
ClickAnswer('continue', 1);
ClickAnswer('quests', 1);
ClickAnswer('continue', 4);
ClickAnswer('probl', 1);
ClickAnswer('continue', 3);}
setangle(true);
makecompass('n');
end;
AirTalisman:= DTMFromString('78DA6374656260F8C78002F66DD9C2A0C3C8C' +
'000440CFF8180D10EA8868F11551103231209A45D8850E30354F3' +
'8501BF1A77A09A4F04D43800D5FC25A0C686098987438D2F500D2' +
'B116EFE85DF2E0084BA0DEB');
gametab(4);
if not(finddtm(AirTalisman,x,y,mix1,miy1,mix2,miy2)) then
begin
logout;
players[currentplayer].loc:='Lost: Talked to Duke Horacio but no Talisman';
freedtm(airtalisman);
Exit;
end;
RadialWalkTol( getlumbyupstairs, 227, 160, 68, 2, 2, 2, 5, -14, 72);
getmousepos(x,y);
if not(flagthere(x,y)) then
begin
Mouse(206, 78, 7, 7, false);
chooseoption('alk here');
FFlag(0);
MakeCompass('e');
Setangle(false);
keydown(vk_up);
wait(200+random(300));
keyup(vk_up);
if findcolorspiraltolerance(x,y,223,MMCX - 10, MMCY - 10, MMCX + 10, MMCY + 10, 20) then
Mouse(x,y,0,0,true);
repeat
if itp<20 then
begin
if FindObjCustom(x,y,['oor'], [4877457,5995927,3367043], 30) then
begin
Mouse(x,y,1,1,false);
if chooseoption('pen') then
writeln('Door is closed, Opening now.')
else
if IsUpTextMultiCustom(['Open','pen']) then
writeln('Door is closed');
dooropen:=true;
end;
if dooropen then break;
end;
if dooropen then break;
inc(itp);
if itp>20 then
begin
Makecompass('nw');
Setangle(true);
if FindObjCustom(x,y,['oor'], [4877457,5995927,3367043], 30) then
begin
Mouse(x,y,1,1,false);
if chooseoption('pen') then
writeln('Door is closed, Opening now.')
else
begin
if IsUpTextMultiCustom(['Open','pen']) then
writeln('Door is closed');
end;
dooropen:= true;
end;
if dooropen then break;
end;
if dooropen then break;
until(itp > 40)
FFlag(0);
Makecompass('n');
RadialWalkTol( getlumbyupstairs, 227, 160, 68, 2, 2, 2, 5, -14, 72);
getmousepos(x,y);
if not(flagthere(x,y)) then
begin
logout;
players[currentplayer].loc:='Radial Walk failed in lumby 2nd floor';
exit;
end else
Flag;
end;
findcolorstolerance(tpabed, 0,MSX1,MSY1,MSX2,MSY2,0);
tpbed:=MiddleTPA(TPAbed);
dooropen:=false;
begin
for i:=0 to 2 do
begin
case i of
0: begin
Mouse(tpbed.x,tpbed.y,5,5,false);
if chooseoption('limb-down') then
dooropen:=true;
end;
1: begin
Mouse(tpbed.x + 25,tpbed.y + 30,5,5,false);
if chooseoption('limb-down') then
dooropen:=true;
end;
2: begin
Mouse(tpbed.x - 25,tpbed.y + 30,5,5,false);
if chooseoption('limb-down') then
dooropen:=true;
end;
end;
if dooropen then break;
end;
end;
if dooropen = false then
begin
if FindObjTPA( x, y,602955,25, -1, 10, 10, 50, ['aircase']) then
begin
Mouse(x,y,5,5,false);
if chooseoption('limb-down') then
players[currentplayer].loc:='First floor with tally.'
else
begin
logout;
players[currentplayer].loc:='Second floor, Cannot find stairs';
Exit;
end;
end;
end;
if not(RadialWalk( roadcole, 64, 31, 70, 2, 2)) then
RadialWalk( findroadcolor, 64, 31, 70, 2, 2);
try
freedtm(airtalisman);
freedtm(inroom);
except
Writeln('All Dtms Freed, Lets go!');
end;
end;