SRL Archive - First Scripts

Seer's Yew cutter and burner.


bud_wis_er_420

2012-01-03 04:19:59

This is still a work in progress. There are many things I want to add. Banking for one. Other locations for another.

Updates:
vers
1.3b: Fixed progress report 1/4/2012
1.3: Fixed FindSymbol bug, added paint proggy, and tweaked a few minor things 1/4/2012
1.2: Fixed a few things and made chat finder a bit better 1/3/2012
1.1: Fixed a nest bug 1/3/2012

Future Plans:
1: Banking
2: More locations
3: Better Burning method (taking suggestions)
4: More antiban
5: Better random control (Custom control to 'warn' when you get a random)
6: World switching
7: Better chat method
8: Better SMART Paint Progress report
9: A GUI
10: And more I will think of later

Warning: Until I figure out a better burning method, you should babysit this script. Because if someone starts messing with you or another player starts this script on the same world it will cause problems. As it uses the same area to burn logs every time.

MUST have euphemism's ObjectDTM include.
Go here to get it: http://villavu.com/forum/showthread.php?t=68112&highlight=objectdtm


program Woodcutter_and_Burner;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
{=============================================================]
[ Bud_wis_er_420 Chopper and Burner ver 1.3b ]
[=============================================================]
[ REQUIREMENTS!!!: ~A members account ]
[ ~60 Woodcutting ]
[ ~Hatchet in inventory or equipped ]
[ ~Don't wear colors close to your ]
[ axe head color ]
[=============================================================]
[ Features: ~Cuts Yews and burns them with color ]
[ ~Finds nests and plays sound if it fails ]
[ ~Plays sound if it sees chat(gona make batter) ]
[ ~Supports any axe(only tested with dragon axe) ]
[ ~light antiban(will add more later) ]
[ ~SMART paint progress report ]
[=============================================================]
[ Set-Up Instruction: 1. Go to yews in seer's south of flax ]
[ 2. Setup username and pass stuff ]
[ 3. Choose settings in setup option below]
[ 4. Hit Run ]
[=============================================================]}
//Credit to Duff for the above layout
///\\\///\\\///\\\///\\\///\\\gnore this part///\\\///\\\///\\\///\\\///\\\///
var //
x,y,log,Tried, //
Hatchet_Color, StartTime, CurrentTime, Loop_Count, Time_Ran_Sec, //
Break_Time, count, Nest, Slot_Count, Total_Log_Count,
Total_Burn_Count,Total_Nests_Found, Last_fed: integer; //
EastLocator_FireSpot, WestLocator_FireSpot, SouthLocator_TreeSpot, //
EastLocator_TreeSpot, WestLocator_TreeSpot, time, Paint_On: string; //
Dots: TPointArray; //
const //
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///Setup Options\\///\\\///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
Hatchet_Using = 'Dragon'; //Dagon; Rune; Addy; Mith; Black; etc.
Cut_Alone = 'Yes'; // Yes/No *future use
Break_When = 200; //Break every so many mins
Break_for = 10; //How long to break for in mins
Log_out = 400; //Logs out after so many mins
Choose_Lamp_Skill = 'summoning'; //pik your lamp skill
//Choose a Warning sound, default is 'Windows Critical Stop'
Choose_Sound = 'C:\Windows\Media\Windows Critical Stop.wav';
Turn_Paint_On = 'Off'; //On/Off debug paint

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Youe Rs username
Players[0].Pass := ''; //Your RS password
Players[0].Nick := '`'; //3-4 letters from name
Players[0].Active := True;
Players[0].Pin := '';
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///\/Begining of Script\///\\\///\\\///\\\///\\\///\\\
///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\

procedure Feed_Pet;
var
Pet_Food, Nows, Feed: integer;
begin
Nows := GetSystemTime;
Feed := Nows - Last_fed;
if(feed > 1200000)then
begin
Pet_Food := DTMFromString('78DA63CC64626078CE8001FE033123880602C' +
'638A09AB7E82A9818F8A16A4080311DA8E60101353940357709A8' +
'2907AAB94F404D3650CD0722CC798E5F0D0084970EB8');
if(FindDTM(Pet_Food, x, y, 550, 205, 735, 465))then
begin
repeat
Mouse(x - 3, y - 3, 6, 6, true);
wait(1000+random(500))
until(IsUpTextMultiCustom(['se Ra', 'e Raw', 'tuna', 'Use R']))
x := MSCX;
y := MSCY;
if(FindObjTPA(x, y, 3618618 , 8, -1, 10, 10, 5,
['Baby', 'by pe', 'peng', 'guin']))then
begin
writeln('Feediing pet');
Mouse(x,y,0,0,false);
WaitOption('Baby pen', 1000 + random(500));
Last_fed := GetSystemTime;
end else
begin
writeln('Could not find Pet, moving and try again');
Mouse(619, 98, -5, 5,false);
Sleep(1000 + random(500));
Flag;
Sleep(1000 + random(500));
Feed_Pet;
end;
end else
begin
writeln('Out of pet food picking up pet');
if(FindObjTPA(x, y, 3618618 , 8, -1, 10, 10, 5,
['Baby', 'by pe', 'peng', 'guin']))then
begin
Mouse(x, y, 0, 0, true);
end;
end;
end;
end;

Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;

procedure Do_Progress_Report;
begin
PrintOnSmart(['Bud_wis_er_420s Yew Woodcutter and Burner',
'',
'Logs chopped: ' + IntToStr(Total_Log_Count),
'Logs burned : ' + IntToStr(Total_Burn_Count),
'Nests found : ' + IntToStr(Total_Nests_Found),
'Running for : ' + TimeRunning], Point(35, 20), 16777215);
end;

procedure Load_DTMs(Un_Load:string);
begin
if(Un_Load = 'load')then
begin
Log := DTMFromString('78DA637466626078CA8001FE0331238806024' +
'65BA09A3BE82A9818F8A16A4080D109A8E63D01353E40356F08A8' +
'F105AA79805F0D0056AA0B2B');
Nest := DTMFromString('78DA63DCCFC4C0B08791011DFC076290E87F2' +
'0603C0454B3195D0D13033F540D08306E07AAD94A40CD16A09A9D' +
'04D46C02AAD94B40CD5EA09AA304D41C25AC060023AA0FC9');
EastLocator_FireSpot := '572:101:3:5:7:636:72:1:7:626:89:1:7:615:93';
WestLocator_FireSpot := '648:114:3:3:7:605:96:3:7:598:81:3:7:593:100';
SouthLocator_TreeSpot := '623:68:2:2:7:613:141:2:7:612:153';
EastLocator_TreeSpot := '578:73:3:5:7:641:72:1:7:630:89:1:7:618:93';
WestLocator_TreeSpot := '659:64:3:3:7:615:73:3:7:602:77:3:7:606:56';
end;
if(Un_Load = 'free')then
begin
FreeDTM(Log);
FreeDTM(Nest);
end
end;

procedure AntiRandoms;
begin
if(FindChatBoxText('No... what?', 8, clBlue))then
begin
Writeln('Bob the Cat Random found');
Load_DTMs('free');
PlaySound(Choose_Sound);
Sleep(10000+random(1000));
PlaySound(Choose_Sound);
Logout;
TerminateScript;
end;
FindNormalRandoms;
LampSkill := Choose_Lamp_Skill;
end;



procedure Auto_Login;
var
Login_Screen,Invalid_Screen, Update_Screen:integer;
begin
Login_Screen := DTMFromString('78DA6354656460D8C1800214656418B880345' +
'086E13F1030660059EDA86A5E3FD8035703028C6E40D605026A64' +
'81AC2B04D4D80359428C286A5616B0A0AA5943849A6620AB07BF5' +
'D00B3E316FA');
Invalid_Screen := DTMFromString('78DA63CC64646028046224E06065CAC005A44' +
'1A2FF8180B10EC83A8BA2846141AB215C0D08301601597B50D59C' +
'5E6483AAA607C8DA8BAAE6D47267543556405628AA7B5E3FD883A' +
'A6602901543408D1A90F58601BF9ACB40D63BFC6A0070781CD0');
Update_Screen := DTMFromString('78DA634C64646070056224E06065CA6004A44' +
'1A2FF81805118C8924055F3FAC11E062EA81A10609405B2E409A8' +
'5105B26408A83124C21C907B1509A8590664E9E1570300FE73173' +
'8');

//Looks for Login and Lobby Screens
if(FindDTM(Login_Screen, x, y, 243, 107, 517, 418))or
(LobbyScreen)then
begin
//Looks for Login Screens, else at Lobby Screen
if(FindDTM(Login_Screen, x, y, 243, 107, 517, 418))then
begin
if(Players[0].Name = '')or(Players[0].Name = '')then
begin
Writeln('No username or Pass entered in setup');
Writeln('Waiting for you to log us in');
repeat
sleep(500+random(100));
until(LobbyScreen)or(IsChatBoxTextBetween('Welcome', clBlack, 4, 8))
if(IsChatBoxTextBetween('Welcome', clBlack, 4, 8))then Exit;
end else
begin
Writeln('We are at the login screen')
Mouse(x, y, 2, 2, true);
Sleep(500+random(100));
TypeSend(Players[0].Name);
Sleep(500 + random(100));
TypeSend(Players[0].Pass);
Sleep(500 + random(100));
end;
///////////////////////////////////////////
///////////////////////////////////////////
//Looks for Invalid User and Pass and Upadte page screens
if(FindDTM(Invalid_Screen, x, y, 243, 107, 517, 418))or
(FindDTM(Update_Screen, x, y, 234, 219, 517, 360))then
begin
//Looks for Invalid User and Pass
if(FindDTM(Invalid_Screen, x, y, 243, 107, 517, 418))then
begin
Writeln('We entered an invalid User or Pass, trying again');
Mouse(x, y, 6, 10, true);
Sleep(1000 + random(100));
Mouse(455, 180, 6, 10, true);
repeat
TypeByte(VK_BACK);
Sleep(50 + random(20));
until not(FindColorTolerance(x, y, 12378347, 279, 178, 284, 192, 10))
Sleep(500 + random(100));
Mouse(455, 226, 6, 10, true);
repeat
TypeByte(VK_BACK);
Sleep(50 + random(20));
until not(FindColorTolerance(x, y, 12378347,
279, 224, 284, 240, 10))
Auto_Login;
end else
//end else, runescape has updated
begin
Writeln('Runescape has been update');
Writeln('Terminating Script');
Load_DTMs('free');
TerminateScript;
end;
end;
///////////////////////////////////////////////
////////////////////////////////////////////////
repeat
Sleep(1001+random(100));
writeln('Waiting');
until(LobbyScreen)or(IsChatBoxTextBetween('Welcome', clBlack, 4, 8))
if(IsChatBoxTextBetween('Welcome', clBlack, 4, 8))then Exit;
if(LobbyScreen)then Auto_Login;
end else
begin
if(LobbyScreen)then
begin
Writeln('We are at the lobby screen');
Writeln('Logging In....');
Mouse(337, 455, 50, 10, true);
while not(IsChatBoxTextBetween('Welcome', clBlack, 4, 8)) do
sleep(500 + random(500));
end else
begin
Writeln('Something went wrong, not at Lobby. Retying');
Auto_Login;
end;
end;
end;
FreeDTM(Login_Screen);
FreeDTM(Invalid_Screen);
FreeDTM(Update_Screen);
end;


procedure PaintCross(x,y: integer);
var
CTPA: integer;
TP: Tpoint;
TPA: TPointArray;
begin
if(Paint_On = 'on')then
begin
SetLength(TPA, 104);
//Draw right
TP := Point(x, y);
for CTPA:= 0 to 9 do
begin
TPA[CTPA] := TP;
TP := point(TP.x + 1, TP.y);
end;
TP := Point(x, y - 1);
for CTPA := 10 to 17 do
begin
TPA[CTPA] := TP;
TP := point(TP.x + 1, TP.y);
end;
TP := Point(x,y+1);
for CTPA:= 18 to 25 do
begin
TPA[CTPA] := TP;
TP := point(TP.x + 1, TP.y);
end;
//Draw down
TP := Point(x, y);
for CTPA := 26 to 35 do
begin
TPA[CTPA] := TP;
TP := point(TP.x, TP.y + 1);
end;
TP := Point(x + 1, y);
for CTPA := 36 to 43 do
begin
TPA[CTPA] := TP;
TP := point(TP.x, TP.y + 1);
end;
TP := Point(x - 1, y);
for CTPA := 44 to 51 do
begin
TPA[CTPA] := TP;
TP := point(TP.x, TP.y + 1);
end;
//Draw left
TP := Point(x, y);
for CTPA := 52 to 61 do
begin
TPA[CTPA] := TP;
TP := point(TP.x - 1, TP.y);
end;
TP := Point(x, y + 1);
for CTPA := 62 to 69 do
begin
TPA[CTPA] := TP;
TP := point(TP.x - 1, TP.y);
end;
TP := Point(x, y - 1);
for CTPA := 70 to 77 do
begin
TPA[CTPA] := TP;
TP := point(TP.x - 1, TP.y);
end;
//Draw up
TP := Point(x, y);
for CTPA:= 78 to 87 do
begin
TPA[CTPA] := TP;
TP := point(TP.x, TP.y - 1);
end;
TP := Point(x + 1, y);
for CTPA := 88 to 95 do
begin
TPA[CTPA] := TP;
TP := point(TP.x, TP.y - 1);
end;
TP := Point(x - 1, y);
for CTPA:= 96 to 103 do
begin
TPA[CTPA] := TP;
TP := point(TP.x, TP.y - 1);
end;
SMART_DrawDotsEx(false, TPA, clRed);
end;
end;

procedure Setup_Hatchet;
begin
case Hatchet_Using of
'Dragon': Hatchet_Color := 1054834 ;
'Rune' : Hatchet_Color := 7761243;
'Addy' : Hatchet_Color := 5069133;
'Mith' : Hatchet_Color := 7227978;
'Black' : Hatchet_Color := 855310;
'Steel' : Hatchet_Color := 8487303;
'Iron' : Hatchet_Color := 5460823 ;
'Bronze': Hatchet_Color := 2441300;
end;
end;

procedure Check_for_text;
var
text,Captext,Lowertext,Alltext: TStringArray;
next: integer;
begin
text := ['hello', 'bot', 'sup', 'wcing', 'fire', 'fming',
'What', 'Wcing', 'you there', 'hay',
'lvl', 'level', '?', Players[0].Nick];

SetLength(Captext, high(text)+1);
SetLength(Lowertext, high(text)+1);
SetLength(Alltext, (high(text)+1) * 2);
for next := 0 to high(text) do
Captext[next] := Capitalize(text[next]);

for next := 0 to high(text) do
Lowertext[next] := Lowercase(text[next]);

Alltext := Captext + Lowertext;
for next := 0 to high(Alltext) do
begin
if(FindChatBoxText(Alltext[next], 8, clBlue))then
begin
Writeln('Text Found');
playsound(Choose_Sound);
ExamineInv;
Sleep(1000 + random(500));
ExamineInv;
Sleep(10000 + random(1000));
end;
end;
end;

procedure Check_Nest;
begin
count := 0;
repeat
if(FindDTM(nest, x, y, 685, 426, 736, 464))then
begin
Writeln('Nest found in last inv slot, moving it');
DragItem(28, Slot_Count);
Slot_Count := Slot_Count + 1;
count := count +1;
end;
until not(FindDTM(nest, x, y, 685, 426, 736, 464))or(count > 27)
if(count > 27)then
begin
Writeln('Could not move nest, shutting down');
Load_DTMs('free');
Logout;
TerminateScript;
end
end;

procedure Check_for_Nest;
begin
if(IsChatBoxTextBetween('nest', clRed, 8, 7))then
begin
Writeln('Found a Nest');
sleep(1000 + random(500));
//////
if(Paint_On = 'on')then
begin
if(FindColorsTolerance(Dots, 2306869, MSX1, MSY1, MSX2, MSY2, 10)) then
SMART_DrawDotsEx(false, Dots, clRed);
end;
if(FindObjTPA(x, y, 2306869, 8, -1, 10, 10, 5,
['ake B', 'Bird', 'nest', 'ke B']))then
begin
Total_Nests_Found := Total_Nests_Found + 1;
Do_Progress_Report;
Mouse(x, y, 0, 0, false);
WaitOption('ird', 500 + random(500));
Sleep(2000 + random(500));
Flag;
Sleep(100 + random(1000));
Check_nest;
ExamineInv;
Sleep(500 + random(100));
ExamineInv;
Sleep(500 + random(100));
ExamineInv;
end else
begin
Writeln('Found a Nest, but cannot seem to see it');
playsound(Choose_Sound);
Sleep(30000);
end;
end;
if(Paint_On = 'on')then
begin
SMART_ClearCanvas;
end;
end;

procedure Compass_Search;
var
Direction: integer;
begin
SetAngle(SRL_ANGLE_LOW);
count := 0;
repeat
MakeCompass(Direction);
Sleep(400 + random(100));
Direction := Direction + 10;
count := count + 1;
until(FindObj(x, y, 'Yew', 4159629, 35))or(count > 150)
if(count > 150)then
begin
Writeln('Could not find tree, shutting down');
Load_DTMs('free');
playsound(Choose_Sound);
Logout;
TerminateScript;
end;
Sleep(400 + random(100));
MMouse(x, y, 0, 0);
Sleep(400 + random(100));
if(IsUpTextMultiCustom(['Yew', 'down Yew', 'wn Ye', 'own Y']))then
begin
Mouse(x, y, 0, 0, true);
end;
MakeCompass('n');
end;

procedure Wait_till_Not_moving;
var
FoundColor, Wait_Time, ax, ay: integer;
begin
FoundColor := 0;
repeat
FindColorTolerance(x, y, Hatchet_Color, 211, 127, 300, 203, 20);
if(Paint_On = 'on')then
begin
SMART_DrawBoxEx(True, IntToBox(x-5, y-5, x+5, y+5), clWhite);
end;
Wait_Time := random(100);
case Wait_Time of
0..85:
begin
Sleep(100);
Check_for_Nest;
Check_for_text;
AntiRandoms;
end;
86..100:
begin
SleepAndMoveMouse(100);
Check_for_Nest;
Check_for_text;
AntiRandoms;
end;
end;
if(FindColorTolerance(ax, ay, Hatchet_Color, x-5, y-5, x+5, y+5, 20))then
begin
FoundColor := FoundColor + 1;
PaintCross(ax, ay);
end else FoundColor := 0;
until(FoundColor > 4)
Writeln('Stopped cutting, looking for another tree');
Sleep(random(500));
if(Paint_On = 'on')then
begin
SMART_ClearCanvas;
end;
end;

procedure Go_to_Trees;
var
Tree_Sysmbol1, Tree_Sysmbol2, Tree_Sysmbol3,
Tree_Sysmbol4, Tree_Sysmbol5: integer;
begin
Do_Progress_Report;
AntiRandoms;
if(FindObjDTM(WestLocator_TreeSpot, x, y, true))then
begin
Status('Going to trees');
Writeln('West Locator Spot Found');
Mouse(x - 1, y - 1, 2, 2, true);
Sleep(500 + random(100));
Flag;
Sleep(500 + random(100));
end else
begin
Writeln('West Locator not found, trying east');
if(FindObjDTM(EastLocator_TreeSpot, x, y, true))then
begin
Auto_Login;
Status('Going to trees');
Writeln('East locator Spot found');
Mouse(x - 1, y - 1, 2, 2, true);
Sleep(500 + random(100));
Flag;
Sleep(500 + random(100));
end else
begin
Writeln('East Locator not found, trying South');
if(FindObjDTM(SouthLocator_TreeSpot,x,y,true))then
begin
Auto_Login;
Writeln('South locator Spot found');
Mouse(x - 1, y - 1, 2, 2, true);
Sleep(500 + random(100));
Flag;
Sleep(500 + random(100));
end else
begin
Writeln('Did not find east or west or south locator');
Writeln('Trying with Tree symbol');
Auto_Login;
Tree_Sysmbol1 := DTMFromString('78DA632C666260086640013CBDEC0C72409A1' +
'188FF030123488D1F031A6064E087AA01F372806A4209A8019913' +
'43404D156173006CB108F5');
Tree_Sysmbol2 := DTMFromString('78DA63CC676260F06740012C79BC0C72409A1' +
'188FF0301632E508D37031A6064E087AA01F3F28950530454E343' +
'404D16613500431E0892');
Tree_Sysmbol3 := DTMFromString('78DA63CC666260086440012C79BC0C72409A1' +
'188FF03016306508D1F031A6064E087AA01F3D231CDC1AA269880' +
'1A905D61F8D500003F500890');
Tree_Sysmbol4 := DTMFromString('78DA63CC63626008634001D64ABC0C72409A1' +
'188FF03016316504D04031A6064E087AA01F372816A2209A8C927' +
'424D1161BB0049AC08B7');
Tree_Sysmbol5 := DTMFromString('78DA636C676260086540013CBDEC0C72409A1' +
'188FF03016327504D20031A6064E087AA01F3BA806A4288501346' +
'400DC8AE48FC6A009D710965');
if(FindDTM(Tree_Sysmbol1, x, y, MMX1, MMY1, MMX2, MMY2))or
(FindDTM(Tree_Sysmbol2, x, y, MMX1, MMY1, MMX2, MMY2))or
(FindDTM(Tree_Sysmbol3, x, y, MMX1, MMY1, MMX2, MMY2))or
(FindDTM(Tree_Sysmbol4, x, y, MMX1, MMY1, MMX2, MMY2))or
(FindDTM(Tree_Sysmbol5, x, y, MMX1, MMY1, MMX2, MMY2))then
begin
Writeln('South locator Spot found');
Mouse(x - 1, y - 1, 2, 2, true);
Sleep(500 + random(100));
Flag;
Sleep(500 + random(100));
FreeDTM(Tree_Sysmbol1);
FreeDTM(Tree_Sysmbol2);
FreeDTM(Tree_Sysmbol3);
FreeDTM(Tree_Sysmbol4);
FreeDTM(Tree_Sysmbol5);
end else
begin
Writeln('Did not find Tree symbol, shutting down');
playsound(Choose_Sound);
FreeDTM(Tree_Sysmbol1);
FreeDTM(Tree_Sysmbol2);
FreeDTM(Tree_Sysmbol3);
FreeDTM(Tree_Sysmbol4);
FreeDTM(Tree_Sysmbol5);
Load_DTMs('free');
Logout;
TerminateScript;
end;
end;
end;
end;
end;

function Count_logs:integer;
var
Num_of_logs: integer;
begin
Num_of_logs := CountItems('dtm', Log, []);
Result := Num_of_logs;
end;

procedure Cut_Trees;
var cc: integer;
begin
Feed_Pet;
Do_Progress_Report;
repeat
x := MMCX;
y := MMCY;
cc:= 0;
if(FindObj(x, y, 'Yew', 4159629, 35)) then
begin
MMouse(x - 10, y - 10, 20, 20);
Sleep(500 + random(100));
if not(IsUpTextMultiCustom(['Yew', 'wn Ye', 'n Yew', 'own Y']))then
begin
Cut_Trees;
end else
case cc + random(2) of
0: begin
Mouse(x, y, 0, 0, true);
Writeln('Found a tree to cut');
end;
1: begin
Mouse(x, y, 0, 0, true);
WaitOption('Chop', 1000 + random(500));
Writeln('Found a tree to cut');
end;
end;
Flag;
Sleep(500 + random(100));
Wait_till_Not_moving;
end else
begin
Writeln('Can not find a tree, moving to tree spot');
Auto_Login;
AntiRandoms;
Go_to_Trees;
if(FindObj(x, y, 'Yew', 4159629, 35))then
begin
Writeln('Found a tree');
Mouse(x, y, 0, 0, true);
Sleep(500 + random(500));
Flag;
Sleep(500 + random(100));
Wait_till_Not_moving;
end else
begin
Writeln('Can not find a tree, using Compass Search');
AntiRandoms;
Compass_Search;
Sleep(500 + random(500));
Flag;
Sleep(500 + random(100));
Wait_till_Not_moving;
end;
end;
until(FindDTM(log, x, y, 681, 427, 736, 464))
end;

procedure Go_to_fire_spot;
begin
Do_Progress_Report;
if(FindObjDTM(WestLocator_FireSpot,x,y,true))then
begin
//SMART_DrawDotsEx(False,WestLocator_FireSpot,clRed);
Writeln('Found west locator');
Mouse(x - 1, y - 1, 2, 2, true);
Sleep(500 + random(100));
Flag;
Sleep(500 + random(100));
end else
begin
Auto_Login;
Writeln('Did not find west locator, trying east');
AntiRandoms;
MakeCompass('s');
if(FindObjDTM(EastLocator_FireSpot, x, y, true))then
begin
//SMART_DrawDotsEx(False,EastLocator_FireSpot,clRed);
Writeln('Found east locator');
Mouse(x - 1, y - 1, 2, 2, true);
Sleep(500 + random(100));
Flag;
Sleep(500 + random(100));
end else
begin
MakeCompass('s');
Writeln('Did not find east or west locator, am I south?');
Auto_Login;
AntiRandoms;
if(FindObjDTM(SouthLocator_TreeSpot, x, y, true))then
begin
//SMART_DrawDotsEx(False,SouthLocator_TreeSpot,clRed);
Writeln('Found south locator');
Mouse(x - 1, y - 1, 2, 2,true);
Sleep(500 + random(100));
Flag;
Sleep(500 + random(100));
Tried := Tried + 1;
if(Tried < 2)then Go_to_fire_spot;
end else
begin
Writeln('Did not find east or west or south locator, shutting down');
Load_DTMs('free');
playsound(Choose_Sound);
Logout;
TerminateScript;
end;
end;
end;
Feed_Pet;
end;

procedure Light_Log;
begin
if(FindDTM(log, x, y, 549, 206, 736, 464))then
begin
Mouse(x - 5, y - 5, 10, 10, false);
WaitOption('Light', 1000 + random(100));
Sleep(1300 + random(100));
Check_for_text;
AntiRandoms;
end else Writeln('log not found');
end;

procedure Light_All_Logs;
var
first_fire: boolean;
begin
first_fire := true;
if(FindDTM(log, x, y, 549, 206, 736, 464))then
begin
count := 0;
repeat
Light_Log;
if(first_fire = true)then
begin
sleep(1050 + random(10));
first_fire := false;
end;
count := count +1;
until not(FindDTM(log, x, y, 549, 206, 736, 464))or
(FindChatBoxText('light', 8, clBlue))or
(count > 6)
if not(FindDTM(log, x, y, 549, 206, 736, 464))then
begin
sleep(1000 + random(500));
Exit;
end;
if(FindChatBoxText('light', 8, clBlue))then
begin
Writeln('Cannot light a log here');
Writeln('Moving down one square');
Mouse(255, 214, 4, 4, true);
sleep(200 + random(500));
ExamineInv;
sleep(500 + random(100));
ExamineInv;
sleep(500 + random(100));
Light_All_Logs;
end;
if(count > 6)then
begin
x := 475;
y := 218;
Writeln('Moving to next row');
Sleep(1800 + random(200));
if(FindColorSpiralTolerance(x, y, 2796282,
458, 143, 505, 219, 15))then
begin
Writeln('Found fire toward the east');
Mouse(508, y + 35, 4, 4, true);
Sleep(500 + random(100));
Flag;
Sleep(800 + random(100));
Light_All_Logs;
end else
begin
Writeln('Did not find Fire, trying anyways');
Mouse(498, 204, 4, 4, true);
Sleep(500 + random(100));
Flag;
Sleep(1000 + random(500));
Light_All_Logs;
end;
end;
end;
end;


procedure Main_Loop;
var
Subtract_logs: integer;
begin
Do_Progress_Report;
if(Count_logs > 0)then
begin
writeln('We have logs already in inv, correcting count');
Total_Log_Count := Total_Log_Count - Count_logs;
end;
Do_Progress_Report;
Go_to_Trees;
Cut_Trees;
Go_to_fire_spot;
Total_Log_Count := Total_Log_Count + Count_logs;
Do_Progress_Report
Total_Burn_Count := Total_Burn_Count + Count_logs;
Light_All_Logs;
Do_Progress_Report;
if(Count_logs > 0)then
begin
writeln('For some reason we didn not burn all the logs, correcting count');
Total_Burn_Count := Total_Burn_Count - Count_logs;
Do_Progress_Report;
end;
Auto_Login;
end;



begin
Smart_Server := 44;
SetupSRL();
ObjDTM_Setup;
DeclarePlayers;
while (not RSReady) do
SleepAndMoveMouse(100 + Random(500));
Load_DTMs('load');
Auto_Login;
Setup_Hatchet;
StartTime := GetSystemTime;
Loop_Count := 0;
Slot_Count := 1;
Total_Log_Count := 0;
Total_Burn_Count := 0;
Total_Nests_Found := 0;
Last_fed := GetSystemTime + 900000;
Paint_On := Lowercase(Turn_Paint_On);
MakeCompass('s');
SetAllChats('Filter', 'On', '', '', '', '', '');
repeat
Tried := 1;
Loop_Count := Loop_Count + 1;
Main_Loop;
CurrentTime := GetSystemTime;
Time_Ran_Sec := (CurrentTime - StartTime) /1000
if(Break_When / 60 >= Time_Ran_Sec)or
(Log_out / 60 >= Time_Ran_Sec)then
begin
if(Break_When * 60 >= Time_Ran_Sec)then
begin
Logout;
Break_Time := ((Break_for * 1000) * 60) + random(60000);
time := MsToTime((Break_Time),Time_Formal);
Writeln('Breaking for '+ (time));
Sleep(Break_Time);
Auto_Login;
end else
begin
Load_DTMs('free');
Logout;
TerminateScript;
end;
end;
until(false)
FreeDTM(Log);
end.

NOTE: I really like my procedure to know when not cutting anymore. Turn on paint to watch it in action.

bud_wis_er_420

2012-01-03 17:46:14

anyone have a chance to try it out yet?

supersain

2012-01-04 01:01:33

Thanks looks great. Did 2 loads with it. flawless

bud_wis_er_420

2012-01-04 01:12:52

:biggrin:Thank you for the kind words. :biggrin:

bud_wis_er_420

2012-01-10 03:42:35

Anybody else try it. Don't know if it's still working tho been so busy on my herblore script.

pierre

2012-01-10 03:46:29

Going to try it :D

edit:
Aw sry didn't see it was for members.

P1nky

2012-01-10 04:29:17

Well this is nice, I am releasing a similar script like this as well :).
Naice code buddy :).

bud_wis_er_420

2012-01-11 15:14:32

Thank you and it's gonna get better when I finish my herb script