TRiLeZ
2009-12-30 16:40:09
I just had to change a color and modifiers. I also made a function called Pinball_InRandom.
There is now no music in this random and "flashing" cant be found so I changed it to "lashing".
To Devs: while your looking at this, could you please look at my Forester Solver and my Drill Demon Solver Changes because they both need to committed because the current solvers aren't working / has bugs.
***** STR: FOUND RANDOM: 'Pinball' *****
Starting the pinball solver.
Exit Found
Pinball Solved.
***** STR: 'Pinball' RANDOM SOLVED SUCCESSFULLY! *****
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Pinball Routines --//
//-----------------------------------------------------------------//
// * function Pinball_InRandom: Boolean; // * by TRiLeZ
// * function p_ScanPillar(var x, y: Integer): Boolean; // * by SKy Scripter
// * function p_GetScore: string; // * by ZephyrsFury
// * function ExitPinball: string; // * by ZephyrsFury, SKy Scripter & Wizzup?
// * function SolvePinball: Boolean; // * by SKy Scripter fixed by Wizzup?
{*******************************************************************************
function Pinball_InRandom: Boolean;
by: TRiLeZ
Description: Checks if you are in the pinball random.
Date: December 30, 2009
*******************************************************************************}
function Pinball_InRandom: Boolean;
begin
if InBlack then
if (not (GetColor(504, 348) = 657930)) then //Arrow in chat box
Result := (CountColor(0, 204, 17, 280, 43) > 80);
end;
{*******************************************************************************
function p_ScanPillar(var x, y: Integer): Boolean;
by: SKy Scripter
Description: Scans for the pinball pillar
*******************************************************************************}
function p_ScanPillar(var x, y: Integer): Boolean;
var
Points: TPointArray;
Colors: array of Integer;
P2D: T2DPointArray;
I, Hi, Bitmap,
J, ma, ind: Integer;
H, S, L: Extended;
Canvas: TCanvas;
Temp : HDC;
begin
try
Temp := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.14, 3.06);
FindColorsTolerance(Points, 8440943, MSX1, MMY1, MSX2, MSY2, 10);
HI := High(Points);
Result := False;
ColorToleranceSpeed(Temp);
if (Hi < 20) then
Exit;
Colors := GetColors(Points);
Bitmap := BitmapFromString(MSX2, MSY2, '');
Canvas := GetBitmapCanvas(Bitmap);
Canvas.Brush.Color := 10;
Canvas.Brush.Style := bsSolid;
Canvas.Rectangle(0, 0, MSX2, MSY2);
J := 0;
Canvas.Brush.Color := 255;
Canvas.Pen.Color := 255;
for I := 0 to HI do
begin
ColortoHSL(Colors[I], H, S, L);
if (L > 50.0) then
begin
Canvas.Rectangle(Points[I].x - 1, Points[I].y - 1,
Points[I].x + 1, Points[I].y + 1);
J := J + 1;
end;
end;
if (J > 20) then
begin
Canvas.Brush.Color := 0;
Canvas.FloodFill(2, 2, 10, 0);
Canvas.FloodFill(MSX2 - 5, MSY2 - 5, 10, 0);
Temp := GetClientCanvas.Handle;
SetTargetBitmap(Bitmap);
FindColorsTolerance(Points, 10, 0, 0, MSX2-5, MSY2-5, 0);
SetTargetDc(temp);
if (Length(Points) > 10) then
begin
P2D := TPAtoATPA(Points, 60);
Hi := High(P2D);
ma := 0;
for I := 0 to Hi do
begin
J := Length(P2D[I]);
if (ma < j) then
begin
ma := j;
ind := I;
end;
end;
result := (ma > 40);
end;
end;
if (result) then
begin
MiddleTPAEx(P2D[ind], x, y);
MMouse(x, y, 0, 0);
result := isuptext('ag');
end;
DisplayDebugImgWindow(MSX2, MSY2);
SafeCopyCanvas(canvas, GetDebugCanvas, 0, 0, MSX2, MSY2, 0, 0, MSX2, MSY2);
finally
FreeBitmap(bitmap);
end;
end;
{*******************************************************************************
function p_GetScore: string;
by: ZephyrsFury
Description: Gets the pinball score.
*******************************************************************************}
function P_GetScore: Integer;
begin
Result := -1;
case (CountColor(0, 278, 17, 316, 48)) of
32, 34: case (CountColor(65535, 278, 17, 316, 48)) of
0: Result := 0;
56: Result := 4;
69: Result := 5;
78: Result := 8;
62: Result := 9;
end;
26: Result := 1;
38: Result := 2;
36: Result := 3;
33: Result := 6;
31: Result := 7;
58: Result := 10;
else
WriteLn('Count: ' + IntToStr(CountColor(0, 278, 17, 316, 48)) + ' Bug in P_GetScore!');
end;
end;
{*******************************************************************************
function ExitPinball: Boolean;
by: ZephyrsFury, SKy Scripter & Wizzup?
Description: Exits the pinball random.
*******************************************************************************}
function ExitPinball: Boolean;
var
CTS, II, X, Y, T: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.95, 1.29);
if (FindColorsTolerance(TPA, 6581581, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
ATPA := SplitTPA(TPA, 30);
SortATPASize(ATPA, True);
for II := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[II], X, Y);
Mouse(X, Y, 0, 0, False);
Wait(200 + Random(100));
if (ChooseOption('Exit')) then
begin
WriteLn('Exit Found');
T := GetSystemTime;
while (GetSystemTime - T < 30000) and (PercentBlackMM = 100) do
Wait(1000 + Random(2000));
Result := (PercentBlackMM < 100);
if (Result) then Break;
end;
Wait(500 + Random(1000));
end;
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
{*******************************************************************************
function SolvePinball: Boolean;
by: SKy Scripter fixed by Wizzup?
Description: Attempts to solve the Pinball random.
*******************************************************************************}
function SolvePinball: Boolean;
var
x, y, i, score, time, time2: Integer;
begin
Result := false;
Try
for i := 1 to 3 do
begin
ClickContinue(True, True);
Wait(1000);
end;
Wait(1000);
Writeln('Starting the pinball solver.');
Time := GetSystemTime;
while (p_GetScore <> 10) and (GetSystemTime - Time < 240000) do
begin
if p_ScanPillar(x, y) then
begin
Mouse(x, y, 0, 0, True);
score := p_GetScore;
time2 := getsystemtime;
while (score = p_GetScore) and (getsystemtime - time2 < 10000) do
Wait(1000);
Wait(1000 + Random(1000));
end;
Wait(200);
end;
if (GetSystemTime - Time >= 240000) or (p_GetScore <> 10) Then
exit;
MakeCompass('S');
SetAngle(False);
Wait(3000 + random(500));
Result := ExitPinball;
finally
if Result Then
Writeln('Pinball Solved.')
end;
end;
There is now no music in this random and "flashing" cant be found so I changed it to "lashing".
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » AntiRandom Routines --//
//-----------------------------------------------------------------//
// * procedure SRLRandomsReport; // * by Starblaster100
// * function FindBoxOption(var Box: TBox): Boolean; // * by Nava2
// * function UseRewardBox: Boolean; // * by Nava2
// * function FindMod: Boolean; // * by Stupid3ooo
// * function FindFight: Boolean; // * by Stupid3ooo
// * function FindLamp(skill: String): Boolean; // * by pups, Starblaster100 and PriSoner fixed by Lee Lok Hin
// * function FindDead : boolean; // * by Stupid3ooo and Cazax
// * function Rand_GetRandomType: Integer; // * by ZephyrsFury
// * procedure LoadTeleRandoms; // * by ZephyrsFury
// * function SolveTeleportRandoms: Boolean; // * by ZephyrsFury
// * function FindNonInventoryRandoms: Boolean; // * by The SRL Developers Team!... all time sexiness by Mutant
// * function FindNormalRandoms: Boolean; // * by The SRL Developers Team!... all time sexiness by Mutant
//-----------------------------------------------------------------//
type
TTeleRandom = record
Name: string;
TypeID, RandIndex: Integer;
TextColors,TextFonts: TIntegerArray;
IsInRandom, SolveRandom: function: Boolean;
Texts, Music: TStringArray;
TextBoxes: TBoxArray;
end;
var
TeleRandoms: array of TTeleRandom;
SolveSRLRandoms, r_UseRandomTool: Boolean;
RB_SkipArray: TIntegerArray;
SoundPath: string;
CurRandom: Integer;
{*******************************************************************************
procedure SRLRandomsReport;
by: Starblaster100
Description: Displays Randoms Report.
*******************************************************************************}
procedure SRLRandomsReport;
var
i, CurrentInt: Integer;
CurrentStr, Name: string;
Begin
ChangeReportWidth(280);
ClearReport;
AddToReport('/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\');
AddToReport('| SRL ' + IntToStr(SRLVersionNumber) + ' Randoms Report |');
AddToReport('| [url]www.villavu.com[/url] |');
AddToReport('|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|');
For i := 0 to 44 do
Begin
Case i of
0: begin CurrentInt := SRL_Logs; Name := '| SRL Logs :'; end;
1: begin CurrentInt := RandSolved[rand_Trade]; Name := '| Trades Made :'; end;
2: begin CurrentInt := RandFailed[rand_Trade]; Name := '| Trades Missed :'; end;
3: begin CurrentInt := RandSolved[rand_Fight]; Name := '| Fights :'; end;
4: begin CurrentInt := RandSolved[rand_Sandwich]; Name := '| Sandwiches Solved :'; end;
5: begin CurrentInt := RandFailed[rand_Sandwich]; Name := '| Sandwiches Missed :'; end;
6: begin CurrentInt := RandSolved[rand_Lamp]; Name := '| Lamps Solved :'; end;
7: begin CurrentInt := RandFailed[rand_Lamp]; Name := '| Lamps Missed :'; end;
8: begin CurrentInt := RandSolved[rand_Frog]; Name := '| Frog Solved :'; end;
9: begin CurrentInt := RandFailed[rand_Frog]; Name := '| Frog Missed :'; end;
10: begin CurrentInt := RandSolved[rand_Certer]; Name := '| Certers Solved :'; end;
11: begin CurrentInt := RandFailed[rand_Certer]; Name := '| Certers Missed :'; end;
12: begin CurrentInt := RandSolved[rand_Demon]; Name := '| Demons Solved :'; end;
13: begin CurrentInt := RandFailed[rand_Demon]; Name := '| Demons Missed :'; end;
14: begin CurrentInt := RandSolved[rand_Mod]; Name := '| Mods Found :'; end;
15: begin CurrentInt := RandSolved[rand_Maze]; Name := '| Mazes Solved :'; end;
16: begin CurrentInt := RandFailed[rand_Maze]; Name := '| Mazes Missed :'; end;
17: begin CurrentInt := RandSolved[rand_Mime]; Name := '| Mimes Solved :'; end;
18: begin CurrentInt := RandFailed[rand_Mime]; Name := '| Mimes Missed :'; end;
19: begin CurrentInt := RandSolved[rand_Death]; Name := '| Deaths :'; end;
20: begin CurrentInt := RandSolved[rand_Quiz]; Name := '| Quizes Solved :'; end;
21: begin CurrentInt := RandFailed[rand_Quiz]; Name := '| Quizes Missed :'; end;
22: begin CurrentInt := RandSolved[rand_ScapeRune]; Name := '| ScapeRunes Solved :'; end;
23: begin CurrentInt := RandFailed[rand_ScapeRune]; Name := '| ScapeRunes Missed :'; end;
24: begin CurrentInt := RandSolved[rand_BirdNest]; Name := '| Birds Nests :'; end;
25: begin CurrentInt := RandSolved[rand_Pinball]; Name := '| Pinballs Solved :'; end;
26: begin CurrentInt := RandFailed[rand_Pinball]; Name := '| Pinballs Missed :'; end;
27: begin CurrentInt := RandSolved[rand_PrisonPete]; Name := '| Petes Solved :'; end;
28: begin CurrentInt := RandFailed[rand_PrisonPete]; Name := '| Petes Missed :'; end;
29: begin CurrentInt := RandSolved[rand_Forester]; Name := '| Foresters Solved :'; end;
30: begin CurrentInt := RandFailed[rand_Forester]; Name := '| Foresters Missed :'; end;
31: begin CurrentInt := RandSolved[rand_Leo]; Name := '| Leo''s Solved :'; end; //Another space due to the ''
32: begin CurrentInt := RandFailed[rand_Leo]; Name := '| Leo''s Missed :'; end;
33: begin CurrentInt := RandSolved[rand_Molly]; Name := '| Molly''s Solved :'; end;
34: begin CurrentInt := RandFailed[rand_Molly]; Name := '| Molly''s Missed :'; end;
35: begin CurrentInt := RandSolved[rand_Pillory]; Name := '| Pillory''s Solved :'; end;
36: begin CurrentInt := RandFailed[rand_Pillory]; Name := '| Pillory''s Missed :'; end;
37: begin CurrentInt := RandSolved[rand_CapnArnav]; Name := '| Capn Arnav Solved :'; end;
38: begin CurrentInt := RandFailed[rand_CapnArnav]; Name := '| Capn Arnav Missed :'; end;
39: begin CurrentInt := RandSolved[rand_Beekeeper]; Name := '| Beekeepers Solved :'; end;
40: begin CurrentInt := RandFailed[rand_Beekeeper]; Name := '| Beekeepers Missed :'; end;
41: begin CurrentInt := RandSolved[rand_Abyss]; Name := '| Abysses Solved :'; end;
42: begin CurrentInt := RandFailed[rand_Abyss]; Name := '| Abysses Missed :'; end;
43: begin CurrentInt := RandSolved[rand_Mordaut]; Name := '| Mordauts Solved :'; end;
44: begin CurrentInt := RandFailed[rand_Mordaut]; Name := '| Mordauts Missed :'; end;
end;
if (CurrentInt < 1) then
Continue;
CurrentStr := IntToStr(CurrentInt);
AddToReport(PadR(Name, 30 - Length(CurrentStr)) + CurrentStr + ' |');
end;
AddToReport('\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/');
SendSRLReport;
end;
{*******************************************************************************
procedure FindBoxOption(var Box: TBox): Boolean;
By: Nava2
Description: Finds the text of options, based on the text loaded from the
player array. Will find text in order of occurance in the array.
*******************************************************************************}
function FindBoxOption(var Box: TBox; var RewardInd: Integer): Boolean;
var
x, y, H, L, II, i, LL, Col: Integer;
Text, TPA, xTPA: TPointArray;
ATPA: T2DPointArray;
Scroll: Boolean;
P: TPoint;
begin
Result := False;
RewardInd := -1;
Box := IntToBox(-1, -1, -1, -1);
if (not LoggedIn) then exit;
L := High(Players[CurrentPlayer].BoxRewards);
Scroll := (GetColor(385, 70) = 657930);
for II := 0 to L + 1 do
begin
if (InIntArray(RB_SkipArray, II)) then Continue;
if (II < L + 1) then
Text := LoadTextTPA(Players[CurrentPlayer].BoxRewards[II], UpChars, H)
else
Text := LoadTextTPA('box', UpChars, H);
FindColorsTolerance(TPA, 2070783, 35, 69, 362, 311, 3);
ATPA := SplitTPAEx(TPA, 3, 1);
LL := High(ATPA);
for i := 0 to LL do
begin
Result := FindTextTPAInTPA(H, Text, ATPA[i], xTPA);
if (Result) then Break;
end;
if (not Result) and (Scroll) then
begin
X := 377;
Y := 312 - II mod 2 * 245;
Col := 657930 + II mod 2 * 658704;
P := Point(375, 302 - II mod 2 * 224);
MMouse(X, Y, 0, 0);
Wait(RandomRange(30, 60));
HoldMouse(X, y, True);
while (GetColor(P.X, P.Y) <> Col) and (GetColor(385, 70) = 657930) and (not(Result)) do
begin
if (not LoggedIn) then Break;
FindColorsTolerance(TPA, 2070783, 35, 69, 362, 311, 3);
Result := FindTextTPAInTPA(H, Text, TPA, xTPA);
Wait(RandomRange(40, 50));
end;
ReleaseMouse(X, Y, True);
end;
if (Result) then
begin
if (II < L + 1) then
WriteLn('Found Reward Item: ' + Players[CurrentPlayer].BoxRewards[II])
else
WriteLn('Found no prefered reward items, chose default reward: Mystery Box');
Break;
end;
end;
if (not Result) then exit;
Box := GetTPABounds(xTPA);
Rewardind := II;
//Writeln('Box: ' + IntToStr(Box.x1) + ', ' + IntToStr(Box.y1) + ', ' + IntToStr(Box.x2) + ', ' + IntToStr(Box.y2));
end;
{*******************************************************************************
procedure UseRewardBox: Boolean;
by: Nava2
Description: Finds the reward box, and opens it getting the reward.
*******************************************************************************}
function UseRewardBox: Boolean;
var
I, Time, Height, fx, fy, Index, bDTM: Integer;
Text, TPA: TPointArray;
B: TBox;
begin
Result := False;
if (not LoggedIn) then exit;
GameTab(tab_Inv);
if (not(FindColorTolerance(fX, fY, 5510016, MIX1, MIY1, MIX2, MIY2, 20))) then Exit;
bDTM := DTMFromString('78DA634C636660F8C8C8800CDA452219E4803' +
'448F43F1030A600D53C435503918591403A0AA8E6150135C94035' +
'BF09A82902AAF941841A427681DCFC00BF1A008DCA0E8C');
for I := 1 to 28 do
begin
B := InvBox(I);
if FindItemEx(fx, fy, 'dtm', bDTM, B, []) then
begin
InvMouse(I, 3);
Wait(RandomRange(100, 150));
Result := IsUpText('event gift');
if (Result) then Break;
end;
end;
FreeDTM(bDTM);
if (not Result) then exit;
GetMousePos(fx, fy);
Mouse(fx, fy, 0, 0, True);
Result := False;
Text := LoadTextTPA('hoose', UpChars, Height);
Time := GetTimeRunning + 10000;
FindColorsTolerance(TPA, 2070783, 185, 34, 327, 50, 3);
while (not Result and (GetTimeRunning < Time)) do
begin
Wait(RandomRange(80, 100));
FindColorsTolerance(TPA, 2070783, 185, 34, 327, 50, 3);
if (Length(TPA) > 10) then
Result := FindTextTPAinTPA(Height, Text, TPA, TPA);
end;
if (not Result) then
begin
SRL_Warn('OpenRewardBox', 'Could not open Reward Screen', Warn_AllVersions);
Exit;
end;
Wait(Random(100));
if (not FindBoxOption(B, Index)) then
begin
SRL_Warn('UseRewardBox', 'Could not find a usable option.', Warn_AllVersions);
Exit;
end;
Mouse(B.X1, B.Y1, 0, 0, True);
Time := GetTimeRunning + 2000;
Result := False;
while (not Result) and (GetTimeRunning < Time) do
begin
FindColorsTolerance(TPA, 1317148, 35, 70, 362, 311, 3);
Result := Length(TPA) > 50;
Wait(50 + Random(50));
end;
if (not Result) then
begin
CloseWindow;
Exit;
end;
MouseBox(413, 171, 469, 200, 1);
Time := GetSystemTime;
while (CountColorTolerance(1317148, B.x1 - 10, B.y1 - 10, B.x1 + 10, B.y1 + 10, 3) > 50) and (GetSystemTime - Time < 5000) do
begin
if (Pos('thing else', GetChatBoxText(8, clBlack)) > 0) then
begin
CloseWindow;
Wait(500 + Random(500));
SetLength(RB_SkipArray, Length(RB_SkipArray) + 1);
RB_SkipArray[High(RB_SkipArray)] := Index;
Result := UseRewardBox;
Break;
end;
Wait(100 + Random(200));
end;
RB_SkipArray := [];
if (CloseWindow) then
Result := False;
end;
{*******************************************************************************
function FindMod: Boolean;
by: Stupid3ooo
Description: Results True if a mod is found, then it waits 10-20 mins and logs back in
*******************************************************************************}
function FindMod: Boolean;
var
tX, tY: Integer;
begin
if (not UseFindMod) or (not LoggedIn) then exit;
if (BmpMod = 0) or (BmpAdmin = 0) then
LoadSRLBitMaps;
if (FindColorTolerance(tX, tY, 14737632, MCX1, MCY1, MCX1 + 40, MCY2, 15)) or
(FindColorTolerance(tX, tY, 589815, MCX1, MCY1, MCX1 + 40, MCY2, 15)) then
if (FindTransparentBitmapTolerance(bmpMod, tX, tY, clBlack, MCX1, MCY1, MCX1 + 40, MCY2, 15)) or
(FindTransparentBitmapTolerance(bmpAdmin, tx, ty, clBlack, MCX1, MCY1, MCX1 + 40, MCY2, 15)) then
begin
Result := True;
AddToSRLLog('******** FOUND MOD ********');
WriteLn('******** FOUND MOD ********');
TakeScreen('Found mod');
Inc(RandSolved[rand_Mod]);
SaveToChatLog;
if (SRL_Procs[srl_OnFindMod] <> nil) then
SRL_Procs[srl_OnFindMod]();
if (LogoutOnMod) then
begin
Players[CurrentPlayer].Rand := 'Found Mod';
repeat
Logout;
Wait(1500 + Random(500));
until not (LoggedIn);
Wait(60000 + Random(60000));
LoginPlayer;
Players[CurrentPlayer].Rand := '';
end;
end;
end;
{*******************************************************************************
function FindFight: Boolean;
by: EvilChicken!
Description: Results true if charachter is in a fight.
*******************************************************************************}
function FindFight: Boolean;
begin
Result := False;
if (not LoggedIn) then exit;
if (CountColor(10496, 200, 130, 280, 180) + CountColor(198716, 200, 130, 280, 180) > 50) then
begin
if (CheckHpFirst) and (HpPercent = 100) then exit;
Result := True;
AddToSRLLog('******** FOUND FIGHTING RANDOM ********');
WriteLn('******** FOUND FIGHTING RANDOM ********');
TakeScreen('Found Fight');
Inc(RandSolved[rand_Fight]);
end;
end;
{*******************************************************************************
function FindLamp(skill: String): Boolean;
by: Pups, Starblaster100 and PriSoner fixed by Lee Lok Hin
Description: handles Genie. Results True if lamp found and handled.
skill: Skill to use with lamp eg. 'strength', 'attack', etc.
*******************************************************************************}
function FindLamp(skill: string): Boolean;
var
LampTime, X, Y, I: Integer;
begin {
GameTab(tab_Inv);
if FindColorTolerance(x, y, 1084300, MIX1, MIY1, MIX2, MIY2, 40) then
if (FindTransparentBitmapTolerance(Lamp, x, y, clBlack, MIX1, MIY1, MIX2, MIY2, 40)) then
begin
Result := True;
Inc(RandSolved[rand_Lamp]);
TakeScreen('Lamp Random Solved');
AddToSRLLog('******** SOLVED LAMP RANDOM ********');
WriteLn('******** SOLVED LAMP RANDOM ********');
Mouse(X, Y, 4, 4, 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;
ClickToContinue;
end;
Mouse(416, 281, 7, 1, True);
Wait(500 + Random(150) + Random(150));
end; }
end;
{*******************************************************************************
function FindDead: Boolean;
by: Stupid3ooo and Cazax
Description: Checks for text "Oh dear you are dead".
Logs out player if Reincarnate = False.
*******************************************************************************}
function FindDead: Boolean;
begin
Result := False;
if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dear', SmallChars, Nothing) then
if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dead', SmallChars, Nothing) then
begin
Inc(RandSolved[rand_Death]);
Result := True;
SaveToChatLog;
if (SRL_Procs[srl_OnFindDead] <> nil) then
SRL_Procs[srl_OnFindDead]();
if (Reincarnate) then exit;
TakeScreen('Found Dead');
LogOut;
Players[CurrentPlayer].Rand := 'Oh Dear You Are in Lumby';
Players[CurrentPlayer].Active := False;
end;
end;
{*******************************************************************************
function Rand_GetRandomType: Integer;
by: ZephyrsFury
Description: Checks for the existance of various tabs to determine the type of
random we are in:
1: 13 or 14-tab randoms
2: 6-tab randoms.
*******************************************************************************}
function Rand_GetRandomType: Integer;
var
TabConfig: TIntegerArray;
begin
TabConfig := [tab_Stats, tab_Friends];
for Result := 1 to 2 do
if (TabExists(TabConfig[Result - 1])) then
Exit;
end;
{*******************************************************************************
procedure LoadTeleRandoms;
by: ZephyrsFury
Description: Loads the teleport random information for each random.
*******************************************************************************}
procedure LoadTeleRandoms;
begin
SetLength(TeleRandoms, 19);
with TeleRandoms[0] do //
begin
Name := 'leo the gravedigger';
Music := ['spooky'];
TypeID := 1;
IsInRandom := @InLeoGraveyard;
Texts := ['Leo'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveLeo;
RandIndex := rand_Leo;
end;
with TeleRandoms[1] do //
begin
Name := 'freaky forester';
Music := ['pheasant peasant'];
TypeID := 1;
IsInRandom := @InForesterRandom;
Texts := ['orester'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveForester;
RandIndex := rand_Forester;
end;
with TeleRandoms[2] do //
begin
Name := 'maze';
Music := ['time out'];
TypeID := 1;
IsInRandom := @InMaze;
Texts := ['mplete'];
TextColors := [15395562];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(131, 28, 194, 52)];
SolveRandom := @SolveMaze;
RandIndex := rand_Maze;
end;
with TeleRandoms[3] do //
begin
Name := 'prison pete';
Music := ['in the clink'];
TypeID := 1;
IsInRandom := @InPrisonPete;
Texts := [];
TextColors := [];
TextFonts := [];
TextBoxes := [];
SolveRandom := nil;
RandIndex := rand_PrisonPete;
end;
with TeleRandoms[4] do //
begin
Name := 'evil bob''s island';
Music := ['evil bob''s island'];
TypeID := 1;
IsInRandom := @InEvilBobsIsland;
Texts := [];
TextColors := [0];
TextFonts := [];
TextBoxes := [];
SolveRandom := @SolveEvilBob;
RandIndex := rand_ScapeRune;
end;
with TeleRandoms[5] do //
begin
Name := 'drill demon';
Music := ['corporal punishment'];
TypeID := 2;
IsInRandom := nil;
Texts := ['amien', 'amien'];
TextColors := [128, 0];
TextFonts := [NPCChars, NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveDemon;
RandIndex := rand_Demon;
end;
with TeleRandoms[6] do //Quiz with 6 tabs visibile
begin
Name := 'quiz';
Music := ['the quiz master'];
TypeID := 2;
IsInRandom := nil;
Texts := ['uiz', 'uiz'];
TextColors := [128, 0];
TextFonts := [NPCChars, NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveQuiz;
RandIndex := rand_Quiz;
end;
with TeleRandoms[7] do //Quiz with 13 tabs visible
begin
Name := 'quiz';
Music := [];
TypeID := 1;
IsInRandom := @InQuizRandom;
Texts := ['uiz', 'uiz'];
TextColors := [128, 0];
TextFonts := [NPCChars, NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveQuiz;
RandIndex := rand_Quiz;
end;
with TeleRandoms[8] do //
begin
Name := 'surprise exam';
Music := ['school''s out'];
TypeID := 2;
IsInRandom := nil;
Texts := ['ordaut'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveMordaut;
RandIndex := rand_Mordaut;
end;
with TeleRandoms[9] do //
begin
Name := 'molly''s evil twin';
Music := ['head to head'];
TypeID := 2;
IsInRandom := nil;
Texts := ['olly'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := nil;
RandIndex := rand_Molly;
end;
with TeleRandoms[10] do //
begin
Name := 'pinball';
Music := [''];//No music
TypeID := 2;
IsInRandom := @Pinball_InRandom;
Texts := ['lashing'];
TextColors := [8323072];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolvePinball;
RandIndex := rand_Pinball;
end;
with TeleRandoms[11] do //
begin
Name := 'sandwich lady';
Music := ['snack attack'];
TypeID := 2;
IsInRandom := nil;
Texts := ['andwich'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveSandwichLady;
RandIndex := rand_Sandwich;
end;
with TeleRandoms[12] do //
begin
Name := 'bee keeper';
Music := ['horizon'];
TypeID := 2;
IsInRandom := nil;
Texts := ['keeper'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveBeeKeeper;
RandIndex := rand_BeeKeeper;
end;
with TeleRandoms[13] do //
begin
Name := 'pillory';
Music := [];
TypeID := 2;
IsInRandom := nil;
Texts := ['swinging', 'pillory'];
TextColors := [128, 0];
TextFonts := [NPCChars, NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2), IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolvePilloryPuzzle;
RandIndex := rand_Pillory;
end;
with TeleRandoms[14] do //
begin
Name := 'cap''n arnav';
Music := ['sea shanty', 'sea shanty2'];
TypeID := 2;
IsInRandom := nil;
Texts := ['rnav'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveArnav;
RandIndex := rand_CapnArnav;
end;
with TeleRandoms[15] do // Abyss!
begin
Name := 'abyssal teleport';
Music := ['into the abyss'];
TypeID := 2;
IsInRandom := nil;
Texts := ['appendage'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveAbyss;
RandIndex := rand_Abyss;
end;
with TeleRandoms[16] do //
begin
Name := 'certer';
Music := ['harmony'];
TypeID := 2;
IsInRandom := nil;
Texts := ['iles'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveCerter;
RandIndex := rand_Certer;
end;
with TeleRandoms[17] do //
begin
Name := 'mime';
Music := ['artistry'];
TypeID := 2;
IsInRandom := nil;
Texts := ['Mime'];
TextColors := [0];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveMime;
RandIndex := rand_Mime;
end;
with TeleRandoms[18] do //
begin
Name := 'frog';
Music := ['frogland'];
TypeID := 2;
IsInRandom := nil;
Texts := ['erald'];
TextColors := [128];
TextFonts := [NPCChars];
TextBoxes := [IntToBox(MCX1, MCY1, MCX2, MCY2)];
SolveRandom := @SolveFrog;
RandIndex := rand_Frog;
end;
end;
procedure r_RunAlert; forward;
function r_CheckAction: Boolean; forward;
procedure r_ResetAll; forward;
{*******************************************************************************
function SolveTeleportRandoms: Boolean;
by: ZephyrsFury
Description: Handles the solving of Teleport randoms. Returns True if one is
detected.
*******************************************************************************}
function SolveTeleportRandoms: Boolean;
var
TypeID, H, HH, I, J: Integer;
B: TBox;
RandResult: Boolean;
Rand_Music: string;
InitCompAngle: Extended;
begin
TypeID := Rand_GetRandomType;
H := High(TeleRandoms);
for I := 0 to H do
begin
if (TypeID = TeleRandoms[I].TypeID) then
begin
if (TeleRandoms[I].IsInRandom <> nil) then
RandResult := TeleRandoms[I].IsInRandom();
if (TeleRandoms[I].IsInRandom = nil) or (RandResult) then
begin
Status('Possible Random: ' + Capitalize(TeleRandoms[I].Name));
Result := (Length(TeleRandoms[I].Texts) = 0) and (Length(TeleRandoms[I].Music) = 0);
if (not Result) and (Length(TeleRandoms[I].Music) > 0) then
begin
if (Rand_Music = '') then Rand_Music := Lowercase(GetMusic);
Result := InStrArr(Rand_Music, TeleRandoms[I].Music, False);
end;
if (not Result) and (Length(TeleRandoms[I].Texts) > 0) then
begin
HH := High(TeleRandoms[I].Texts)
for J := 0 to HH do
begin
B := TeleRandoms[I].TextBoxes[J];
Result := (FindTextTPA(TeleRandoms[I].TextColors[J], 0, B.X1, B.Y1, B.X2, B.Y2, TeleRandoms[I].Texts[J], TeleRandoms[I].TextFonts[J], Nothing));
if (Result) then Break;
end;
end;
end;
end;
if (not Result) then Continue;
InitCompAngle := rs_GetCompassAngleDegrees;
WriteLn('***** STR: FOUND RANDOM: ''' + Capitalize(TeleRandoms[I].Name) + ''' *****');
AddToSRLLog('***** STR: FOUND RANDOM: ''' + Capitalize(TeleRandoms[I].Name) + ''' *****');
TakeScreen('Found ' + Capitalize(TeleRandoms[I].Name) + ' random');
Players[CurrentPlayer].Rand := Capitalize(TeleRandoms[I].Name);
if (r_UseRandomTool) then
begin
PlaySound(SoundPath);
CurRandom := I;
r_RunAlert;
if (r_CheckAction) then
begin
WriteLn('***** STR: ''' + Capitalize(TeleRandoms[i].Name) + ''' RANDOM SOLVED BY HAND! *****');
AddToSRLLog('***** STR: ''' + Capitalize(TeleRandoms[i].Name) + ''' RANDOM SOLVED BY HAND! *****');
Players[CurrentPlayer].Rand := '';
Wait(5000 + Random(2000));
r_ResetAll;
Exit;
end;
r_ResetAll;
end;
ClickNorth(True);
RandResult := False;
if (TeleRandoms[I].SolveRandom <> nil) and (SolveSRLRandoms) then
RandResult := TeleRandoms[I].SolveRandom();
if (RandResult) then
begin
WriteLn('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVED SUCCESSFULLY! *****');
AddToSRLLog('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVED SUCCESSFULLY! *****');
Inc(RandSolved[TeleRandoms[I].RandIndex]);
Players[CurrentPlayer].Rand := '';
Wait(10000 + Random(2000));
end else
begin
WriteLn('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVING FAILED! *****');
AddToSRLLog('***** STR: ''' + Capitalize(TeleRandoms[I].Name) + ''' RANDOM SOLVING FAILED! *****');
Inc(RandFailed[TeleRandoms[I].RandIndex]);
Players[CurrentPlayer].Active := False;
LogOut;
while (LoggedIn) do
Wait(2000);
end;
MakeCompass(InitCompAngle);
Exit;
end;
end;
{*******************************************************************************
function FindNonInventoryRandoms: Boolean;
by: The SRL Developers Team!... all time sexiness by Mutant
Description: Searches for the common NON-Inventory randoms: Won't switch to GameTab(4)!
*******************************************************************************}
function FindNonInventoryRandoms: Boolean;
var
I: Byte;
begin
for I := 1 to 5 do
begin
case I of
1: Result := SolveTeleportRandoms;
2: Respond;
3: Result := FindDead;
4: Result := RC;
5: if (SRL_Procs[srl_OnRandomCall] <> nil) then
SRL_Procs[srl_OnRandomCall]();
end;
if (Result) then
begin
if (SRL_Procs[srl_OnFindRandom] <> nil) then
SRL_Procs[srl_OnFindRandom]();
Break;
end;
end;
end;
{*******************************************************************************
function FindNormalRandoms: Boolean;
by: The SRL Developers Team!... all time sexiness by Mutant
Description: Calls the 'normal' random checks.
*******************************************************************************}
function FindNormalRandoms: Boolean;
var
I: Byte;
begin
for I := 1 to 8 do
begin
case I of
1: Result := SolveTeleportRandoms;
2: Respond;
3: Result := FindDead;
4: Result := FindLamp(LampSkill);
5: Result := RC;
6: Result := FindMod;
7: if (SRL_Procs[srl_OnRandomCall] <> nil) then
SRL_Procs[srl_OnRandomCall]();
8: if High(Players[CurrentPlayer].BoxRewards) > -1 then
Result := UseRewardBox;
end;
if (Result) then
begin
if (SRL_Procs[srl_OnFindRandom] <> nil) then
SRL_Procs[srl_OnFindRandom]();
Break;
end;
end;
end;
To Devs: while your looking at this, could you please look at my Forester Solver and my Drill Demon Solver Changes because they both need to committed because the current solvers aren't working / has bugs.