Simba Code:
Program AshamanDoorer;
{$define SMART}
{$Define Crashsmart}
{$include srl/srl/misc/smart.simba}
{$i srl/srl.simba}
{$i SRL\SRL\misc\paintsmart.simba}
{$I SRL/SRL/Misc/Debug.simba}
{
AshamanDoorer v1.4
-Make sure you have a full load of Oak Planks on you
-Make sure you are ONLY USING DEMON BUTLER
-Make sure you have already told the demon butler to go get 26 planks
-Make sure you are standing in the right place. The Door recess in the furthest room you have in the cardinal direction you chose.
}
//Fill these in.
Const
SRLStats_Username = ''; // Leave blank if you don't have a stats account
SRLStats_Password = '';
Direction = 'N' ; // Set this to whatever direction your door is (like the picture)
OnScreen = True; // Set this to false if you don't want onscreen proggy (may increase speed)
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
End;
//////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// //
// Don't touch below this line unless you know what you're doing!! //
// //
//////////////////////////////////////////////////////////////////////////////////////////////////////
Const
A=237;
B=172; // No touchy
C=269;
D=202;
ScriptVersion = '1.4';
Var
DoorCount,XP,StartTime,StartingExperience,DoorsPH,XPH,Sec: Integer;
DButlerDTM,SpotDTM,MessCount,Count: Integer;
aFound: Extended;
Procedure SetDTM;
Begin
DButlerDTM := DTMFromString('mQwAAAHicY2ZgYNBkhGAtIJ4O5C8E4pVAbCLGz7B6yWKG8qIiBn4gH4YZkTAQAADyswY6');
SpotDTM := DTMFromString('mggAAAHicY2NgYChmYmBIAeIWKK4A4kIgDgHKJQFxAhCnAXE+FP///5/hGwMbBv4PlOPHghlxYAgAAI+fDm4=');
End;
Procedure Fr33DTM;
Begin
FreeDTM(DButlerDTM);
FreeDTM(SpotDTM);
End;
Function FindButler:Boolean;
Var
X,Y,T: Integer;
Begin
Result := False;
If MessCount > 20 Then
Begin
Writeln('Messed up somewhere, logging off');
Logout;
Fr33DTM;
Terminatescript;
End;
If(Not(LoggedIn)) Then
Exit;
If ((Not FindDTMRotated(DButlerDTM,X,Y,MSX1,MSY1,MSX2,MSY2,-Pi,Pi,Pi/30,aFound)) And (OptionsExist(['Exam','mine','Examine','Canc','ncel','Cancel'],False))) Then
Begin
MMouse(200,200,100,100);
End;
If FindDTMRotated(DButlerDTM,X,Y,235,170,275,223,-Pi,Pi,Pi/30,aFound) Or FindDTMRotated(DButlerDTM,X,Y,278,135,310,186,-Pi,Pi,Pi/30,aFound) Or FindDTMRotated(DButlerDTM,X,Y,189,125,239,174,-Pi,Pi,Pi/30,aFound) Then
Begin
Mouse(X,Y,4,4,False);
If WaitOptionMulti(['etch','from','bank'],RandomRange(700,900)) Then
Begin
MarkTime(T);
Repeat
Wait(Random(200));
Until ((FindNPCChatText('coins',Nothing)) Or (FindNPCChatText('nother', Nothing)) Or (TimeFromMark(T) > 8000));
If (FindNPCChatText('coins',Nothing)) Then
Begin
ClickContinue(True, True);
TypeSendEx('1',False);
Wait(RandomRange(800,1000));
Mouse(X,Y,4,4,False);
WaitOption('etch',RandomRange(700,900));
Wait(randomRange(900, 1100));
End;
If (FindNPCChatText('nother', Nothing)) Then
Begin
TypeSendEx('1',False);
Wait(RandomRange(500,700));
Count := 0;
Result := True;
End;
End;
End;
End;
Function FindEmpty:Boolean;
Var
X,Y,H,H2,I,CTS,T: Integer;
pArray: TPointArray;
aPArray: T2DPointArray;
Begin
Result := False;
If(Not(LoggedIn)) Then
Exit;
If Count >= 2 Then
Begin
MarkTime(T);
Repeat
Wait(100);
Until ((FindButler) Or (TimeFromMark(T) > 10000));
End;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.51, 0.02);
FindColorsSpiralTolerance(MSCX, MSCY, pArray, 7435639, A, B, C, D, 15);
aPArray := TPAtoATPAEx(pArray, 20, 20);
If (Length(aPArray) = 0) Then
Begin
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
MessCount := MessCount + 1;
End;
H := High(aPArray);
If H < 1 Then
H2 := H Else
H2 := 1;
For I := 0 To H2 Do
Begin
MiddleTPAEx(aPArray[I], X, Y);
MMouse(X, Y, 4, 4);
If (WaitUpTextMulti(['Wal','alk'],300)) Then
Begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,False);
If Count >= 1 Then
Begin
MarkTime(T);
Repeat
Wait(100);
Until (InvCount >10) Or (TimeFromMark(T)>5000);
If InvCount < 10 Then
Begin
MMouse(50,50,100,100);
FindButler;
Marktime(T);
Repeat
Wait(100);
Until ((InvCount > 10) or (TimeFromMark(T) > 30000))
End;
If InvCount < 10 Then
Begin
Writeln('Out of supplies. Goodbye!');
Logout;
Fr33DTM;
Terminatescript;
End;
End;
If WaitOptionMulti(['uild','Buil','oor'],RandomRange(700,900)) Then
Begin
Wait(RandomRange(300,400));
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Result := True;
Exit;
End;
End;
End;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
End;
{*******************************************************************************
Function PrintonSmart;
By: Shuttleu
Edited By: Ashaman88
Description: Will put progress report on screen.
*******************************************************************************
Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, E, 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], UpChars, H);
for E := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[E].x + 1, TTP[E].y + Numb + 1,131072);
FastSetPixel(Pic, TTP[E].x, TTP[E].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;
*******************************************************************************
Function ProgressReport;
By: Sin and parts by Shuttleu
Edited By: Ashaman88
Description: Will Make a progress report.
*******************************************************************************
Procedure ProgressReport;
Var
SmartLines: TStringArray;
Begin
Sec:= (1+((Getsystemtime-StartTime)/1000));
XP := (GetXPBarTotal - StartingExperience);
XPH := (3600 / SeC * (XP));
DoorsPH := (3600*DoorCount) / Sec;
If OnScreen Then
Begin
SetArrayLength(SmartLines, 9);
SmartLines[0]:= '==========================';
SmartLines[1]:= '=====AshamanDoorerV'+ScriptVersion+'=======';
SmartLines[2]:= 'Time Running: ' + TimeRunning;
SmartLines[3]:= 'Doors Made: ' + IntToStr(DoorCount);
SmartLines[4]:= 'Experience Earned: ' + IntToStr(XP);
SmartLines[5]:= 'Experience/Hour: ' + IntToStr(XPH);
SmartLines[6]:= 'Doors/H: ' + IntToStr(DoorsPH);
SmartLines[7]:= '===========================';
SmartLines[8]:= '===========================';
PrintOnSmart(SmartLines,Point(15,200),clRed);
End;
Writeln('===========================');
Writeln('=====AshamanDoorerV'+ScriptVersion+'=========');
Writeln('Time Running: ' + TimeRunning);
Writeln('Doors Made: ' + IntToStr(DoorCount));
Writeln('Experience Earned: ' + IntToStr(XP));
Writeln('Experience/Hour: ' + IntToStr(XPH));
Writeln('Doors/H: ' + IntToStr(DoorsPH));
Writeln('===========================');
Writeln('===========================');
Stats_IncVariable('Oak Doors (Constructed)', 1);
Stats_Commit;
End; }
Function FindBuild:Boolean;
Var
X,Y: Integer;
Begin
Result := False;
If(Not(LoggedIn)) then
Exit;
MouseBox(103,62,115,84,Mouse_Move);
GetMousePos(X,Y);
If WaitUpTextMulti(['uild','Oak','door','oor'],RandomRange(2000,2200)) Then
Begin
Mouse(X,Y,0,0,True);
If DidYellowClick Then
Begin
Mouse(629,61,4,4,True);
Wait(RandomRange(400,500));
Repeat
Wait(100);
Until (Not(Ismoving));
End Else
Begin
Count := Count + 1;
DoorCount := DoorCount + 1;
MessCount := 0;
Result:=True;
//ProgressReport;
MouseBox(A,B,C,D,Mouse_Move);
End;
End;
End;
Function FindDoor: Boolean;
Var
X,Y,H,H2,I,CTS1,T: Integer;
pArray2: TPointArray;
aPArray2: T2DPointArray;
Begin
Result := False;
If(Not(LoggedIn)) Then
Exit;
CTS1 := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.39);
FindColorsSpiralTolerance(MSCX, MSCY, pArray2, 4480367, A, B, C, D, 15);
aPArray2 := TPAtoATPAEx(pArray2, 20, 20);
If (Length(aPArray2) = 0) Then
Begin
ColorToleranceSpeed(CTS1);
SetColorSpeed2Modifiers(0.2, 0.2);
End;
H := High(aPArray2);
If H < 1 Then
H2 := H Else
H2 := 2;
For I := 0 To H Do
Begin
MiddleTPAEx(aPArray2[I], X, Y);
MMouse(X, Y, 4, 4);
If (WaitUpTextMulti(['Open','pen','Door','oor'],400)) Then
Begin
GetMousePos(X,Y);
Mouse(X,Y,0,0,False);
If WaitOption('emove',RandomRange(700,900)) Then
Begin
MarkTime(T);
Repeat
Wait(Random(200));
If (TimeFromMark(T) > 4000) Then
Begin
FindDoor;
Exit;
End;
Until (FindNPCChatText('Yes',Nothing));
TypeSendEx('1',False);
If Count < 2 Then
MouseBox(A,B,C,D,Mouse_Move);
ColorToleranceSpeed(CTS1);
SetColorSpeed2Modifiers(0.2, 0.2);
Result := True;
Exit;
End;
End;
End;
ColorToleranceSpeed(CTS1);
SetColorSpeed2Modifiers(0.2, 0.2);
End;
procedure XPGainCheck;
var
ConSkillDTM, x, y, t:integer;
begin
ConSkillDTM:= DTMFromString('mQwAAAHicY2ZgYIhjgIBTQMwNxLOg/D9//zAkRocw3LlzB8w3gmJGIGaCYiAAAExkCNM=');
t := GetSystemTime;
repeat
if FindDTMRotated(ConSkillDTM,x,y,MSX1,MSY1,MSX2,MSY2,Radians(-5),Radians(5),Radians(1),aFound) then
writeln('We found that mother fucker!');
if not(FindDTMRotated(ConSkillDTM,x,y,MSX1,MSY1,MSX2,MSY2,Radians(-5),Radians(5),Radians(1),aFound)) then
begin
WriteLn('No Xp Gained for some minutes, Terminating Script')
FreeDTM(ConSkillDTM);
TerminateScript;
end;
Wait(100);
until False;
end;
Procedure MainLoop;
Begin
If WaitFunc(@FindEmpty,100,3000) Then
Begin
If WaitFunc(@FindBuild,100,7000) Then
WaitFunc(@FindDoor,100,5000) Else
XPGainCheck;
FindDoor;
End Else
If FindBuild Then
WaitFunc(@FindDoor,100,5000) Else
FindDoor;
End;
Procedure Setup;
Begin
Smart_Server := 10;
Smart_Members := True;
Smart_Signed := True;
SetupSRL;
If (SRLStats_Username = '') Then
SetupSRLStats(948, 'Anonymous', 'anon1337')
Else
SetupSRLStats(948, SRLStats_Username, SRLStats_Password);
SmartSetRefresh(75);
ClearDebug;
SMART_ClearMS;
SMART_ClearCanvas;
DeclarePlayers;
AddOnTerminate('Fr33DTM');
SetDTM;
If (Not LoggedIn) Then
Writeln('Please log in and setup the position as needed');
Repeat
Wait(randomRange(500,1500));
Until (LoggedIn);
If InvCount < 28 Then
Repeat
Writeln('Please get a full inventory of planks');
Wait(RandomRange(3000,4000));
Until (InvCount = 28);
MakeCompass(Direction);
SetAngle(SRL_ANGLE_HIGH);
ToggleXPBar(True);
StartingExperience := GetXPBarTotal;
StartTime:=GetSystemTime;
End;
Begin
Setup;
FindButler;
//XPGainCheck;
Repeat
Mainloop;
Until (AllPlayersInactive);
Fr33DTM;
End.