SCAR Code:
function FindLamp(skill: string): Boolean;
var
LampTime, x, y, i: Integer;
begin
GameTab(4);
if FindColorTolerance(x, y, 1084300, MIX1, MIY1, MIX2, MIY2, 40) then
if (FindBitmapToleranceIn(Lamp, x, y, MIX1, MIY1, MIX2, MIY2, 40)) then
//that 1 is the line in the error ^ ^
begin
Result := True;
Inc(Lamps);
TakeScreen('Lamp Random Solved');
AddToSRLLog('******** SOLVED LAMP RANDOM ********');
//WriteFileString(TheFile, '******** SOLVED LAMP RANDOM ********' + Chr(13));
Mouse(x, y, 1, 1, True);
Wait(1500 + Random(500));
MarkTime(LampTime);
for i:= 1 to 4 do
begin
case (LowerCase(Skill)) of
'attack': Mouse(81, 109, 12, 12, True);
'strength': Mouse(139, 110, 12, 12, True);
'ranged': Mouse(196, 113, 12, 12, True);
'magic': Mouse(257, 117, 12, 12, True);
'defence': Mouse(319, 109, 12, 12, True);
'crafting', 'craft': Mouse(376, 111, 12, 12, True);
'hitpoints', 'hp': Mouse(436, 112, 12, 12, True);
'prayer', 'pray': Mouse(79, 166, 12, 12, True);
'agility': Mouse(141, 166, 12, 12, True);
'herblore': Mouse(199, 171, 12, 12, True);
'thieving', 'thief': Mouse(258, 167, 12, 12, True);
'fishing', 'fish': Mouse(325, 164, 12, 12, True);
'runecraft', 'runecrafting': Mouse(375, 167, 12, 12, True);
'slayer', 'slay': Mouse(436, 173, 12, 12, True);
'farming', 'farm': Mouse(83, 224, 12, 12, True);
'mining', 'mine': Mouse(137, 222, 12, 12, True);
'smithing', 'smith': Mouse(197, 220, 12, 12, True);
'hunting', 'hunt', 'hunter': Mouse(257, 222, 12, 12, True);
'cooking', 'cook': Mouse(318, 227, 12, 12, True);
'firemaking', 'fire': Mouse(378, 226, 12, 12, True);
'woodcutting', 'wc': Mouse(439, 222, 12, 12, True);
'fletching', 'fletch': Mouse(199, 275, 12, 12, True);
'construction': Mouse(255, 277, 12, 12, True);
'summoning': Mouse(323, 276, 12, 12, True);
else Mouse(438, 113, 12, 12, True);
end;
Wait(500 + Random(200) + Random(100));
if FindColorTolerance(x, y, 5602449, 41, 75, 470, 302, 30) then Break;
if (TimeFromMark(LampTime) > 10000) then
begin
Result := False;
Logout;
Players[CurrentPlayer].Rand := 'Lamp';
Exit;
end;
end;
Mouse(416, 281, 7, 1, True);
Wait(500 + Random(150) + Random(150));
end;
end;
SCAR Code:
program New;
{.include SRL/SRL/Misc/smart.scar}
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}
var
Trys, LogsCut, InvItems, T, LogsToCut, lvl, lvl2 :integer;
Procedure MainLoop; Forward;
procedure DeclarePlayers;// unfortunatly this script doesent support
begin // multiplayer so just fill 1 player in...
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'A';// vv
Players[0].Pass := 'A'// vv
Players[0].Nick := 'A'//deleted for obvious resons XD
Players[0].pin := '';
Players[0].Active := True;
LogsToCut := 1000;
end;
procedure Setup;
begin
T := GetSystemTime;
SetupSRL;
SetAudioOff;
SetupWoodcutting;
DeclarePlayers;
CheckHpFirst := True;
LampSkill := 'Woodcutting';
LoginPlayer;
Retaliate(false);
lvl := GetSkillLevel('woodcutting');
Wait(1000+random(500));
sendarrowsilentwait(0, 1000+random(500));
MakeCompass('N');
if Not FindAxe then
begin
Logout;
Terminatescript;
end else
begin
if Not EquipAxe then
begin
ArrangeInv;
InvItems := InvCount;
end;
end;
GameTab(4);
end;
procedure Proggy;
begin
Writeln('/-----------------------------------\');
Writeln('| BazzBarrett''s Oak Power Chopper!');
Writeln('| ');
Writeln('| Total Time Running: ' + inttostr((Getsystemtime-T)/60000) + ' Minuets!');
writeln('| And ' + inttostr(((Getsystemtime-T)/1000)-(((Getsystemtime-T)/60000)*60)) + ' Secounds!');
Writeln('| Started at lvl '+inttostr(lvl)+' and ended at lvl '+inttostr(lvl2));
Writeln('| So We Gained ' + inttostr(lvl2-lvl) + ' Levels!');
Writeln('| ' + Players[0].Name + ':');
Writeln('| We Cut ' + IntToStr(LogsCut) + ' Logs!');
Writeln('| And Gained ' + Inttostr(LogsCut*37) + ' XP!');
Writeln('| ');
Writeln('\-----------------------------------/');
end;
procedure Scriptterminate;
begin
lvl2 := GetSkillLevel('woodcutting');
proggy;
end;
function TPAFinder(var x, y: Integer): Boolean;
var
CTS, I: Integer; //CTS will store the ColorToleranceSpeed before we change it, for later.
TPA: TPointArray; //The TPointArray in which all Coordinates which are found later will be stored
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2); //Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(0.02, 0.59);//edit these
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 4232580, MSX1, MSY1, MSX2, MSY2, 24); //For tolerance, put in your own tolerance. MSCX and MSCY are the starting points in the center of the mainscreen. MSX1, MSY1, etc. are the outside of the Main Screen.
ColorToleranceSpeed(CTS); //Make sure you do this after you're done color finding, so text finding will work again.
ATPA := TPAToATPAEx(TPA, 15, 15);
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y); //Returns the middle coords of the current TPA in the ATPA
MMouse(x, y, 2, 2); //Moves mouse over the object
If(IsUpTextMultiCustom(['Oak'])) then
begin
Result := True;
GetMousePos(x, y); //Sets the x and y values for future use (Like clicking)
Break; //Exits the For To Do statement so it doesn't keep moving around looking for the object
end;
end;
end;
procedure Checks;
begin
FindNormalRandoms;
// if InvFull then droplogs;
If FindFight then
begin
MakeCompass('N');
RunTo('S', True);
wait(20000+random(10000));
RunTo('N', True);
end;
if FindDead then
begin
Writeln('Dang! We died ending script');
terminatescript;
end;
if Not loggedin then
begin
Writeln('Unexspectedly logged out soz =(');
terminatescript;
end;
// FindNormalRandoms;
// if Not FindAxe then
// begin
// Logout;
// writeln('Going to the next player...');
// Nextplayer(False);
// end;
end;
procedure DropLogs;
var
I :integer;
begin
if FindAxe then
begin
if EquipAxe then
begin
DropAll;
// Checks;
Writeln('28 More logs droped!');
IncEx(LogsCut, 28);
end else
begin
for I := (InvItems+1) to 28 do
begin
DropItem(I);
Inc(LogsCut);
end;
//Checks;
end;
end else
begin
Writeln('No ake -.-');
terminatescript;
end;
end;
procedure ChopTrees;
var
T, x, y :integer;
begin
repeat
Checks;
if Not TPAFinder(x, y) then
begin
if trys > 5 then terminatescript;
inc(Trys);
wait(5000+random(5000));
writeln('Couldent Find Tree Randomly Walking');
RunTo('S', False);
ChopTrees;
Exit;
end else
begin
Trys := 0;
mouse(x, y, 3, 3, true);
Wait(1000+random(1000));
Checks;
MarkTime(T);
repeat
wait(random(1000));
Checks
until( Not(IsUpTextMultiCustom(['Oak'])))or(TimeFromMark(T)>15000);
end;
MarkTime(T);
repeat
Wait(1000+random(2000));
until(IsUpTextMultiCustom(['Oak']))or(TimeFromMark(T)>15000);
until(InvFull);
end;
procedure MainLoop;
begin
Repeat
ChopTrees;
DropLogs;
Until(LogsCut > LogsToCut);
end;
begin
Setup;
MainLoop;
end.