Simba Code:
program ChaosMossKillerTempFixMat;
{$DEFINE SMART}
{$include_once SRL/SRL.simba}
{$include_once SPS/SPS.simba}
{$include_once SRL/SRL/Misc/Debug.simba}
{$include_once SRL/SRL/core/animation.simba}
{$include_once SRL/SRL/skill/magic.simba}
{$IFDEF SIMBAMAJOR980}
{$I SRL/SRL/Misc/PaintSmart.Simba} {$ELSE}
{$I SRL/SRL/Misc/SmartGraphics.Simba}
{$ENDIF}
const
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//========================ChaosMossKiller by hunt3rx3=======================v6.0
//READ THESE CAREFULLY!===================================================19 May
//*YOU MUST SET UP XP COUNTER FOR TRAINED LEVEL, OTHERWISE SCRIPT WONT WORK!====
//*FOOD:========================================================================
// -ONLY EATS LOBSTERS AND PEACHES=============================================
// -DONT USE B2P WITH BONECRUSHER! COMMON SENSE================================
//*CHARM LOOTING:===============================================================
// -WILL PICK UP CHARMS WHAT YOU CAN SEE WITH YOUR EYES!=======================
// -WONT RIGHT CLICK ALL THE LOOT PILES!=======================================
// -HAVE 1+ OF EACH AT START!==================================================
//*SPECIAL ATTACKS:=============================================================
// -ONLY PRIMARY WORN WEAPONS, WONT SWITCH WEAPONS!============================
// -KORASI NOT SUPPORTED! WOULD MESS UP THE SCRIPT!============================
//==============================================================================
SRLStats_User = ''; // Your SRL Stats ID (If you dont have one then just leave it as it is)
SRLStats_Password = ''; // Your SRL Stats Password (If you dont have one then just leave it as it is)
Username = '';
Password = '';
TrainedSkill = 'Strength'; // Attack, Strength, Defence, Range
XPCounter = 2; // 1,2,3
EatAt = 700; // 100-999
BonesToPeaches = True;
PickUpCharms = True;
UseSpecAttacks = False; // Only worn weapons. Not supported: Korasi.
SpecUsage = 55; // Spec usage of worn weapon. Supported: 25, 50, 55, 60, 100
PaintStatus = True; // set Private Chat off for this
PaintDebug = True;
TakeScreenShots = True; // (~100 kb jpeg, wont eat memory)
ScreenShotsPath = 'C:\Simba\Screenshots\ChaosMossKiller\';
DebugWindow = False;
DebugLines = False;
//==============================================================================
//===========UPDATES: [url]http://villavu.com/forum/showthread.php?t=74029===========[/url]
//==============================================================================
//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Version = 'v6.0';
var
X, Y: Integer;
StartTime, StartXp, StartXPtillNext, TrainedLevel, HpLevel : Integer;
WorldHops, B2PUsed, FoodUsed, GoldCharms, GreenCharms, BlueCharms, CrimsonCharms : Integer;
SpecWait, SpecTime, SpecNumber : Integer;
LastXP : Extended;
LevelString : String;
doreport, b2p : Boolean;
procedure DeclarePlayers;
begin
NumberOfPlayers(1);
CurrentPlayer := 0;
with Players[0] do
begin
Name := UserName;
Pass := Password;
Active := True;
end;
end;
procedure MakeScreenShot(const FilePath : String); //example: 'C:\Simba\Screenshots\ChaosMossKiller\levelups'
var
fileName : String;
Year, Month, Day : Word;
i : Integer;
begin
if TakeScreenShots then
begin
if not DirectoryExists(ScreenShotsPath) then
CreateDirectory(ScreenShotsPath);
if not DirectoryExists(FilePath) then
CreateDirectory(FilePath);
DecodeDate(Date,Year,Month,Day);
i := 0;
repeat
i := i+1;
FileName := ToStr(Year) + '-' + ToStr(Month) + '-' + ToStr(Day) + ' (' + IntToStr(i) + ').jpg';
until not FileExists(FilePath + FileName)
SaveScreenShot(FilePath + FileName); //example: 2012-3-21 (1).jpg
end;
end;
procedure OpenDebugWindow(TPA: TPointArray; ATPA: array Of TPointArray; PaintBox: Boolean; Box: TBox); //box is for the dying Moss giant
var
BMP, x,y, i, Color : Integer;
TPABox: TBox;
begin
BMP := BitmapFromClient(0,0,MSX2,MSY2); //making a bitmap, adding the mainscreen image to it
DrawTPABitmap(BMP,TPA,clRed); //adding TPA to the bitmap
for i := 0 to high(ATPA) do
begin
if i = 0 then
Color := clYellow
else
Color := clBlack;
TPABox := getTPABounds(ATPA[i]); //getting the box of the TPA
for x := TPABox.x1 to TPABox.x2 do
begin
FastSetPixel(BMP, x, TPABox.y1, Color) //drawing lines
FastSetPixel(BMP, x, TPABox.y2, Color) //drawing lines
end;
for y := TPABox.y1 to TPABox.y2 do
begin
FastSetPixel(BMP, TPABox.x1, y, Color) //drawing lines
FastSetPixel(BMP, TPABox.x2, y, Color) //drawing lines
end;
end;
if PaintBox then //this is for the dying Moss giant
begin
for x := Box.x1 to Box.x2 do
begin
FastSetPixel(BMP, x, Box.y1, ClRed) //drawing lines
FastSetPixel(BMP, x, Box.y2, ClRed) //drawing lines
end;
for y := Box.y1 to Box.y2 do
begin
FastSetPixel(BMP, Box.x1, y, ClRed) //drawing lines
FastSetPixel(BMP, Box.x2, y, ClRed) //drawing lines
end;
end;
DebugBitmap(BMP);
FreeBitmap(BMP);
end;
function CurrentTime: string; //function for time, example [17:53:59]
var
Hour, Mins, Sec, MSec: Word;
begin
DecodeTime(Now, Hour, Mins, Sec, MSec);
Result := ('['+Padz(IntToStr(Hour), 2) + ':' + Padz(IntToStr(Mins), 2) + ':' + Padz(IntToStr(Sec), 2)+'] ');
end;
procedure EndScript(Reason : String); //function for ending, message box will pop up
begin
MakeScreenShot(ScreenShotsPath + 'stops\');
Disguise('Stopped');
Writeln(CurrentTime + Reason);
MessageBox(CurrentTime + Reason,'ChaosMossKiller Temp Fix By Mat',0); //message box as warning
TerminateScript;
end;
procedure StatusWithPaint(What : String); //Painting status on SMART
begin
Status(What);
if PaintStatus then
begin
SMART_ClearCanvasArea(IntToBox(MSX1,320,MSX2,343));
SMART_DrawTextEx(False,8,322,SmallChars,What,ClWhite); //drawing the text
end;
end;
procedure Report;
var
XP, XPHour, PrayXP, XPtillNext, TimeRun : Extended; //i have no clue why, but integer with Round() wont work
done : Boolean;
fails : Integer;
begin
if not DoReport then Exit;
fails := 0;
done := True;
repeat //reading XPCounter for xp gained
if (fails = 5) then
begin
Writeln(CurrentTime+'Failed to read XPBar. Turning off Reports.');
DoReport := False;
Exit;
end;
XP := GetXPBar(XPCounter)-StartXP;
if (XP + StartXP = -1) then //if fails to read xpbar it gives -1
begin
done := False;
fails := fails+1;
end;
until done
TimeRun := TimeFromMark(StartTime);
PrayXP := Round(XP / 240 * 15);
XPHour := Round(XP * (3600000 / TimeRun));
XPtillNext := StartXPtillNext - XP + LastXP; //LastXP = 0 untill we get a levelup
if (XPtillNext < 0) then //levelup check
begin
fails := 0;
done := True;
repeat //getting new level and xp till next
if (fails = 5) then
begin
Writeln(CurrentTime + 'Failed to get level/XPs. Turning off Reporting.');
DoReport := False;
Exit;
end;
TrainedLevel := GetSkillLevel(TrainedSkill);
if (TrainedLevel = -1) then //if fails to get level it gives -1
begin
done := False;
fails := fails+1;
end;
StartXPtillNext := XPTillNextLevel(TrainedSkill);
if (StartXPtillNext = -1) then //if fails to read xp it gives -1
begin
done := False;
fails := fails+1;
end;
until done
XPtillNext := StartXPtillNext;
LastXP := Round(XP); //we store the 'xp gained till now' (round is needed cause extended and integer)
MakeScreenShot(ScreenShotsPath + 'levelups\'); //this will make a screenshot of our levelup:)
Wait(RandomRange(3000,5000));
end;
ClearDebug;
Disguise('ChaosMossKiller [' + FloatToStr(XPHour) + ']');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
WriteLn(' ChaosMossKiller ' + Version);
WriteLn(' * Time Running: ' + MsToTime(Round(TimeRun),Time_Formal));
WriteLn(' * ' + LevelString + ' XP Gained: ' + FloatToStr(XP) + ' (' + FloatToStr(XPHour) + ')');
Writeln(' * ' + LevelString + ' Level: ' + IntToStr(TrainedLevel) + ', XP till next: ' + FloatToStr(XPtillNext));
Writeln(' * B2P: ' + IntToStr(B2PUsed) + ' Food: ' + IntToStr(FoodUsed))
if PickUpCharms then
Writeln(' * Charms: ' + IntToStr(GoldCharms) + '/' + IntToStr(GreenCharms) + '/' + IntToStr(BlueCharms) + '/' + IntToStr(CrimsonCharms))
else
Writeln(' * Not picking up charms.');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
end;
procedure Antiban; //basic antibans
begin
case Random(2400) of
1..2:
begin
StatusWithPaint('Checking trained level.');
TrainedLevel := GetSkillLevel(TrainedSkill);
HoverSkill(TrainedSkill,false);
Wait(RandomRange(1000,3000));
GameTab(tab_Inv);
StatusWithPaint('Back to fighting.');
end;
3..4:
begin
StatusWithPaint('Checking hp level.');
TrainedLevel := GetSkillLevel(TrainedSkill);
HoverSkill(SKILL_HITPOINTS,false);
Wait(RandomRange(1000,3000));
GameTab(tab_Inv);
StatusWithPaint('Back to fighting.');
end;
5..6:
begin
StatusWithPaint('Checking random level.');
TrainedLevel := GetSkillLevel(TrainedSkill);
HoverSkill('random',false);
Wait(RandomRange(1000,3000));
GameTab(tab_Inv);
StatusWithPaint('Back to fighting.');
end;
7..8: PickUpMouse;
9..14: CompassMovement(-180,180,false);
180..460: SleepAndMoveMouse(RandomRange(300,1200));
end;
end;
function BreakB2P : Boolean;
var
TabDTM : Integer;
fails : Integer;
done : Boolean;
begin
TabDTM := DTMFromString('78DA633CC4C4C070899101194CEEED65F802148289326E03AA398BAA868181894184014DCD0D026AF602D53C20A0E614116A2E01D55C2742CD79FC6A00BDB80E80');
if not (GetCurrentTab = tab_Inv) then
GameTab(tab_Inv);
Wait(RandomRange(200,400));
fails := 0;
done := False;
repeat
if FindDTM(TabDTM,X,Y,MIX1,MIY1,MIX2,MIY2) then
begin
Mouse(X,Y,5,5,mouse_left); //clickig on B2P tab
Inc(B2PUsed);
Wait(RandomRange(6000,8000)); //it takes long to break it
Result := True;
done := True;
end else
begin
if not (GetCurrentTab = tab_Inv) then //sometimes it fails to switch tabs for the first time
GameTab(tab_Inv);
fails := fails+1;
end;
if (fails = 5) then //trying to find DTM 5 times max
begin
Result := False;
done := True;
end;
until done
FreeDTM(TabDTM);
end;
function EatFood(var foodDTMString : String): boolean;
var
FoodDTM, EatTime, CurrentHP, fails : Integer;
done : Boolean;
colorstring : String; //this is for a return value, not using it
begin
FoodDTM := DTMFromString(foodDTMString);
if not (GetCurrentTab = tab_Inv) then
GameTab(tab_Inv);
Wait(RandomRange(200,400));
fails := 0;
done := False;
repeat
if FindDTM(FoodDTM,X,Y,MIX1,MIY1,MIX2,MIY2) then
begin
CurrentHP := GetMMLevels('hp', colorstring);
MarkTime(eatTime);
repeat
MultiMouse(X,Y,80,2,true);
Wait(RandomRange(400,800));
if ( GetMMLevels('hp', colorstring) > (CurrentHP + 30) ) then //checking if HP is increased
begin
Inc(FoodUsed);
done := True;
Result := True;
end;
if (TimeFromMark(eatTime) > 10000) then
begin
Result := False;
done := True;
end;
until done
end
else
begin
if not (GetCurrentTab = tab_Inv) then //sometimes it fails to switch tabs for the first time
GameTab(tab_Inv);
fails := fails+1;
Wait(500);
end;
if (fails = 5) then //trying to find DTM max 5 times
begin
Result := False;
done := True;
end;
until done
FreeDTM(FoodDTM);
end;
function ChooseOptionCharms(What : String) : Boolean; //modified SRL function, this will loot charms if possible
var
B: TBox;
i, H, x: Integer;
T: TPoint;
Options: Array of TOptions;
begin
Result := False;
Options := GetChooseOptions('action');
if (Length(Options) < 1) then
Exit;
H := High(Options);
for i := 0 to H do
begin
if PickUpCharms then //if charms looting is enabled
begin
if Pos('ake Gold', Options[i].Str) > 0 Then
begin
StatusWithPaint('Found a Gold charm!');
Inc(GoldCharms);
Report;
Result := True;
B := Options[i].Bounds;
GetMousePos(T.x, T.y);
if PointInBox(T, B) then
ClickMouse2(true)
else
MouseBoxEx(B.x1 + 5, B.Y1, B.x2 - 5, B.Y1 + 5,5, 1);
Exit;
end;
if Pos('ake Green', Options[i].Str) > 0 Then
begin
StatusWithPaint('Found a Green charm!');
Inc(GreenCharms);
Report;
Result := True;
B := Options[i].Bounds;
GetMousePos(T.x, T.y);
if PointInBox(T, B) then
ClickMouse2(true)
else
MouseBoxEx(B.x1 + 5, B.Y1, B.x2 - 5, B.Y1 + 5,5, 1);
Exit;
end;
if Pos('ake Blue', Options[i].Str) > 0 Then
begin
StatusWithPaint('Found a Blue charm!');
Inc(BlueCharms);
Report;
Result := True;
B := Options[i].Bounds;
GetMousePos(T.x, T.y);
if PointInBox(T, B) then
ClickMouse2(true)
else
MouseBoxEx(B.x1 + 5, B.Y1, B.x2 - 5, B.Y1 + 5,5, 1);
Exit;
end;
if Pos('ake Crims', Options[i].Str) > 0 Then
begin
StatusWithPaint('Found a Crimson charm!');
Report;
Inc(CrimsonCharms);
Result := True;
B := Options[i].Bounds;
GetMousePos(T.x, T.y);
if PointInBox(T, B) then
ClickMouse2(true)
else
MouseBoxEx(B.x1 + 5, B.Y1, B.x2 - 5, B.Y1 + 5,5, 1);
Exit;
end;
end;
if Pos(What, Options[i].Str) > 0 Then //this will check for 'attack' or 'take bones' (nowhere else using ChooseOptionCharms)
begin
Result := True;
B := Options[i].Bounds;
GetMousePos(T.x, T.y);
if PointInBox(T, B) then
ClickMouse2(true)
else
MouseBoxEx(B.x1 + 5, B.Y1, B.x2 - 5, B.Y1 + 5,5, 1);
Exit;
end;
end;
B := Options[0].BigBox; //to mmouse away
x := Max(B.X1 - 52, 0);
if x = 0 then
x := B.X2+10;
MMouse(x, Max(B.Y1 - 50, 0), 40, B.Y2-B.Y1);
Wait(200 + Random(100));
end;
function FindMoss(ClickOnIt: Boolean) : Boolean; //returns true only if clicked on a Moss giant
var
RedX, RedY, ExcX, ExcY, i, MinPoints, DetectTime, UptextTime, RedHpBarDTMTime, RedHpBarDTM : Integer;
TPA, MossTPA : TPointArray;
ATPA : Array of TPointArray;
MossColors, Tolerances : Array of Integer;
ExcludeNearRedHpBar : Boolean;
begin
Result := False;
MarkTime(DetectTime);
//6257521 (8) portal szÃne, tökéletes
//2173227 (5) nincs már sötét fal (eddig 7 jó volt)
//2372406 (8) nincs már (12 volt) nagyon kicsi barna fából
//2309694 (7) nincs nagyon nagyon kicsi barna fából
//3303025 (14) sárgásbarna, tökéletes
//4482405 (13)
MossColors := [6257521, 2173227, 2372406, 2309694, 3303025, 4482405];
Tolerances := [8, 5, 8, 7, 15, 13];
MinPoints := 200;
for i:=0 to High(MossColors) do
begin
FindColorsTolerance(MossTPA,MossColors[i],MSX1,MSY1,MSX2,MSY2,Tolerances[i]);
AppendTPA(TPA,MossTPA);
end;
ExcludeNearRedHpBar := False;
RedHpBarDTM := DTMFromString('mWAAAAHicY2FgYNgCxOeh+AIQRwFxOBDHQtk7GTgYrNmZ4FgEKIaMGdEwCAAAoEoGcA==');
if WaitFindDTMex(RedHpBarDTM,X,Y,MSX1,MSY1,MSX2,MSY2,10,100) then //if found redbar then we will exclude points around it
begin
ExcludeNearRedHpBar := True;
RedX := X;
RedY := Y+50;
ExcX := 35;
ExcY := 60;
end;
FreeDTM(RedHpBarDTM);
if (High(TPA)> 0) then
begin
if ExcludeNearRedHpBar then //excluding near RedHpBar
begin
SortTPAFrom(TPA,Point(redX,redY));
InvertTPA(TPA);
for i:=0 to High(TPA) do
if (Abs(TPA[i].x - RedX) < ExcX) and (Abs(TPA[i].y - RedY) < ExcY) then
Break;
SetArrayLength(TPA,i);
end;
SortTPAFrom(TPA,Point(MSCX,MSCY)); //excluding points near middle
InvertTPA(TPA);
for i:=0 to High(TPA) do
if (Abs(TPA[i].x - MSCX) < 25) and (Abs(TPA[i].y - MSCY) < 25) then
Break;
SetArrayLength(TPA,i);
ATPA := SplitTPA(TPA,10); //splitting TPAs
SortATPASize(ATPA,True); //excluding TPAs with less than MinPoints points
for i:=0 to High(ATPA) do
begin
if High(ATPA[i]) < MinPoints then
Break;
end;
if i = 0 then Inc(i);
SetArrayLength(ATPA,i);
SortATPAFromFirstPoint(ATPA,Point(MSCX,MSCY)); //making the closest TPA the first in the array
if DebugWindow then //DebugWindow
OpenDebugWindow(TPA,ATPA,true,IntToBox(RedX-ExcX,RedY-ExcY,RedX+ExcX,RedY+ExcY));
if High(ATPA[0]) < MinPoints then //to avoid errors
Exit;
if ClickOnIt then
begin
if MiddleTPAEx(ATPA[0],X,Y) then //getting the middle point of the TPA, moving mouse there then looking for uptext
begin
MMouse(X,Y,0,0);
MarkTime(UptextTime);
if WaitUpText('ttack',200) then
begin
if DebugLines then //DebugLines
Writeln('Found Moss in ' + IntToStr(TimeFromMark(DetectTime)) + ' ms. Uptext was ' + IntToStr(TimeFromMark(UptextTime)) + ' ms.');
case Random(6) of //random left or rigth click (5:1)
0..4:
begin
ClickMouse2(mouse_left);
if DidRedClick then
Result := True; //returns true = clicked on moss
Exit;
end;
5:
begin
ClickMouse2(mouse_right);
if ChooseOption('ttack') then
Result := True; //returns true = clicked on moss
Exit;
end;
end;
end else
if DebugLines then //DebugLines
Writeln('Found Moss in ' + IntToStr(TimeFromMark(DetectTime)) + ' ms, but failed to find UpText.');
end;
end; //PaintDebug: clearing the drawings on SMART
end;
end;
function FindBones(X1,X2,X3,X4: Integer) : Boolean; //returns true if uptext is 'Take'
var
TPA : TPointArray;
ATPA : Array of TPointArray;
i : Integer;
MinPoints, xmid, ymid : Integer;
begin
MinPoints := 50;
FindColorsTolerance(TPA,11975103,X1,X2,X3,X4,25);
SortTPAFrom(TPA,Point(MSCX,MSCY)); //excluding points near middle
InvertTPA(TPA);
for i:=0 to High(TPA) do
if (Abs(TPA[i].x - MSCX) < 20) and (Abs(TPA[i].y - MSCY) < 25) then
Break;
SetArrayLength(TPA,i);
if (High(TPA)> 0) then
begin
ATPA := SplitTPA(TPA,10); //splitting the TPA
SortATPASize(ATPA,True); //excluding TPAs with less than MinPoints points
for i:=0 to High(ATPA) do
begin
if High(ATPA[i]) < MinPoints then
Break;
end;
if i = 0 then Inc(i);
SetArrayLength(ATPA,i);
if DebugWindow then //DebugWindow
OpenDebugWindow(TPA,ATPA,false,IntToBox(0,0,0,0));
if (High(ATPA[0]) < MinPoints) then //to avoid errors
Exit;
if MiddleTPAEx(ATPA[0],xmid,ymid) then //getting the middle point of the TPA, moving mouse there then looking for uptext
begin
MMouse(xmid,ymid,0,0);
Wait(100);
if IsUpTextEx('ake') then
begin
Result := True; //returning true
GetMousePos(X,Y);
Exit;
end;
end;
end;
Result := False;
end;
function FindCharm(Which: String; Colors, Tolerances: TIntegerArray; MinPoints: Integer) : Boolean; //returns true if uptext is 'Take'
var
TPA, CharmTPA : TPointArray;
ATPA : Array of TPointArray;
i : Integer;
xmid, ymid : Integer;
begin
for i:=0 to High(Colors) do
begin
FindColorsTolerance(CharmTPA,Colors[i],MSX1,MSY1,MSX2,MSY2,Tolerances[i]);
if DebugLines then //DebugLines
if (High(CharmTPA) > 0) then
Writeln('[Charms] Found ' + IntToStr(High(CharmTPA)) + ' pixels for Color: ' +IntToStr(Colors[i]) + '. Tolerance is: ' + IntToStr(Tolerances[i]));
AppendTPA(TPA,CharmTPA);
end;
SortTPAFrom(TPA,Point(MSCX,MSCY)); //excluding poinst near middle
InvertTPA(TPA);
for i:=0 to High(TPA) do
if (Abs(TPA[i].x - MSCX) < 30) and (Abs(TPA[i].y - MSCY) < 30) then
Break;
SetArrayLength(TPA,i);
if (High(TPA)> 0) then
begin
ATPA := SplitTPA(TPA,15); //splitting the TPA
SortATPASize(ATPA,True);
if High(ATPA[0]) < MinPoints then //getting only the biggest TPA (it everything is fine, this function wont find any extra pixels)
Exit;
if DebugWindow then //DebugWindow
OpenDebugWindow(TPA,ATPA,false,IntToBox(0,0,0,0));
if MiddleTPAEx(ATPA[0],xmid,ymid) then //getting the middle of the TPA, moving mouse there then looking for uptext
begin
MMouse(xmid,ymid,0,0);
Wait(100);
if PaintDebug then
SMART_ClearCanvasArea(IntToBox(MSX1,MSY1,MSX2,MSY2));
if IsUpTextEx('ake') then
begin
Result := True; //returning true
GetMousePos(X,Y);
Exit;
end;
end;
end;
Result := False;
end;
procedure FindAllCharms; //this will call the FindCharm() for all the charms with the given parameters
var
Colors, Tolerances : Array of Integer;
begin
if PickUpCharms then //if charms enabled
begin
StatusWithPaint('Looking for charms.');
Colors := [5804446,5935011,5344659,5735582,5472916];
Tolerances := [10,10,10,10,10];
if FindCharm('Gold',Colors,Tolerances,1) then
begin
Mouse(X,Y,0,0,mouse_right);
if ChooseOption('ake Gold') then
begin
StatusWithPaint('Picking up gold charm.');
Inc(GoldCharms);
Report;
Wait(1000);
repeat until not IsMoving
Wait(500);
end;
end;
Colors := [5010263,6982265,5471587,5730659];
Tolerances := [10,5,5,4];
if FindCharm('Green',Colors,Tolerances,1) then
begin
Mouse(X,Y,0,0,mouse_right);
if ChooseOption('ake Green') then
begin
StatusWithPaint('Picking up green charm.');
Inc(GreenCharms);
Report;
Wait(1000);
repeat until not IsMoving
Wait(500);
end;
end;
Colors := [6183977,8552249];
Tolerances := [10,10];
if FindCharm('Blue',Colors,Tolerances,1) then
begin
Mouse(X,Y,0,0,mouse_right);
if ChooseOption('ake Blue') then
begin
StatusWithPaint('Picking up blue charm.');
Inc(BlueCharms);
Report;
Wait(1000);
repeat until not IsMoving
Wait(500);
end;
end;
Colors := [3295859,2567297,3290481];
Tolerances := [8,8,10];
if FindCharm('Crimson',Colors,Tolerances,1) then
begin
Mouse(X,Y,0,0,mouse_right);
if ChooseOption('ake Crims') then
begin
StatusWithPaint('Picking up crimson charm.');
Inc(CrimsonCharms);
Report;
Wait(1000);
repeat until not IsMoving
Wait(500);
end;
end;
end;
end;
function WaitInFight(Timeout: Integer) : Boolean; //waits until Timeout or till we get into a fight (will return true in this case)
var
X,Y,XP1,XP2,ShieldDTM,Time : Integer;
begin
XP1 := GetXPBar(XPCounter);
MarkTime(Time);
ShieldDTM := DTMFromString('mQwAAAHicY2ZgYGBlYWAQAmIOIJZmZGCQAmJ1IGax9mT4+/cvA9eCJwxcQHUwzIiEgQAAxXEFvA==');
repeat
XP2 := GetXPBar(XPCounter);
if (XP2 > XP1) then
begin
if DebugLines then
Writeln('XP is increased, we are fighting.');
if PaintDebug then
begin
SMART_DrawBoxEx(true,false,IntToBox(524,54,543,73),ClYellow);
Wait(100);
SMART_ClearCanvasArea(IntToBox(520,50,547,77));
end;
Result := True;
FreeDTM(ShieldDTM);
Exit;
end;
if (TimeFromMark(Time) > 3000) and FindDTM(ShieldDTM,X,Y,MSX1,MSY1,MSX2,MSY2) then //if xp is increased or shield dtm found (3000 seconds is for not the detect the blue shield of the previous fight)
begin
if DebugLines then
Writeln('Blue shield found, we are fighting.');
Result := True;
FreeDTM(ShieldDTM);
Exit;
end;
until (TimeFromMark(Time) > Timeout)
FreeDTM(ShieldDTM);
Result := False;
end;
function FindRedBar : Boolean;
var
X,Y,RedBarDTM : Integer;
begin
Result := False;
RedBarDTM := DTMFromString('mlwAAAHicY2dgYDBnZmCQBWIZKB0ExQpA3AiUr2OA0C1QDOPvZOBgsGZnwsBdDIwM+AAjHgwFAAvPB5w=');
if FindDTM(RedBarDTM,X,Y,MSX1,MSY1,MSX2,MSY2) then
begin
if DebugLines then
Writeln('Found redbar, we killed it.');
if PaintDebug then
begin
SMART_DrawBoxEx(true,false,IntToBox(X-30,Y-10,X+30,Y+10),ClYellow); //drawing box around the redbar
Wait(100);
SMART_ClearCanvasArea(IntToBox(MSX1,MSY1,MSX2,MSY2));
end;
Result := True;
end;
FreeDTM(RedBarDTM);
end;
procedure HopWorld;
var
FailTime : Integer;
begin
StatusWithPaint('Hopping.');
Inc(WorldHops);
MarkTime(FailTime);
repeat
ExitToLobby;
if TimeFromMark(FailTime) > 30000 then //sometimes RS crashes when going to lobby (black screen)
EndScript('Failed to exit to lobby when hopping.');
until LobbyScreen;
OpenWorldScreen;
SelectWorld(RandomWorld(true,false)); //member world, not pvp
MarkTime(FailTime);
repeat
LoginPlayer;
if TimeFromMark(FailTime) > 60000 then //sometimes RS crashes at login (black screen)
EndScript('Failed to login after hopping.');
until LoggedIn
Wait(RandomRange(500,6000));
ToggleXPBar(true);
SetAngle(SRL_ANGLE_HIGH);
end;
procedure WalkToCenter; //simple SPS walking to center (will improve in the future)
begin
StatusWithPaint('Walking to center.');
SPS_WalkToPos(Point(335, 374)); //no need randomness, because its not accurate
end;
procedure SpecialAttack;
var
X,Y,DTM100,DTM75,DTM60,DTM55,DTM50,DTM25,i,FailTime : Integer;
begin
if UseSpecAttacks and ((TimeFromMark(SpecTime) > SpecWait) or (SpecNumber > 0)) then //will enter if specials are turned on AND (if its time to check for special OR we have remaining specials to do)
begin
StatusWithPaint('Checking special attack.');
DTM100 := DTMFromString('mWAAAAHicY2FgYHBgYmCwB+IjULyQkYFhHRAvAOI1QFyzIo9BSl+EwT/XkiGi2oGBC6gHGTOiYRAAAPnmCNY='); //DTMS for 100%,75% ... special bars
DTM75 := DTMFromString('mQwAAAHicY2ZgYLBnguAFIMzIwLAWiJcBsXOyIYOmpwJDep83AxdQHQwzImEgAAD6tQXo');
DTM60 := DTMFromString('mQwAAAHicY2ZgYHBgYmCwB+IuIF7EyMCwhhFCt2wuZTDyUmWYcKSegQuoDoYZkTAQAAAooAdH');
DTM55 := DTMFromString('mQwAAAHicY2ZgYGhmgeDjQCzNxMCgCcSyQOycbMggpS/CMOFIPQMXUB0MMyJhIAAA5cgFbA==');
DTM50 := DTMFromString('mQwAAAHicY2ZgYHBgYmCwB+JaIF7EyMCwhhFCt2wuZTDyUmWYcKSegQuoDoYZkTAQAAAl1Qc6');
DTM25 := DTMFromString('mQwAAAHicY2ZgYHBgYmCwB+IoIF7EyMCwhhFCt2wuZTDyUmWYcKSegQuoDoYZkTAQAAAeUAcX');
SpecNumber := 0;
MarkTime(FailTime);
repeat
if (TimeFromMark(FailTime) > 5000) then Exit; //if failed to switch tabs, then it exits
GameTab(tab_Combat);
until (GetCurrentTab = tab_Combat)
SpecNumber := 0; //no matter if we have remaining specials to do, we will set it to 0 and determine it again
case SpecUsage of //determining how many specials we can do
100:
if FindDTM(DTM100,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 1;
60:
if FindDTM(DTM60,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 1;
55:
if FindDTM(DTM55,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 1;
50:
begin
if FindDTM(DTM50,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 1;
if FindDTM(DTM100,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 2;
end;
25:
begin
if FindDTM(DTM25,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 1;
if FindDTM(DTM50,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 2;
if FindDTM(DTM75,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 3;
if FindDTM(DTM100,X,Y,MIX1,MIY1,MIX2,MIY2) then
SpecNumber := 4;
end;
end;
MarkTime(SpecTime);
SpecWait := RandomRange(15000,60000); //next spec check in 15-60 seconds
if SpecNumber > 0 then //if we can spec
begin
StatusWithPaint('Using special attack.');
MouseBox(574,416,706,428,mouse_left);
Dec(SpecNumber);
end else //it cant do spec
begin
StatusWithPaint('Not enough special.');
Wait(RandomRange(500,4000));
StatusWithPaint('Back to fighting.');
MarkTime(FailTime);
repeat
if (TimeFromMark(FailTime) > 5000) then Exit;
GameTab(tab_Inv);
until (GetCurrentTab = tab_Inv)
end;
FreeDTM(DTM100);
FreeDTM(DTM75);
FreeDTM(DTM60);
FreeDTM(DTM55);
FreeDTM(DTM50);
FreeDTM(DTM25);
end;
end;
procedure LoginCheck;
begin
if not LoggedIn then
begin
StatusWithPaint('Logging in.');
if not LoginPlayer then
EndScript('We got logged out somehow and cant log in.');
end;
end;
procedure HpCheck;
var
colorstring, lobs, peaches : String;
FailTime, Amount : Integer;
done : Boolean;
begin
if (GetMMLevels('hp', colorstring) < EatAt) then
begin
MarkTime(FailTime);
repeat
if not b2p then //if not using B2P yet then we eat a simple food (lobster)
begin
StatusWithPaint('Eating lobster.');
Amount := 120; //healing amount for lobster
lobs := 'mggAAAHicY2NgYPjPxMDAzczAwMcMYX8E4p9ALMbIwMAKxNxArMAI4fMC8f4EGaAuJgwsAiSxYUYcGAIAcgoGSA==';
if not EatFood(lobs) then
begin //if out of food
if not BonesToPeaches then //if not using B2P, then we log out
EndScript('Out of food.')
else
b2p := True; //lets start using B2P
end;
end;
if b2p then
begin
StatusWithPaint('Eating peaches.');
Amount := 80; //healing amount for peach
peaches := '78DA632C60626070626440069B3B52194480344C94310FA8C60C550D030313AA9A32A01A0B026A6A806A1C08A8A906AA7127A006E4663F026A52883007A4C69E809A4CC2FE0200D76708C1'
if not EatFood(peaches) then //if out of peaches
begin
StatusWithPaint('Breaking B2P.');
if not BreakB2P then //if out of tablets
EndScript('Out of B2P tablets.');
if not EatFood(peaches) then //if broke tablet but cant eat peaches
EndScript('Failed to eat peaches after broking B2P.');
end;
end;
if (GetMMLevels('hp', colorstring) > (HpLevel * 10 - Amount)) or (TimeFromMark(FailTime) > 30000) then //if we no need to eat more (current hp > (maxhp - healamout)) (30 seconds timeout for fail safe)
done := True;
until done
end;
end;
procedure NoobCheck;
begin
if Length(GetMinimapDotsin('player',592,49,662,120)) > 0 then
begin
StatusWithPaint('Found a noob, waiting.');
MakeScreenShot('C:\Simba\Screenshots\ChaosMossKiller\noobs\');
Wait(RandomRange(5000,10000));
HopWorld;
end;
end;
function BonesCheck : Boolean;
var
LookedForBones : Integer;
begin
Result := False;
if BonesToPeaches then
begin //if using B2P then we need to collect bones
if not InvFull then
begin
LookedForBones := 0;
repeat
if FindBones(MSX1,MSY1,MSX2,MSY2) then
begin
StatusWithPaint('Picking up bones.');
Mouse(X,Y,0,0,mouse_right);
ChooseOptionCharms('ake Big');
Wait(1000);
repeat until not IsMoving
Result := True;
end;
Inc(LookedForBones);
until (InvFull) or (LookedForBones = 5) //looking for bones max 5 times (failsafe)
end;
end;
end;
procedure RandomsCheck;
begin
if FindNormalRandoms then
EndScript('Random event found!');
end;
procedure AmmoCheck; //function for Ranging
var
i : Integer;
done : Boolean;
begin
if LevelString = 'RNG' then
if FindChatBoxText('You have no ammo',8,ClBlack) then //ammo check
begin
StatusWithPaint('Out of ammo.');
Wait(1000);
if srl_inFight then
begin
StatusWithPaint('Still fighting, removing weapon.');
repeat until GameTab(tab_Inv)
if InvFull then
begin
i := 5;
done := False;
repeat
MMouseItem(i);
if IsUpTextMultiCustom(['Bury','ury','Eat','at']) then
begin
ClickMouse2(mouse_right);
if ChooseOptionMulti(['Drop','rop']) then
done := True;
end;
Inc(i);
until done
end;
repeat until GameTab(tab_Equip);
MouseBox(573,294,594,311,mouse_left);
StatusWithPaint('Removed weapon.');
EndScript('Out of ammo.');
end;
end;
end;
procedure SetupScript;
begin
ClearDebug;
Disguise('ChaosMossKiller Temp Fix By Mat');
Status('Starting script.');
{$IFDEF SMART}
{$IFDEF SIMBAMAJOR980}
Smart_Server := 24;
Smart_Members := Members;
Smart_Signed := Signed;
SMART_SuperDetail := False;
{$ELSE}
SmartPairClient(4440);
SRL_SixHourFix := True;
Smart_FixSpeed := True;
{$ENDIF}
{$ENDIF}
SetupSRL;
ActivateClient;
DeclarePlayers;
SetupSRLStats(680, SRLStats_User, SRLStats_Password);
SPS_Setup(RUNESCAPE_OTHER,['chaos_tunnels']);
if PaintDebug then
SMART_ClearCanvas;
Status('Logging in.');
LoginPlayer;
end;
procedure Startup;
var
fails, FailTime : Integer;
done : Boolean;
begin
if srl_inFight then
begin
StatusWithPaint('Waiting till fight is over.');
repeat until not srl_InFight
end;
fails := 0;
done := True;
MarkTime(FailTime);
repeat
ToggleXPBar(True);
TrainedLevel := GetSkillLevel(TrainedSkill);
if (TrainedLevel = -1) then
begin
done := False;
fails := fails+1;
end;
HpLevel := GetSkillLevel('Hitpoints');
if (HpLevel = -1) then
begin
done := False;
fails := fails+1;
end;
StartXPtillNext := XPTillNextLevel(TrainedSkill);
if (StartXPtillNext = -1) then
begin
done := False;
fails := fails+1;
end;
StartXP := GetXPBar(XPCounter);
if (StartXP = -1) then
begin
done := False;
fails := fails+1;
end;
if (fails = 3) or (TimeFromMark(FailTime) > 30000) then
EndScript('Startup fail. Cant get level/read xps.');
until done
case TrainedSkill of
'Attack' : LevelString := 'ATK';
'Strength' : LevelString := 'STR';
'Defence' : LevelString := 'DEF';
'Range' : LevelString := 'RNG';
end;
case DebugLines of
true: doreport := False;
false: doreport := True;
end;
b2p := False;
LastXP := 0;
WorldHops := 0;
B2PUsed := 0;
FoodUsed := 0;
GoldCharms := 0;
GreenCharms := 0;
BlueCharms := 0;
CrimsonCharms := 0;
if UseSpecAttacks then
begin
SpecNumber := 0;
SpecWait := RandomRange(15000,45000);
MarkTime(SpecTime);
end;
ClearDebug;
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
WriteLn(' ChaosMossKiller Temp Fix By Mat ' + Version);
WriteLn(' - HP level : ' + IntToStr(HpLevel));
Writeln(' - ' + LevelString + ' level : ' + IntToStr(TrainedLevel));
Writeln(' - XP till next : ' + IntToStr(StartXPtillNext));
Writeln(' - XP Bar : ' + IntToStr(StartXP));
WriteLn(' - Starting script...');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
MarkTime(StartTime);
SetAngle(SRL_ANGLE_HIGH);
end;
procedure Main;
var
DetectTime, KillTime : Integer;
done : Boolean;
begin
repeat
StatusWithPaint('Looking for Mosses.');
done := False;
MarkTime(DetectTime);
repeat
if (TimeFromMark(DetectTime) > 180000) then //180 seconds failsafe
EndScript('Cant find Mosses.');
if FindMoss(true) then //if clicked on moss
begin
if WaitInFight(4000) then //checking if we are fighting
done:=True
end else
begin //if failed to attack moss
StatusWithPaint(IntToStr(TimeFromMark(DetectTime))+'ms');
case Random(20) of
0: CompassMovement(-120,120,false); //rotating camera for better view
end;
LoginCheck;
RandomsCheck;
if (TimeFromMark(DetectTime) > 10000) then //walking back to middle
WalkToCenter;
end;
until done //we are fighting now
StatusWithPaint('Fighting.');
MarkTime(KillTime);
repeat
Antiban;
AmmoCheck;
if (TimeFromMark(KillTime) < 5000) then //we dont want to waste special attack, so we only using it in the first 5 seconds
SpecialAttack;
if ((TimeFromMark(KillTime) > 5000) and (FindRedBar)) then //we are looking for redbar after 5 seconds of fighting
Break; //end of fight
Wait(500);
until ((TimeFromMark(KillTime) > 10000) and (not srl_inFight)) //failsafe is: 10 seconds and no hpbar above the player -> end of fight
StatusWithPaint('Killed Moss. Took '+MsToTime(TimeFromMark(KillTime),Time_Formal)+'.');
Report;
stats_Commit; //committing stats (no variebles yet, only time)
BonesCheck; //this will look for bones if needed and pickst them up
FindAllCharms; //this will look for charms and picks them up
LoginCheck;
NoobCheck; //this will look for other players around
HpCheck; //this will check hp and eat (use b2p) if needed
until False
end;
begin
SetupScript;
Startup;
Main;
end.
This Complie so it should work unless RS Changed Anything.