Sir R. M8gic1an
2009-08-12 14:48:43
This is here for people to give their opinions on it.
Do take into account this was for rev #30 or something.
~RM
Do take into account this was for rev #30 or something.
{
RIMMINGTON MINER BY *****
INSTRUCTIONS
1. Start Anywhere (mine, store, or anywhere in between)
2. Press Start
F11: Reset Players
F12: Toggles between Player Report and Randoms Report
}
Program RimmingtonMiner;
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Skill\Mining.scar}
{.Include SRL\SRL\Misc\Users.scar}
type
Response = record
Question: array of string;
Answer: array of string;
Timer: integer;
end;
var
x, y, i, ReportType, RespondTimer, Time, Timer: integer;
Bmp_Ore, Shopkeepers, RockIndex: integer;
Xp: extended;
RockLocation: TPoint;
AutoResponse: Array of Response;
const
SRL_ID = ''; //SRL Stats
SRL_Password = '';
Rock = 'Copper';
MinTime = 15; //Time per player (minutes)
MaxTime = 25;
Procedure PlayerReport;
var
i, Width: integer;
s: string;
begin
ClearReport;
AddToReport(' Player Report (F11 = Reset)');
for i:=0 to High(Players) do
begin
s := ' ' + Players[i].Name;
While Length(s) <= 13 do
s := s + ' ';
case Players[i].Active of
True: s := s + '(Active)';
False: s := s + '(Inactive)';
end;
While Length(s) <= 25 do
s := s + ' ';
s := s + IntToStr(Players[i].Integers[0]) + ' Ore';
While Length(s) <= 35 do
s := s + ' ';
s := s + IntToStr(Round(Players[i].Integers[0]*Xp)) + ' Xp';
if Length(s) > Width then
Width := Length(s);
ChangeReportWidth(Width*9 + 4);
AddToReport(s);
end;
end;
Procedure ProgressReport(s: string);
var
OreMined: integer;
begin
for i:=0 to High(Players) do
IncEx(OreMined, Players[i].integers[0]);
if s = '' then
begin
s := GetDebugLine(2);
end else
s := 'Status: ' + s;
if IsFKeyDown(12) then
case ReportType of
0: ReportType := 1;
1: ReportType := 0;
end;
if IsFKeyDown(11) then
if GetApplication.Messagebox('Reset Players?', 'Rimmington Miner by ****', 1) = 1 then
begin
for i:=0 to High(Players) do
Players[i].Active := true;
Writeln('Players Reset');
Wait(1000);
end;
ClearDebug;
Writeln('Rimmington Miner by *****');
Writeln(Capitalize(Rock) + ' Ore Mined: ' + IntToStr(OreMined));
Writeln(s);
Writeln('Next Player In ' + IntToStr( (Time - TimeFromMark(Timer))/60000) + ' Minutes');
Writeln(TimeRunning);
Writeln('');
case ReportType of
0: begin
Writeln('Press F12 to Show Player Report');
SRLRandomsReport;
end;
1: begin
Writeln('Press F12 to Show Randoms Report');
PlayerReport;
end;
end;
end;
Function StoreScreen: boolean;
begin
Result := FindTextTPA(2071807, 30, 170, 32, 365, 48, 'Store', upchars, Nothing);
end;
Function Direction(x1, y1, x2, y2: integer): extended;
var
x, y, h: extended;
begin
x := (x1 + x2)/2;
y := (y1 + y2)/2;
h := Hypot(x, y);
Result := -1;
case 0 of
x: Result := Degrees(ArcCos(x/h));
y: Result := Degrees(ArcSin(y/h));
h: exit;
end;
if Result = -1 then
Result := Degrees(ArcTan(y/x));
end;
Procedure AutoRespond;
var
a, b, c: integer;
n: string;
begin
if not LoggedIn then
exit;
if TimeFromMark(RespondTimer) < 5000 then
exit;
LastChatter(n);
if n = Players[CurrentPlayer].Name then
exit;
for a:=0 to High(AutoResponse) do
begin
for b:=0 to High(AutoResponse[a].Question) do
begin
if TimeFromMark(AutoResponse[a].Timer) < 120000 then
exit;
if Pos(Lowercase(AutoResponse[a].Question[b]), Lowercase(GetChatBoxText(8, clBlue))) > 0 then
begin
c := Random(GetArrayLength(AutoResponse[a].Answer));
SaveToChatLog;
AddToSRLLog(Players[CurrentPlayer].Name + ': ' + AutoResponse[a].Answer[c]);
Writeln('Typing Auto Response');
Wait(RandomRange(500, 1500));
Typesend(AutoResponse[a].Answer[c]);
MarkTime(RespondTimer);
MarkTime(AutoResponse[a].Timer);
exit;
end;
end;
end;
end;
Procedure AntiBan;
var
Angle: integer;
begin
if not LoggedIn then
exit;
case Random(750) of
0, 1: HoverSkill('mining',false);
2: HoverSkill('random', false);
3: BoredHuman;
4: SleepAndMoveMouse(250+random(250));
5: RandomRClick;
6: begin //Checks friends list
GameTab(8);
Wait(1000+random(500));
MMouse(MIX1,MIY1,160,240);
Wait(1000+random(500));
GameTab(4);
end;
7, 8: begin
Angle := Round(rs_GetCompassAngleDegrees);
MakeCompass(IntToStr(RandomRange(Angle - 45, Angle + 45)));
end;
9, 10, 11, 12, 13, 14: PickUpMouse;
end;
end;
Procedure AntiRandom;
begin
ProgressReport('');
if not LoggedIn then
exit;
FindNormalRandoms;
AutoRespond;
AntiBan;
if FindFight then
RunAway('s', true, 1, RandomRange(15000, 25000));
end;
Function CharMoving: boolean;
var
C1, C2, C3, C4: integer;
begin
Result := false;
C1 := GetColor(MMCX - 25, MMCY - 25);
C2 := GetColor(MMCX + 25, MMCY - 25);
C3 := GetColor(MMCX + 25, MMCY + 25);
C4 := GetColor(MMCX - 25, MMCY + 25);
Wait(500);
if not((GetColor(MMCX - 25, MMCY - 25) = C1)) then
Result := true;
if not((GetColor(MMCX + 25, MMCY - 25) = C2)) then
Result := true;
if not((GetColor(MMCX + 25, MMCY + 25) = C3)) then
Result := true;
if not((GetColor(MMCX - 25, MMCY + 25) = C4)) then
Result := true;
end;
Procedure SetCompass;
{ Sets the compass in 45 degree increments so your
character is not standing in front of the ore }
var
i, Angle: integer;
begin
Angle := Round(rs_GetCompassAngleDegrees);
for i:=0 to 3 do
if InRange(Angle, i*90 + 30, i*90 + 60) then
exit;
i := Random(4);
MakeCompass(IntToStr(RandomRange(i*90 + 30, i*90 + 60)));
end;
Function SymbolWalk(Symbol: string; XOffset, YOffset: integer): boolean;
// DDTMs weren't working good in Rimmington :(
var
x, y, XMod, YMod: integer;
Angle: extended;
begin
Result := false;
if not LoggedIn then
exit;
if not FindSymbol(x, y, Symbol) then
exit;
Angle := rs_GetCompassAngleRadians;
x:= x + round(XOffset*cos(Angle) - YOffset*sin(Angle));
y:= y + round(XOffset*sin(Angle) + YOffset*cos(Angle));
if x > MSCX then
begin
XMod := -4;
end else
XMod := 4;
if y > MSCY then
begin
YMod := -4;
end else
YMod := 4;
if Distance(MMCX, MMCY, x, y) > 10 then
begin
if MFNF(x, y, XMod, YMod) then
begin
FFlag(30);
Result := true;
end;
end else
Result := true;
AntiRandom;
end;
Procedure WalktoStore;
var
MMAngle: integer;
Angle: extended;
begin
if not LoggedIn then
exit;
ProgressReport('Walking To Store');
repeat
MMAngle := Round(rs_GetCompassAngleDegrees);
if FindDTMRotated(Shopkeepers, x, y, MMX1, MMY1, MMX2, MMY2, Radians(MMAngle-30), Radians(MMAngle + 30), 0.05, Angle) then
begin
if Distance(MMCX, MMCY, x, y) < 20 then
exit;
Mouse(x, y, 0, 0, true);
FFlag(0);
exit;
end;
if not SymbolWalk('store', 0, 0) then
if not SymbolWalk('portal', 14, 12) then
if not SymbolWalk('water', 15, -20) then
if not RadialWalk(FindRoadColor, MMAngle + 190, MMAngle + 260, 65, 1, -1) then
SymbolWalk('mining spot', -15, 20);
AntiRandom;
until(false);
Wait(RandomRange(250, 500));
ProgressReport('');
end;
Procedure WalktoMine;
var
MMAngle, t: integer;
Angle: extended;
Rocks: TPointArray;
begin
if not LoggedIn then
exit;
if FindAllRocksRecord(Rocks, RockIndex, false, true) then
exit;
if SymbolWalk('mining spot', RockLocation.x, RockLocation.y) then
exit;
ProgressReport('Walking To Mine');
SymbolWalk('store', 60, -36);
MarkTime(t);
repeat
if SymbolWalk('mining spot', RockLocation.x, RockLocation.y) then
break;
MMAngle := Round(rs_GetCompassAngleDegrees);
if not SymbolWalk('mining spot', 0, 0) then
if not RadialWalk(FindRoadColor, MMAngle + 15, MMAngle + 85, 65, 1, -1) then
if not SymbolWalk('water', 20, -20) then
begin
Angle := rs_GetCompassAngleRadians;
x:= MMCX + round(55*cos(Angle) - 17*sin(Angle));
y:= MMCY + round(55*sin(Angle) + 17*cos(Angle));
end;
AntiRandom;
until(TimeFromMark(t) > 30000);
ProgressReport('');
end;
Function TradeShopkeeper: boolean;
var
i, t: integer;
Colors: Array of integer;
begin
if not LoggedIn then
exit;
if StoreScreen then
begin
Result := true;
exit;
end;
Colors := [12765898, 3032132, 5734044]
While CharMoving do
Wait(100);
for i:=0 to 2 do
begin
if FindObjTPA(x, y, Colors[i], 10, 1, 4, 4, 12, ['hop']) then
begin
Mouse(x, y, 0, 0, false);
Wait(RandomRange(50, 100));
if ChooseOption('Trade') then
begin
MarkTime(t);
repeat
Wait(100);
until((StoreScreen) or (TimeFromMark(t) > 10000));
Wait(RandomRange(400, 800));
Result := StoreScreen;
exit;
end;
end;
end;
end;
Procedure SellOre;
begin
if not LoggedIn then
exit;
if not TradeShopkeeper then
exit;
ProgressReport('Selling Ore');
GameTab(4);
if FindBitmapToleranceIn(Bmp_Ore, x, y, MIX1, MIY1, MIX2, MIY2, 40) then
begin
MMouse(x, y, 4, 4);
Wait(RandomRange(100, 200));
if IsUpText('re') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(RandomRange(50, 100));
ChooseOption('50');
end;
Wait(RandomRange(300, 600));
end;
CloseWindow;
AntiRandom;
ProgressReport('');
end;
Function FindRocks: boolean;
var
x, y, t: integer;
Angle: extended;
Rocks: TPointArray;
begin
if not LoggedIn then
exit;
if FindAllRocksRecord(Rocks, RockIndex, false, true) then
begin
Result := true;
exit;
end;
Result := false;
case RockIndex of
1, 2: t := GetSystemTime + 1000;
3: t := GetSystemTime + 5000;
4: t := GetSystemTime + 105000;
end;
While GetSystemTime < t do
begin
Wait(250);
AntiRandom;
if FindAllRocksRecord(Rocks, RockIndex, false, true) then
begin
Result := true;
exit;
end;
end;
WalkToMine;
While CharMoving do
Wait(100);
if not FindAllRocksRecord(Rocks, RockIndex, false, true) then
begin
if not FindSymbol(x, y, 'mining spot') then
begin
Writeln('Could not Find Mine Symbol');
TerminateScript;
exit;
end;
Angle := rs_GetCompassAngleRadians;
x:= x + round(RockLocation.x*cos(Angle) - RockLocation.y*sin(Angle));
y:= y + round(RockLocation.x*sin(Angle) + RockLocation.y*cos(Angle));
MakeCompass(FloatToStr(Direction(MSCX, MSCY, x, y)));
SetAngle(false);
if FindAllRocksRecord(Rocks, RockIndex, false, true) then
begin
Result := true;
exit;
end;
end;
end;
Procedure MineOre;
var
x, y, OreCount, Timeout, T: integer;
RockPos: TPoint;
Rocks: TPointArray;
begin
if not LoggedIn then
exit;
if InvFull then
exit;
SetCompass;
While CharMoving do
Wait(100);
if not FindRocks then
begin
ProgressReport('Could not Find Rocks');
Players[CurrentPlayer].Active := false;
exit;
end;
//Finds rock without gas near it
if not FindGas(x, y) then
begin
x := -100;
y := -100;
end;
FindAllRocksRecord(Rocks, RockIndex, false, true);
if GetArrayLength(Rocks) = 0 then
exit;
SortTPAFrom(Rocks, Point(MSCX, MSCY));
for i:=0 to High(Rocks) do
begin
if Distance(x, y, Rocks[i].x, Rocks[i].y) > 100 then
begin
MMouse(Rocks[i].x, Rocks[i].y, 0, 0);
Wait(RandomRange(100, 150));
if IsUpText('Rock') then
break;
end else
if i = High(Rocks) then
exit;
end;
ProgressReport('Mining');
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
RockPos := Point(x, y);
OreCount := CountItemsIn('inv', 'bmp', Bmp_Ore, [40]);
MarkTime(Timeout);
MarkTime(T);
While TimeFromMark(T) < 1000 do
begin
Wait(100);
FindPick;
AntiRandom;
if CountItemsIn('inv', 'bmp', Bmp_Ore, [40]) = OreCount + 1 then
begin
Inc(Players[CurrentPlayer].integers[0]);
Inc(ReportVars[0]);
exit;
end;
//Checks if there is ore in the rock
FindAllRocksRecord(Rocks, RockIndex, false, true);
if GetArrayLength(Rocks) = 0 then
exit;
SortTPAFrom(Rocks, RockPos);
if Distance(Rocks[0].x, Rocks[0].y, RockPos.x, RockPos.y) < 30 then
begin
RockPos := Rocks[0];
MarkTime(T);
end;
if InvFull then
break;
if TimeFromMark(TimeOut) > (RockIndex/4 + 1)*30000 then
break;
if FindGas(x, y) then
begin
if Distance(RockPos.x, RockPos.y, x, y) < 100 then
begin
Writeln('Gas Detected');
AddToSRLLog('Gas Detected');
Mouse(MMCX + 8, MMCY + 8, 2, 2, true);
break;
end;
end;
end;
Wait(RandomRange(50, 100));
if CountItemsIn('inv', 'bmp', Bmp_Ore, [40]) = OreCount + 1 then
begin
Inc(Players[CurrentPlayer].integers[0]);
Inc(ReportVars[0]);
end;
end;
Procedure SetupAutoRespond;
begin
SetLength(AutoResponse, 6);
AutoResponse[0].Question := ['hi', 'hello', 'hey', 'helo'];
AutoResponse[0].Answer := ['hi', 'hello', 'hey'];
AutoResponse[1].Question := ['mining level', 'mining lvl', 'minin level',
'minin lvl', 'mine level', 'mine lvl'];
AutoResponse[1].Answer := [IntToStr(GetSkillLevel('mining'))];
AutoResponse[2].Question := ['lol', 'lawl', 'rofl', 'haha', 'lmao'];
AutoResponse[2].Answer := ['lol', 'lawl', 'rofl', 'haha', 'lmao'];
AutoResponse[3].Question := [Players[CurrentPlayer].Nick];
AutoResponse[3].Answer := ['no hablo ingles', 'je ne parle pas anglais', 'I cant talk im muted'];
AutoResponse[4].Question := ['hablo espanol'];
AutoResponse[4].Answer := ['no hablo espanol', 'no comprendo', 'yo vivo en taco bell'];
end;
Procedure SetupPlayer;
begin
if not LoggedIn then
LoginPlayer;
SetAngle(true);
FindPickHeadColor;
SetupAutoRespond;
ProgressReport('');
end;
Procedure Setup;
begin
SetupSRL;
SetupMining;
SRLPlayerForm(True, [], [], [], []);
SMARTSetupEx(121, False, True, False);
Wait(1000);
SetTargetDC(SmartGetDC);
case Capitalize(Rock) of
'Iron':
begin
Bmp_Ore := SRL_GetBitmap(1);
RockIndex := 3;
RockLocation := Point(-35, 6);
Xp := 35;
end;
'Copper':
begin
Bmp_Ore := SRL_GetBitmap(2);
RockIndex := 1;
RockLocation := Point(3, -20);
Xp := 17.5;
end;
'Tin':
begin
Bmp_Ore := SRL_GetBitmap(3);
RockIndex := 2;
RockLocation := Point(25, 16);
Xp := 17.5;
end;
'Gold':
begin
Bmp_Ore := SRL_GetBitmap(6);
RockIndex := 4;
RockLocation := Point(0, 24);
Xp := 65;
end;
end;
if RockIndex = 0 then
begin
Writeln('ERROR: Rock Type Not Recognized');
TerminateScript;
end;
Shopkeepers := DTMFromString('78DA638C6162608865400139A9290C29409A1' +
'188FF03016338504D28AA9AB76F1918F8A16A4080319AB01A00C6' +
'C80B89');
ScriptID := '1146';
SRLID := SRL_ID;
SRLPassword := SRL_Password;
SRL_Procs[0] := @AntiRandom;
end;
begin
Setup;
RandomNextPlayer(Players[CurrentPlayer].Active);
SetupPlayer;
repeat
Time := RandomRange(MinTime*60000, MaxTime*60000);
MarkTime(Timer);
repeat
case InvFull of
True: begin
WalkToStore;
SellOre;
end;
False: begin
WalkToMine;
MineOre;
end;
end;
if not LoggedIn then
break;
if Players[CurrentPlayer].Active = false then
break;
until(TimeFromMark(Timer) > Time);
Logout;
RandomNextPlayer(Players[CurrentPlayer].Active);
until(false);
end.
1. Technique (/100)
2. Individuality (/100)
3. Follow all SRL rules (/100)
4. Creativity (/100)
5. Efficiency (/100)
6. Presentation (/100)
7. Meeting all Requirements (/100)
8. Added Extras (/100)
~RM