SRL Archive - Reflection Development

Mordaut solver = great


Cstrike

2010-10-29 01:42:45

Mordaut is turning out to be easier than I thought. I just REALLY need help with strings.

Thus far, the code works flawlessly. In fact, it works too flawlessly, needed to add a mega wait in there to act human.

QUESTION 1 OF 3 DONE SO FAR, ATTEMPTING REST TOMORROW:
Here is code minus credits:

const
EXAM_QUESTIONEONEINTERFACE = 103;

// Gets Component ID
function R_ExamGrabComponentID (ParentI, ChildI : Integer) : Integer;
var
Child: Integer;
begin
Child := GetInterface(ParentI, ChildI);
Result := SmartGetFieldInt(Child, hook_interface_GetID);
SmartFreeObject(Child);
end;

// Shut his interfaces up, or if important they will be processed first and result in something
procedure R_ExamShutMordautUp;
var
t : Integer;
begin
if not LoggedIn then Exit;
MarkTime(t);
repeat
if (GetInterfaceText(243, 6) = 'object to come next in a pattern.')
or (GetInterfaceText(243, 6) = 'select them and confirm.')
or (GetInterfaceText(241, 4) = '<p=68>Pick the object that should come next in the pattern.') then Mouse(303, 452, 72, 7, True);
wait (2000+random(2000));
if (TimeFromMark(t) > 20000) then Exit;
until (not ValidInterface(243)) and (not ValidInterface(241))
end;

// Returns name
function R_ExamReturnModelName (ID : Integer) : String;
begin
if not LoggedIn then Exit;
Result := 'none';
case ID of
11539, 11540, 11541, 11614, 11615, 11633: Result := 'range';

11526, 11529, 11545, 11549, 11550, 11555, 11560, 11563, 11564, 11607,
11608, 11616, 11620, 11621, 11622, 11623, 11628, 11629, 11634, 11639,
11641, 11649, 11624: Result := 'cooking';

11527, 11574, 11578, 11580, 11599, 11600, 11601, 11602, 11603, 11604,
11605, 11606, 11625: Result := 'fishing';

11528, 11531, 11536, 11537, 11579, 11591, 11592, 11593, 11597, 11627,
11631, 11635, 11636, 11638, 11642, 11648, 11617: Result := 'combat';

11530, 11532, 11547, 11548, 11554, 11556, 11571, 11581, 11586, 11610,
11645: Result := 'farming';

11533, 11534, 11538, 11562, 11567, 11582: Result := 'magic';

11535, 11551, 11552, 11559, 11646: Result := 'firemaking';

11540, 11557, 11558, 11560, 11570, 11619, 11626, 11630, 11632, 11637,
11654: Result := 'hats';

11570, 11626, 11558: Result := 'pirate';

11572, 11576, 11652: Result := 'jewellery';

11542, 11543, 11544, 11644, 11647: Result := 'drinks';

11573, 11595: Result := 'woodcutting';

11561, 11618, 11650, 11651: Result := 'boots';

11546, 11553, 11565, 11566, 11568, 11569, 11572, 11575, 11576, 11577,
11581, 11583, 11584, 11585, 11643, 11652, 11653: Result := 'crafting';

11587, 11588, 11594, 11596, 11598, 11609, 11610: Result := 'mining';

11611, 11612, 11613: Result := 'fishing';
end;
end;

// Searches for slot that is answer and clicks it
function R_ExamCompleteQ1 (IntNum, CompNumLow, CompNumHigh : Integer; Name : String) : Boolean;
var
i, ItemID, xpos : Integer;
ItemName : String;
begin
if not LoggedIn then Exit;
result := false;
if not (ValidInterface (EXAM_QUESTIONEONEINTERFACE)) then Exit;
for i:=CompNumLow to CompNumHigh do
begin
ItemID := R_ExamGrabComponentID(EXAM_QUESTIONEONEINTERFACE, i);
ItemName := R_ExamReturnModelName(ItemID);
if ItemName = Name then
begin
Writeln ('[Reflection] Found match at position '+inttostr(i)+' in range '+inttostr(CompNumLow)+'/'+inttostr(CompNumHigh));
wait (3500+random(6200)); // High wait times since this solves it literally instantly
xpos := 109+((i-CompNumLow)*96);
Mouse (xpos, 220, 16, 14, true);
Exit;
end;
end;
Writeln ('[Reflection] Found no match in question 1 at the bottom four objects');
end;

// Using TIA, returns most common name
function R_ExamCheckModeOfNames (ItemIDs : TIntegerArray) : String;
var
ItemNameArr : TStringArray;
i : Integer;
begin
SetArrayLength (ItemNameArr, high(ItemIDs)+1);
Result := 'none'
for i:=0 to high(ItemIDs) do
begin
ItemNameArr[i] := R_ExamReturnModelName(ItemIDs[i]);
end;
if (ItemNameArr[0] = ItemNameArr[1]) or (ItemNameArr[0] = ItemNameArr[2]) or (ItemNameArr[1] = ItemNameArr[2]) then
begin
Writeln ('[Reflection] Perfect match found for name: '+ItemNameArr[0]);
Result := ItemNameArr[0];
end else
if (ItemNameArr[0] = ItemNameArr[1]) or (ItemNameArr[0] = ItemNameArr[2]) then
begin
Writeln ('[Reflection] Partial match found for name: '+ItemNameArr[0]);
Result := ItemNameArr[0];
end else
if (ItemNameArr[1] = ItemNameArr[2]) then
begin
Writeln ('[Reflection] Partial match found for name: '+ItemNameArr[0]);
Result := ItemNameArr[1];
end else Writeln ('[Reflection] Warning: No match found for any of the items!');
end;

// Handles Q1
function R_ExamQuestionOne : Boolean;
var
ThreeItemIDs : TIntegerArray;
i : Integer;
CommonType : String;
begin
if not LoggedIn then Exit;
Result := False;
R_ExamShutMordautUp; // Place me elsewhere later
if not (ValidInterface (EXAM_QUESTIONEONEINTERFACE)) then Exit;
SetArrayLength (ThreeItemIDs, 3);
for i:=6 to 8 do
begin
ThreeItemIDs[i-6] := R_ExamGrabComponentID (EXAM_QUESTIONEONEINTERFACE, i); // Minus 6 to start at index zero
end;
Writeln ('[Reflection] IDs obtained for three items in Question one: '+inttostr(ThreeItemIDs[0])+', '+inttostr(ThreeItemIDs[1])+', '+inttostr(ThreeItemIDs[2]));
CommonType := R_ExamCheckModeOfNames (ThreeItemIDs);
Writeln ('[Reflection] Common name obtained: '+CommonType+', searching for IDs in the bottom row that match this name');
if R_ExamCompleteQ1(EXAM_QUESTIONEONEINTERFACE, 10, 13, CommonType) then Result := True;
end;

This pretty much will be solved tomrorow
BUT I NEED HELP WITH STRINGS BADLY
My weakness keeps kicking me in the balls. Does anyone know how to find string 'ABC' in 'AD IADJ NE XXABCH EIORJA'?

Overtime

2010-10-29 01:45:36

wow so beautiful, one of the most annoying randoms that i always get when botting in msi -_-

I think im just going to throw in there to see how it runs :D

mormonman

2010-10-29 01:47:35

Why re-invent the wheel, just update old solvers.
http://code.google.com/p/scardevreflection/source/browse/trunk/AntiRandoms/Mordaut.scar

And to answer your question on strings:

if(pos('abc','sdja;sk ysiabca dk') > 0) then
writeln('yay');

Cstrike

2010-10-29 01:49:12

From: Squancy
wow so beautiful, one of the most annoying randoms that i always get when botting in msi -_-

I think im just going to throw in there to see how it runs :D


It should solve Question 1 if you run the R_SolveQ1thing ;)


From: mormonman
Why re-invent the wheel, just update old solvers.
http://code.google.com/p/scardevreflection/source/browse/trunk/AntiRandoms/Mordaut.scar


WTF I didn't know that existed… if that works I'll just use that
Testing right now….


CODE
var
RS_RMordaut: TNPC;
RS_MRanged, RS_MCooking, RS_MFishing, RS_MCombat, RS_MFarming,
RS_MMagic, RS_MFiremaking, RS_MHats, RS_MDrinks, RS_MWoodcutting,
RS_MBoots, RS_MCrafting, RS_MMining, RS_MSmithing: TIntegerArray;
RS_MItems: array of TIntegerArray;
RS_MQuestions: array of TStringArray;
RS_MDoor, RS_MDir: String;

{*******************************************************************************
procedure R_SetMordautVars;
By: Drags111
Description: Sets the vars needed for mordaut.
*******************************************************************************}
procedure R_SetMordautVars;
begin
RS_MRanged := [11539, 11540, 11541, 11614, 11615, 11633];
RS_MCooking := [11526, 11529, 11545, 11549, 11550, 11555,
11560, 11563, 11564, 11607, 11608, 11616,
11620, 11621, 11622, 11623, 11628, 11629,
11634, 11639, 11641, 11649, 11624];
RS_MFishing := [11527, 11574, 11578, 11580, 11599, 11600,
11601, 11602, 11603, 11604, 11605, 11606,
11625];
RS_MCombat := [11528, 11531, 11536, 11537, 11579, 11591,
11592, 11593, 11597, 11627, 11631, 11635,
11636, 11638, 11642, 11648];
RS_MFarming := [11530, 11532, 11547, 11548, 11554, 11556,
11571, 11581, 11586, 11610, 11645];
RS_MMagic := [11533, 11534, 11538, 11562, 11567, 11582];
RS_MFiremaking:= [11535, 11551, 11552, 11559, 11646];
RS_MHats := [11540, 11557, 11558, 11560, 11570, 11619,
11626, 11630, 11632, 11637, 11654];
RS_MDrinks := [11542, 11543, 11544, 11644, 11647];
RS_MWoodcutting:=[11573, 11595];
RS_MBoots := [11561, 11618, 11650, 11651];
RS_MCrafting := [11546, 11553, 11565, 11566, 11568, 11569,
11572, 11575, 11576, 11577, 11581, 11583,
11584, 11585, 11643, 11652, 11653];
RS_MMining := [11587, 11588, 11594, 11596, 11598, 11609,
11610];
RS_MSmithing := [11611, 11612, 11613];
RS_MItems := [RS_MRanged, RS_MCooking, RS_MFishing, RS_MCombat, RS_MFarming,
RS_MMagic, RS_MFiremaking, RS_MHats, RS_MDrinks, RS_MWoodcutting,
RS_MBoots, RS_MCrafting, RS_MMining, RS_MSmithing];
SetLength(RS_MQuestions, 50);
RS_MQuestions[0] := ['I''m feeling dehydrated','Drinks'];
RS_MQuestions[1] := ['quenched my thirst','Drinks'];
RS_MQuestions[2] := ['light my fire','Firemaking'];
RS_MQuestions[3] := ['fishy','Fishing'];
RS_MQuestions[4] := ['fishing for answers','Fishing'];
RS_MQuestions[5] := ['fish out of water','Drinks'];
RS_MQuestions[6] := ['strange headgear','Hats'];
RS_MQuestions[7] := ['tip my hat','Hats'];
RS_MQuestions[8] := ['thinking cap','Hats'];
RS_MQuestions[9] := ['wizardry here','Magic'];
RS_MQuestions[10] := ['rather mystical','Magic'];
RS_MQuestions[11] := ['abracada','Magic'];
RS_MQuestions[12] := ['hide one''s face','Hats'];
RS_MQuestions[13] := ['shall unmask','Hats'];
RS_MQuestions[14] := ['hand-to-hand','Combat'];
RS_MQuestions[15] := ['melee weapon','Combat'];
RS_MQuestions[16] := ['me hearties','Hats'];
RS_MQuestions[17] := ['mighty pirate','Drinks']
RS_MQuestions[18] := ['mighty archer','Ranged'];
RS_MQuestions[19] := ['shiny things','Crafting'];
RS_MQuestions[20] := ['range','Ranged'];
RS_MQuestions[21] := ['arrow','Ranged'];
RS_MQuestions[22] := ['drink','Drinks'];
RS_MQuestions[23] := ['logs','Firemaking'];
RS_MQuestions[24] := ['light','Firemaking'];
RS_MQuestions[25] := ['headgear','Hats'];
RS_MQuestions[26] := ['hat','Hats'];
RS_MQuestions[27] := ['cap','Hats'];
RS_MQuestions[28] := ['mine','Mining'];
RS_MQuestions[29] := ['mining','Mining'];
RS_MQuestions[30] := ['ore','Mining'];
RS_MQuestions[31] := ['fish','Fishing'];
RS_MQuestions[32] := ['fishing','Fishing'];
RS_MQuestions[33] := ['thinking cap','Hats'];
RS_MQuestions[34] := ['cooking','Cooking'];
RS_MQuestions[35] := ['cook','Cooking'];
RS_MQuestions[36] := ['bake','Cooking'];
RS_MQuestions[37] := ['farm','Farming'];
RS_MQuestions[38] := ['farming','Farming'];
RS_MQuestions[39] := ['cast','Magic'];
RS_MQuestions[40] := ['magic','Magic'];
RS_MQuestions[41] := ['craft','Crafting'];
RS_MQuestions[42] := ['boot','Boots'];
RS_MQuestions[43] := ['chop','Woodcutting'];
RS_MQuestions[44] := ['cut','Woodcutting'];
RS_MQuestions[45] := ['tree','Woodcutting'];
RS_MQuestions[46] := ['melee','Combat'];
RS_MQuestions[47] := ['fire','Firemaking'];
RS_MQuestions[48] := ['sparks from','Firemaking'];
RS_MQuestions[49] := ['thirsty','Drinks'];
end;

{*******************************************************************************
function R_InMordaut: boolean;
By: Drags111
Description: Checks if we are in the mordaut random.
*******************************************************************************}
function R_InMordaut: boolean;
begin
Result := FindNPC(6117, RS_RMordaut);
end;

{*******************************************************************************
function R_InRelatedCards: boolean;
By: Drags111
Description: Checks if we are in the related cards question.
*******************************************************************************}
function R_InRelatedCards: boolean;
begin
Result := ValidInterface(559);
end;

{*******************************************************************************
function R_InNextObject: boolean;
By: Drags111
Description: Checks if we are in the next object question.
*******************************************************************************}
function R_InNextObject: boolean;
begin
Result := ValidInterface(103);
end;

{*******************************************************************************
function R_MIDToClass(ID: Integer): string;
By: Drags111
Description: Converts ID to category type.
*******************************************************************************}
function R_MIDToClass(ID: Integer): string;
var
i, ci: integer;
begin
ci := -1;
for i := 0 to High(RS_MItems) do
if InIntArray(RS_MItems[i], ID) then ci := i;
case ci of
-1: Result := 'Error';
0: Result := 'Ranged';
1: Result := 'Cooking';
2: Result := 'Fishing';
3: Result := 'Combat';
4: Result := 'Farming';
5: Result := 'Magic';
6: Result := 'Firemaking';
7: Result := 'Hats';
8: Result := 'Drinks';
9: Result := 'Wooductting';
10: Result := 'Boots';
11: Result := 'Crafting';
12: Result := 'Mining';
13: Result := 'Smithing';
else Result := 'Error 2.';
end;
end;

{*******************************************************************************
function R_MQuestionToClass(Question: String): string;
By: Drags111
Description: Converts question to category.
*******************************************************************************}
function R_MQuestionToClass(Question: String): string;
var
i: integer;
begin
Result := '-1';
for i := 0 to High(RS_MQuestions) do
if (Pos(lowercase(RS_MQuestions[i][0]), Lowercase(Question)) > 0) then
begin
Result := RS_MQuestions[i][1]
Exit;
end;
end;

{*******************************************************************************
function R_MTalkWait: boolean;
By: Drags111
Description: Waits to talk to mordaut.
*******************************************************************************}
function R_MTalkWait: boolean;
var
T: Integer;
P: TPoint;
begin
T := GetSystemTime;
if not R_InMordaut then Exit;
While not Result do
begin
if not R_InMordaut then Exit;
if ValidInterface(242) or ValidInterface(64) or ValidInterface(243) then Exit;
if (GetSystemTime-T) > 3000 then
begin
if not TileOnMS(RS_RMordaut.Tile, 20) then
WalkToTile(Point(RS_RMordaut.Tile.X, RS_RMordaut.Tile.Y-2), 0, 0);
wait(700+Random(700));
P := TileToMS(RS_RMordaut.Tile, RS_RMordaut.Height * 2 / 3);
Mouse(P.x, P.y, 2, 2, false);
wait(100+Random(100));
if R_chooseOption('Talk')then
begin
wait(100+Random(100));
While characterMoving do wait(100+Random(100));
While (not ValidInterface(242)) and (not ValidInterface(241)) and
(not ValidInterface(64)) and (not ValidInterface(243))do wait(100+Random(100));
wait(700+Random(700));
end;
end;
Result := ValidInterface(241) or ValidInterface(64) or ValidInterface(242)
or ValidInterface(243);
end;
end;

{*******************************************************************************
function RS_MFindDoorChat: boolean;
By: Drags111
Description: Finds the text in the chat box about the door to use.
*******************************************************************************}
function RS_MFindDoorChat: boolean;
var
S: String;
begin
if not ValidInterface(242) then Exit;
S := GetInterfaceText(242, 4);
if Pos('To exit', S) < 1 then Exit;
S := Between('use the ', ' ', S);
RS_MDoor := S;
S := GetInterfaceText(242, 4);
RS_MDir := Between('door in the ', ' ', S);
Writeln('Time to leave! Door: '+RS_MDoor+', Direction: '+RS_MDir);
Result := True;
end;

{*******************************************************************************
function R_MGetQuestion: String;
By: Drags111
Description: Gets the question to answer.
*******************************************************************************}
function R_MGetQuestion: String;
var
qx, qy: integer;
begin
While not(R_InRelatedCards) and not(R_InNextObject)do
begin
if not R_InMordaut then Exit;
if RS_MFindDoorChat then
begin
Result := 'Door';
Exit;
end;
if (FindColorTolerance(qx, qy, 8388608, 184, 425, 365, 457, 2) or
FindColorTolerance(qx, qy, 16711680, 184, 425, 365, 457, 2)) then
begin
wait(100+Random(100));
Mouse(qx, qy+5, 0, 0, true);
MouseBox(19, 362, 393, 427, 3);
wait(100+Random(100));
ChatWait;
end;
end;
if R_InRelatedCards then
begin
Writeln('Question type: Related Cards.');
Result := 'Cards';
end;
if R_InNextObject then
begin
Writeln('Question type: Next Object.');
Result := 'Objects';
end;
end;

{*******************************************************************************
function R_ExitMordaut: boolean;
By: Drags111
Description: Exits through the right door.
*******************************************************************************}
function R_ExitMordaut: boolean;
var
ID, OffsetX, OffsetY, Time: integer;
T: TPoint;
begin
case lowercase(RS_MDoor) of
'red': ID := 2188;
'green': ID := 2193;
'blue': ID := 1289;
'purple': ID := 2192;
else Writeln('INVALID DOOR COLOR');
end;
if not FindObject(T, ID)then Exit;
case lowercase(RS_MDir) of
'north':begin
R_MakeCompass('N');
//OffsetY := 1;
end;
'south':begin
R_MakeCompass('S');
//OffsetY := -1;
end;
'east': begin
R_MakeCompass('E');
//OffsetX := 1;
end;
'west': begin
R_MakeCompass('W');
//OffsetX := -1;
end;
end;
if not TileOnMS(Point(T.X+OffsetX, T.Y+OffsetY), 15)then
WalkToTile(T, 0, 0);
While CharacterMoving do wait(100+Random(100));
Wait(1000+Random(1000));
T := TileToMS(Point(T.X+OffsetX, T.Y+OffsetY), 15);
Mouse(T.X, T.Y, 5, 5, false);
WaitForMenu(1000);
Result := R_ChooseOption('Open');
WaitToMove(1000);
While CharacterMoving do wait(100+Random(100));
MarkTime(Time);
While R_InMordaut and (TimeFromMark(Time) < 5000) do Wait(100+Random(100));
end;

{*******************************************************************************
function R_MNextObject: boolean;
By: Drags111
Description: Does the next object question.
*******************************************************************************}
function R_MNextObject: boolean;
var
Cat: String;
MF: Boolean;
i, qx, qy, fi: integer;
begin
fi := 5;
repeat
if not ValidInterface(103) then Exit;
Inc(fi);
if (fi > 8)then Exit;
Writeln(inttostr(GetComponentID(103, fi)));
Cat := R_MIDToClass(GetComponentID(103, fi));
Writeln('Current category is: '+Cat);
if not ValidInterface(103) then Exit;
for i := 10 to 13 do
if (R_MIDToClass(GetComponentID(103, i)) = Cat)then
begin
MF := True;
Break;
end;
if not ValidInterface(103) then Exit;
if MF then
begin
Result := true;
Writeln('Found item at slot: '+inttostr(i-9));
While not OptionExists('Select') do
begin
MMouse(7+(i-9)*99, 244, 3, 3);
wait(50+Random(50));
end;
GetMousePos(qx, qy);
Mouse(qx, qy, 0, 0, true);
While ValidInterface(103) do wait(100+Random(100));
end;
until Result;
end;

{*******************************************************************************
procedure RS_MouseCardSlot(slot: integer);
By: Drags111
Description: Read the name, im tired. its late.
*******************************************************************************}
procedure RS_MouseCardSlot(slot: integer);
var
P: TPoint;
begin
Writeln(inttostr(GetComponentID(559, slot+41)));
case slot of
1: P := Point(67, 78);
2: P := Point(133, 68);
3: P := Point(204, 76);
4: P := Point(271, 81);
5: P := Point(341, 79);
6: P := Point(67, 167);
7: P := Point(133, 167);
8: P := Point(204, 167);
9: P := Point(271, 167);
10: P := Point(341, 167);
11: P := Point(67, 253);
12: P := Point(133, 253);
13: P := Point(204, 253);
14: P := Point(271, 253);
15: P := Point(341, 253);
end;
Mouse(P.x, P.y, 5, 5, true);
wait(500+Random(500));
end;

{*******************************************************************************
function R_MRelatedCards: boolean;
By: Drags111
Description: Referr to previous description.
*******************************************************************************}
procedure R_MRelatedCards;
var
Cat: String;
i: integer;
begin
if not ValidInterface(559) then Exit;
Writeln(GetInterfaceText(559, 25));
Cat := R_MQuestionToClass(GetInterfaceText(559, 25));
Writeln(Cat);
for i := 42 to 56 do
begin
if (R_MIDToClass(GetComponentID(559, i)) = Cat) then
RS_MouseCardSlot(i-41);
end;
if not ValidInterface(559) then Exit;
MouseBox(422, 262, 436, 276, 1);
While ValidInterface(559) do wait(100+Random(100));
wait(1000+Random(1000));
end;

{*******************************************************************************
function R_SolveMordaut: boolean;
By: Drags111
Description: Weeeeee
*******************************************************************************}
function R_SolveMordaut: boolean;
var
QT: String;
begin
if not R_InMordaut then Exit;
Inc(R_RandomsDetected);
Writeln('*** Mordaut Detected! ***');
R_SetMordautVars;
while R_InMordaut do
begin
if not R_InMordaut then Break;
while (QT = '') do
begin
R_MTalkWait;
QT := R_MGetQuestion;
end;
Writeln('QT := '+QT);
wait(2000+Random(1000));
case QT of
'Door': R_ExitMordaut;
'Cards': R_MRelatedCards;
'Objects': R_MNextObject;
end;
QT := '';
end;
if R_LoggedIn then
begin
Result := True;
Inc(RSolved[RSchool]);
AddToReport('Solved Mordaut Random!');
end else
Inc(RFailed[RSchool]);
end;

mormonman

2010-10-29 01:51:49

read my other post…

Cstrike

2010-10-29 01:57:03

From: mormonman
read my other post…


Did, TY :)


function GetComponentID (ParentI, ChildI : Integer) : Integer;
var
Child: Integer;
begin
Child := GetInterface(ParentI, ChildI);
Result := SmartGetFieldInt(Child, hook_interface_GetID);
SmartFreeObject(Child);
end;

var
RS_RMordaut: TNPC;
RS_MRanged, RS_MCooking, RS_MFishing, RS_MCombat, RS_MFarming,
RS_MMagic, RS_MFiremaking, RS_MHats, RS_MDrinks, RS_MWoodcutting,
RS_MBoots, RS_MCrafting, RS_MMining, RS_MSmithing: TIntegerArray;
RS_MItems: array of TIntegerArray;
RS_MQuestions: array of TStringArray;
RS_MDoor, RS_MDir: String;

{*******************************************************************************
procedure R_SetMordautVars;
By: Drags111
Description: Sets the vars needed for mordaut.
*******************************************************************************}
procedure R_SetMordautVars;
begin
RS_MRanged := [11539, 11540, 11541, 11614, 11615, 11633];
RS_MCooking := [11526, 11529, 11545, 11549, 11550, 11555,
11560, 11563, 11564, 11607, 11608, 11616,
11620, 11621, 11622, 11623, 11628, 11629,
11634, 11639, 11641, 11649, 11624];
RS_MFishing := [11527, 11574, 11578, 11580, 11599, 11600,
11601, 11602, 11603, 11604, 11605, 11606,
11625];
RS_MCombat := [11528, 11531, 11536, 11537, 11579, 11591,
11592, 11593, 11597, 11627, 11631, 11635,
11636, 11638, 11642, 11648];
RS_MFarming := [11530, 11532, 11547, 11548, 11554, 11556,
11571, 11581, 11586, 11610, 11645];
RS_MMagic := [11533, 11534, 11538, 11562, 11567, 11582];
RS_MFiremaking:= [11535, 11551, 11552, 11559, 11646];
RS_MHats := [11540, 11557, 11558, 11560, 11570, 11619,
11626, 11630, 11632, 11637, 11654];
RS_MDrinks := [11542, 11543, 11544, 11644, 11647];
RS_MWoodcutting:=[11573, 11595];
RS_MBoots := [11561, 11618, 11650, 11651];
RS_MCrafting := [11546, 11553, 11565, 11566, 11568, 11569,
11572, 11575, 11576, 11577, 11581, 11583,
11584, 11585, 11643, 11652, 11653];
RS_MMining := [11587, 11588, 11594, 11596, 11598, 11609,
11610];
RS_MSmithing := [11611, 11612, 11613];
RS_MItems := [RS_MRanged, RS_MCooking, RS_MFishing, RS_MCombat, RS_MFarming,
RS_MMagic, RS_MFiremaking, RS_MHats, RS_MDrinks, RS_MWoodcutting,
RS_MBoots, RS_MCrafting, RS_MMining, RS_MSmithing];
SetLength(RS_MQuestions, 50);
RS_MQuestions[0] := ['I''m feeling dehydrated','Drinks'];
RS_MQuestions[1] := ['quenched my thirst','Drinks'];
RS_MQuestions[2] := ['light my fire','Firemaking'];
RS_MQuestions[3] := ['fishy','Fishing'];
RS_MQuestions[4] := ['fishing for answers','Fishing'];
RS_MQuestions[5] := ['fish out of water','Drinks'];
RS_MQuestions[6] := ['strange headgear','Hats'];
RS_MQuestions[7] := ['tip my hat','Hats'];
RS_MQuestions[8] := ['thinking cap','Hats'];
RS_MQuestions[9] := ['wizardry here','Magic'];
RS_MQuestions[10] := ['rather mystical','Magic'];
RS_MQuestions[11] := ['abracada','Magic'];
RS_MQuestions[12] := ['hide one''s face','Hats'];
RS_MQuestions[13] := ['shall unmask','Hats'];
RS_MQuestions[14] := ['hand-to-hand','Combat'];
RS_MQuestions[15] := ['melee weapon','Combat'];
RS_MQuestions[16] := ['me hearties','Hats'];
RS_MQuestions[17] := ['mighty pirate','Drinks']
RS_MQuestions[18] := ['mighty archer','Ranged'];
RS_MQuestions[19] := ['shiny things','Crafting'];
RS_MQuestions[20] := ['range','Ranged'];
RS_MQuestions[21] := ['arrow','Ranged'];
RS_MQuestions[22] := ['drink','Drinks'];
RS_MQuestions[23] := ['logs','Firemaking'];
RS_MQuestions[24] := ['light','Firemaking'];
RS_MQuestions[25] := ['headgear','Hats'];
RS_MQuestions[26] := ['hat','Hats'];
RS_MQuestions[27] := ['cap','Hats'];
RS_MQuestions[28] := ['mine','Mining'];
RS_MQuestions[29] := ['mining','Mining'];
RS_MQuestions[30] := ['ore','Mining'];
RS_MQuestions[31] := ['fish','Fishing'];
RS_MQuestions[32] := ['fishing','Fishing'];
RS_MQuestions[33] := ['thinking cap','Hats'];
RS_MQuestions[34] := ['cooking','Cooking'];
RS_MQuestions[35] := ['cook','Cooking'];
RS_MQuestions[36] := ['bake','Cooking'];
RS_MQuestions[37] := ['farm','Farming'];
RS_MQuestions[38] := ['farming','Farming'];
RS_MQuestions[39] := ['cast','Magic'];
RS_MQuestions[40] := ['magic','Magic'];
RS_MQuestions[41] := ['craft','Crafting'];
RS_MQuestions[42] := ['boot','Boots'];
RS_MQuestions[43] := ['chop','Woodcutting'];
RS_MQuestions[44] := ['cut','Woodcutting'];
RS_MQuestions[45] := ['tree','Woodcutting'];
RS_MQuestions[46] := ['melee','Combat'];
RS_MQuestions[47] := ['fire','Firemaking'];
RS_MQuestions[48] := ['sparks from','Firemaking'];
RS_MQuestions[49] := ['thirsty','Drinks'];
end;

{*******************************************************************************
function R_InMordaut: boolean;
By: Drags111
Description: Checks if we are in the mordaut random.
*******************************************************************************}
function R_InMordaut: boolean;
begin
Result := FindNPC(6117, RS_RMordaut);
end;

{*******************************************************************************
function R_InRelatedCards: boolean;
By: Drags111
Description: Checks if we are in the related cards question.
*******************************************************************************}
function R_InRelatedCards: boolean;
begin
Result := ValidInterface(559);
end;

{*******************************************************************************
function R_InNextObject: boolean;
By: Drags111
Description: Checks if we are in the next object question.
*******************************************************************************}
function R_InNextObject: boolean;
begin
Result := ValidInterface(103);
end;

{*******************************************************************************
function R_MIDToClass(ID: Integer): string;
By: Drags111
Description: Converts ID to category type.
*******************************************************************************}
function R_MIDToClass(ID: Integer): string;
var
i, ci: integer;
begin
ci := -1;
for i := 0 to High(RS_MItems) do
if InIntArray(RS_MItems[i], ID) then ci := i;
case ci of
-1: Result := 'Error';
0: Result := 'Ranged';
1: Result := 'Cooking';
2: Result := 'Fishing';
3: Result := 'Combat';
4: Result := 'Farming';
5: Result := 'Magic';
6: Result := 'Firemaking';
7: Result := 'Hats';
8: Result := 'Drinks';
9: Result := 'Wooductting';
10: Result := 'Boots';
11: Result := 'Crafting';
12: Result := 'Mining';
13: Result := 'Smithing';
else Result := 'Error 2.';
end;
end;

{*******************************************************************************
function R_MQuestionToClass(Question: String): string;
By: Drags111
Description: Converts question to category.
*******************************************************************************}
function R_MQuestionToClass(Question: String): string;
var
i: integer;
begin
Result := '-1';
for i := 0 to High(RS_MQuestions) do
if (Pos(lowercase(RS_MQuestions[i][0]), Lowercase(Question)) > 0) then
begin
Result := RS_MQuestions[i][1]
Exit;
end;
end;

{*******************************************************************************
function R_MTalkWait: boolean;
By: Drags111
Description: Waits to talk to mordaut.
*******************************************************************************}
function R_MTalkWait: boolean;
var
T: Integer;
P: TPoint;
begin
T := GetSystemTime;
if not R_InMordaut then Exit;
While not Result do
begin
if not R_InMordaut then Exit;
if ValidInterface(242) or ValidInterface(64) or ValidInterface(243) then Exit;
if (GetSystemTime-T) > 3000 then
begin
if not TileOnMS(RS_RMordaut.Tile, 20) then
WalkToTile(Point(RS_RMordaut.Tile.X, RS_RMordaut.Tile.Y-2), 0, 0);
wait(700+Random(700));
P := TileToMS(RS_RMordaut.Tile, RS_RMordaut.Height * 2 / 3);
Mouse(P.x, P.y, 2, 2, false);
wait(100+Random(100));
if R_chooseOption('Talk')then
begin
wait(100+Random(100));
While characterMoving do wait(100+Random(100));
While (not ValidInterface(242)) and (not ValidInterface(241)) and
(not ValidInterface(64)) and (not ValidInterface(243))do wait(100+Random(100));
wait(700+Random(700));
end;
end;
Result := ValidInterface(241) or ValidInterface(64) or ValidInterface(242)
or ValidInterface(243);
end;
end;

{*******************************************************************************
function RS_MFindDoorChat: boolean;
By: Drags111
Description: Finds the text in the chat box about the door to use.
*******************************************************************************}
function RS_MFindDoorChat: boolean;
var
S: String;
begin
if not ValidInterface(242) then Exit;
S := GetInterfaceText(242, 4);
if Pos('To exit', S) < 1 then Exit;
S := Between('use the ', ' ', S);
RS_MDoor := S;
S := GetInterfaceText(242, 4);
RS_MDir := Between('door in the ', ' ', S);
Writeln('Time to leave! Door: '+RS_MDoor+', Direction: '+RS_MDir);
Result := True;
end;

{*******************************************************************************
function R_MGetQuestion: String;
By: Drags111
Description: Gets the question to answer.
*******************************************************************************}
function R_MGetQuestion: String;
var
qx, qy: integer;
begin
While not(R_InRelatedCards) and not(R_InNextObject)do
begin
if not R_InMordaut then Exit;
if RS_MFindDoorChat then
begin
Result := 'Door';
Exit;
end;
if (FindColorTolerance(qx, qy, 8388608, 184, 425, 365, 457, 2) or
FindColorTolerance(qx, qy, 16711680, 184, 425, 365, 457, 2)) then
begin
wait(100+Random(100));
Mouse(qx, qy+5, 0, 0, true);
MouseBox(19, 362, 393, 427, 3);
wait(100+Random(100));
ChatWait;
end;
end;
if R_InRelatedCards then
begin
Writeln('Question type: Related Cards.');
Result := 'Cards';
end;
if R_InNextObject then
begin
Writeln('Question type: Next Object.');
Result := 'Objects';
end;
end;

{*******************************************************************************
function R_ExitMordaut: boolean;
By: Drags111
Description: Exits through the right door.
*******************************************************************************}
function R_ExitMordaut: boolean;
var
ID, OffsetX, OffsetY, Time: integer;
T: TPoint;
begin
case lowercase(RS_MDoor) of
'red': ID := 2188;
'green': ID := 2193;
'blue': ID := 1289;
'purple': ID := 2192;
else Writeln('INVALID DOOR COLOR');
end;
//if not FindObject(T, ID)then Exit;
case lowercase(RS_MDir) of
'north':begin
R_MakeCompass('N');
//OffsetY := 1;
end;
'south':begin
R_MakeCompass('S');
//OffsetY := -1;
end;
'east': begin
R_MakeCompass('E');
//OffsetX := 1;
end;
'west': begin
R_MakeCompass('W');
//OffsetX := -1;
end;
end;
if not TileOnMS(Point(T.X+OffsetX, T.Y+OffsetY), 15)then
WalkToTile(T, 0, 0);
While CharacterMoving do wait(100+Random(100));
Wait(1000+Random(1000));
T := TileToMS(Point(T.X+OffsetX, T.Y+OffsetY), 15);
Mouse(T.X, T.Y, 5, 5, false);
wait (5000); // Fix me?
Result := R_ChooseOption('Open');
WaitToMove(1000);
While CharacterMoving do wait(100+Random(100));
MarkTime(Time);
While R_InMordaut and (TimeFromMark(Time) < 5000) do Wait(100+Random(100));
end;

{*******************************************************************************
function R_MNextObject: boolean;
By: Drags111
Description: Does the next object question.
*******************************************************************************}
function R_MNextObject: boolean;
var
Cat: String;
MF: Boolean;
i, qx, qy, fi: integer;
begin
fi := 5;
repeat
if not ValidInterface(103) then Exit;
Inc(fi);
if (fi > 8)then Exit;
Writeln(inttostr(GetComponentID(103, fi)));
Cat := R_MIDToClass(GetComponentID(103, fi));
Writeln('Current category is: '+Cat);
if not ValidInterface(103) then Exit;
for i := 10 to 13 do
if (R_MIDToClass(GetComponentID(103, i)) = Cat)then
begin
MF := True;
Break;
end;
if not ValidInterface(103) then Exit;
if MF then
begin
Result := true;
Writeln('Found item at slot: '+inttostr(i-9));
While not OptionExists('Select') do
begin
MMouse(7+(i-9)*99, 244, 3, 3);
wait(50+Random(50));
end;
GetMousePos(qx, qy);
Mouse(qx, qy, 0, 0, true);
While ValidInterface(103) do wait(100+Random(100));
end;
until Result;
end;

{*******************************************************************************
procedure RS_MouseCardSlot(slot: integer);
By: Drags111
Description: Read the name, im tired. its late.
*******************************************************************************}
procedure RS_MouseCardSlot(slot: integer);
var
P: TPoint;
begin
Writeln(inttostr(GetComponentID(559, slot+41)));
case slot of
1: P := Point(67, 78);
2: P := Point(133, 68);
3: P := Point(204, 76);
4: P := Point(271, 81);
5: P := Point(341, 79);
6: P := Point(67, 167);
7: P := Point(133, 167);
8: P := Point(204, 167);
9: P := Point(271, 167);
10: P := Point(341, 167);
11: P := Point(67, 253);
12: P := Point(133, 253);
13: P := Point(204, 253);
14: P := Point(271, 253);
15: P := Point(341, 253);
end;
Mouse(P.x, P.y, 5, 5, true);
wait(500+Random(500));
end;

{*******************************************************************************
function R_MRelatedCards: boolean;
By: Drags111
Description: Referr to previous description.
*******************************************************************************}
procedure R_MRelatedCards;
var
Cat: String;
i: integer;
begin
if not ValidInterface(559) then Exit;
Writeln(GetInterfaceText(559, 25));
Cat := R_MQuestionToClass(GetInterfaceText(559, 25));
Writeln(Cat);
for i := 42 to 56 do
begin
if (R_MIDToClass(GetComponentID(559, i)) = Cat) then
RS_MouseCardSlot(i-41);
end;
if not ValidInterface(559) then Exit;
MouseBox(422, 262, 436, 276, 1);
While ValidInterface(559) do wait(100+Random(100));
wait(1000+Random(1000));
end;

{*******************************************************************************
function R_SolveMordaut: boolean;
By: Drags111
Description: Weeeeee
*******************************************************************************}
function R_SolveMordaut: boolean;
var
QT: String;
begin
if not R_InMordaut then Exit;
//Inc(R_RandomsDetected);
Writeln('*** Mordaut Detected! ***');
R_SetMordautVars;
while R_InMordaut do
begin
if not R_InMordaut then Break;
while (QT = '') do
begin
R_MTalkWait;
QT := R_MGetQuestion;
end;
Writeln('QT := '+QT);
wait(2000+Random(1000));
case QT of
'Door': R_ExitMordaut;
'Cards': R_MRelatedCards;
'Objects': R_MNextObject;
end;
QT := '';
end;
if R_LoggedIn then
begin
Result := True;
//Inc(RSolved[RSchool]);
AddToReport('Solved Mordaut Random!');
end else
//Inc(RFailed[RSchool]);
end;

So that works like a charm BUT it cant find the door. After some tuning up, hopefully that can be [re?-]included.

mormonman

2010-10-29 01:59:58

From: cstrike
Did, TY :)


function GetComponentID (ParentI, ChildI : Integer) : Integer;
var
Child: Integer;
begin
Child := GetInterface(ParentI, ChildI);
Result := SmartGetFieldInt(Child, hook_interface_GetID);
SmartFreeObject(Child);
end;

var
RS_RMordaut: TNPC;
RS_MRanged, RS_MCooking, RS_MFishing, RS_MCombat, RS_MFarming,
RS_MMagic, RS_MFiremaking, RS_MHats, RS_MDrinks, RS_MWoodcutting,
RS_MBoots, RS_MCrafting, RS_MMining, RS_MSmithing: TIntegerArray;
RS_MItems: array of TIntegerArray;
RS_MQuestions: array of TStringArray;
RS_MDoor, RS_MDir: String;

{*******************************************************************************
procedure R_SetMordautVars;
By: Drags111
Description: Sets the vars needed for mordaut.
*******************************************************************************}
procedure R_SetMordautVars;
begin
RS_MRanged := [11539, 11540, 11541, 11614, 11615, 11633];
RS_MCooking := [11526, 11529, 11545, 11549, 11550, 11555,
11560, 11563, 11564, 11607, 11608, 11616,
11620, 11621, 11622, 11623, 11628, 11629,
11634, 11639, 11641, 11649, 11624];
RS_MFishing := [11527, 11574, 11578, 11580, 11599, 11600,
11601, 11602, 11603, 11604, 11605, 11606,
11625];
RS_MCombat := [11528, 11531, 11536, 11537, 11579, 11591,
11592, 11593, 11597, 11627, 11631, 11635,
11636, 11638, 11642, 11648];
RS_MFarming := [11530, 11532, 11547, 11548, 11554, 11556,
11571, 11581, 11586, 11610, 11645];
RS_MMagic := [11533, 11534, 11538, 11562, 11567, 11582];
RS_MFiremaking:= [11535, 11551, 11552, 11559, 11646];
RS_MHats := [11540, 11557, 11558, 11560, 11570, 11619,
11626, 11630, 11632, 11637, 11654];
RS_MDrinks := [11542, 11543, 11544, 11644, 11647];
RS_MWoodcutting:=[11573, 11595];
RS_MBoots := [11561, 11618, 11650, 11651];
RS_MCrafting := [11546, 11553, 11565, 11566, 11568, 11569,
11572, 11575, 11576, 11577, 11581, 11583,
11584, 11585, 11643, 11652, 11653];
RS_MMining := [11587, 11588, 11594, 11596, 11598, 11609,
11610];
RS_MSmithing := [11611, 11612, 11613];
RS_MItems := [RS_MRanged, RS_MCooking, RS_MFishing, RS_MCombat, RS_MFarming,
RS_MMagic, RS_MFiremaking, RS_MHats, RS_MDrinks, RS_MWoodcutting,
RS_MBoots, RS_MCrafting, RS_MMining, RS_MSmithing];
SetLength(RS_MQuestions, 50);
RS_MQuestions[0] := ['I''m feeling dehydrated','Drinks'];
RS_MQuestions[1] := ['quenched my thirst','Drinks'];
RS_MQuestions[2] := ['light my fire','Firemaking'];
RS_MQuestions[3] := ['fishy','Fishing'];
RS_MQuestions[4] := ['fishing for answers','Fishing'];
RS_MQuestions[5] := ['fish out of water','Drinks'];
RS_MQuestions[6] := ['strange headgear','Hats'];
RS_MQuestions[7] := ['tip my hat','Hats'];
RS_MQuestions[8] := ['thinking cap','Hats'];
RS_MQuestions[9] := ['wizardry here','Magic'];
RS_MQuestions[10] := ['rather mystical','Magic'];
RS_MQuestions[11] := ['abracada','Magic'];
RS_MQuestions[12] := ['hide one''s face','Hats'];
RS_MQuestions[13] := ['shall unmask','Hats'];
RS_MQuestions[14] := ['hand-to-hand','Combat'];
RS_MQuestions[15] := ['melee weapon','Combat'];
RS_MQuestions[16] := ['me hearties','Hats'];
RS_MQuestions[17] := ['mighty pirate','Drinks']
RS_MQuestions[18] := ['mighty archer','Ranged'];
RS_MQuestions[19] := ['shiny things','Crafting'];
RS_MQuestions[20] := ['range','Ranged'];
RS_MQuestions[21] := ['arrow','Ranged'];
RS_MQuestions[22] := ['drink','Drinks'];
RS_MQuestions[23] := ['logs','Firemaking'];
RS_MQuestions[24] := ['light','Firemaking'];
RS_MQuestions[25] := ['headgear','Hats'];
RS_MQuestions[26] := ['hat','Hats'];
RS_MQuestions[27] := ['cap','Hats'];
RS_MQuestions[28] := ['mine','Mining'];
RS_MQuestions[29] := ['mining','Mining'];
RS_MQuestions[30] := ['ore','Mining'];
RS_MQuestions[31] := ['fish','Fishing'];
RS_MQuestions[32] := ['fishing','Fishing'];
RS_MQuestions[33] := ['thinking cap','Hats'];
RS_MQuestions[34] := ['cooking','Cooking'];
RS_MQuestions[35] := ['cook','Cooking'];
RS_MQuestions[36] := ['bake','Cooking'];
RS_MQuestions[37] := ['farm','Farming'];
RS_MQuestions[38] := ['farming','Farming'];
RS_MQuestions[39] := ['cast','Magic'];
RS_MQuestions[40] := ['magic','Magic'];
RS_MQuestions[41] := ['craft','Crafting'];
RS_MQuestions[42] := ['boot','Boots'];
RS_MQuestions[43] := ['chop','Woodcutting'];
RS_MQuestions[44] := ['cut','Woodcutting'];
RS_MQuestions[45] := ['tree','Woodcutting'];
RS_MQuestions[46] := ['melee','Combat'];
RS_MQuestions[47] := ['fire','Firemaking'];
RS_MQuestions[48] := ['sparks from','Firemaking'];
RS_MQuestions[49] := ['thirsty','Drinks'];
end;

{*******************************************************************************
function R_InMordaut: boolean;
By: Drags111
Description: Checks if we are in the mordaut random.
*******************************************************************************}
function R_InMordaut: boolean;
begin
Result := FindNPC(6117, RS_RMordaut);
end;

{*******************************************************************************
function R_InRelatedCards: boolean;
By: Drags111
Description: Checks if we are in the related cards question.
*******************************************************************************}
function R_InRelatedCards: boolean;
begin
Result := ValidInterface(559);
end;

{*******************************************************************************
function R_InNextObject: boolean;
By: Drags111
Description: Checks if we are in the next object question.
*******************************************************************************}
function R_InNextObject: boolean;
begin
Result := ValidInterface(103);
end;

{*******************************************************************************
function R_MIDToClass(ID: Integer): string;
By: Drags111
Description: Converts ID to category type.
*******************************************************************************}
function R_MIDToClass(ID: Integer): string;
var
i, ci: integer;
begin
ci := -1;
for i := 0 to High(RS_MItems) do
if InIntArray(RS_MItems[i], ID) then ci := i;
case ci of
-1: Result := 'Error';
0: Result := 'Ranged';
1: Result := 'Cooking';
2: Result := 'Fishing';
3: Result := 'Combat';
4: Result := 'Farming';
5: Result := 'Magic';
6: Result := 'Firemaking';
7: Result := 'Hats';
8: Result := 'Drinks';
9: Result := 'Wooductting';
10: Result := 'Boots';
11: Result := 'Crafting';
12: Result := 'Mining';
13: Result := 'Smithing';
else Result := 'Error 2.';
end;
end;

{*******************************************************************************
function R_MQuestionToClass(Question: String): string;
By: Drags111
Description: Converts question to category.
*******************************************************************************}
function R_MQuestionToClass(Question: String): string;
var
i: integer;
begin
Result := '-1';
for i := 0 to High(RS_MQuestions) do
if (Pos(lowercase(RS_MQuestions[i][0]), Lowercase(Question)) > 0) then
begin
Result := RS_MQuestions[i][1]
Exit;
end;
end;

{*******************************************************************************
function R_MTalkWait: boolean;
By: Drags111
Description: Waits to talk to mordaut.
*******************************************************************************}
function R_MTalkWait: boolean;
var
T: Integer;
P: TPoint;
begin
T := GetSystemTime;
if not R_InMordaut then Exit;
While not Result do
begin
if not R_InMordaut then Exit;
if ValidInterface(242) or ValidInterface(64) or ValidInterface(243) then Exit;
if (GetSystemTime-T) > 3000 then
begin
if not TileOnMS(RS_RMordaut.Tile, 20) then
WalkToTile(Point(RS_RMordaut.Tile.X, RS_RMordaut.Tile.Y-2), 0, 0);
wait(700+Random(700));
P := TileToMS(RS_RMordaut.Tile, RS_RMordaut.Height * 2 / 3);
Mouse(P.x, P.y, 2, 2, false);
wait(100+Random(100));
if R_chooseOption('Talk')then
begin
wait(100+Random(100));
While characterMoving do wait(100+Random(100));
While (not ValidInterface(242)) and (not ValidInterface(241)) and
(not ValidInterface(64)) and (not ValidInterface(243))do wait(100+Random(100));
wait(700+Random(700));
end;
end;
Result := ValidInterface(241) or ValidInterface(64) or ValidInterface(242)
or ValidInterface(243);
end;
end;

{*******************************************************************************
function RS_MFindDoorChat: boolean;
By: Drags111
Description: Finds the text in the chat box about the door to use.
*******************************************************************************}
function RS_MFindDoorChat: boolean;
var
S: String;
begin
if not ValidInterface(242) then Exit;
S := GetInterfaceText(242, 4);
if Pos('To exit', S) < 1 then Exit;
S := Between('use the ', ' ', S);
RS_MDoor := S;
S := GetInterfaceText(242, 4);
RS_MDir := Between('door in the ', ' ', S);
Writeln('Time to leave! Door: '+RS_MDoor+', Direction: '+RS_MDir);
Result := True;
end;

{*******************************************************************************
function R_MGetQuestion: String;
By: Drags111
Description: Gets the question to answer.
*******************************************************************************}
function R_MGetQuestion: String;
var
qx, qy: integer;
begin
While not(R_InRelatedCards) and not(R_InNextObject)do
begin
if not R_InMordaut then Exit;
if RS_MFindDoorChat then
begin
Result := 'Door';
Exit;
end;
if (FindColorTolerance(qx, qy, 8388608, 184, 425, 365, 457, 2) or
FindColorTolerance(qx, qy, 16711680, 184, 425, 365, 457, 2)) then
begin
wait(100+Random(100));
Mouse(qx, qy+5, 0, 0, true);
MouseBox(19, 362, 393, 427, 3);
wait(100+Random(100));
ChatWait;
end;
end;
if R_InRelatedCards then
begin
Writeln('Question type: Related Cards.');
Result := 'Cards';
end;
if R_InNextObject then
begin
Writeln('Question type: Next Object.');
Result := 'Objects';
end;
end;

{*******************************************************************************
function R_ExitMordaut: boolean;
By: Drags111
Description: Exits through the right door.
*******************************************************************************}
function R_ExitMordaut: boolean;
var
ID, OffsetX, OffsetY, Time: integer;
T: TPoint;
begin
case lowercase(RS_MDoor) of
'red': ID := 2188;
'green': ID := 2193;
'blue': ID := 1289;
'purple': ID := 2192;
else Writeln('INVALID DOOR COLOR');
end;
//if not FindObject(T, ID)then Exit;
case lowercase(RS_MDir) of
'north':begin
R_MakeCompass('N');
//OffsetY := 1;
end;
'south':begin
R_MakeCompass('S');
//OffsetY := -1;
end;
'east': begin
R_MakeCompass('E');
//OffsetX := 1;
end;
'west': begin
R_MakeCompass('W');
//OffsetX := -1;
end;
end;
if not TileOnMS(Point(T.X+OffsetX, T.Y+OffsetY), 15)then
WalkToTile(T, 0, 0);
While CharacterMoving do wait(100+Random(100));
Wait(1000+Random(1000));
T := TileToMS(Point(T.X+OffsetX, T.Y+OffsetY), 15);
Mouse(T.X, T.Y, 5, 5, false);
wait (5000); // Fix me?
Result := R_ChooseOption('Open');
WaitToMove(1000);
While CharacterMoving do wait(100+Random(100));
MarkTime(Time);
While R_InMordaut and (TimeFromMark(Time) < 5000) do Wait(100+Random(100));
end;

{*******************************************************************************
function R_MNextObject: boolean;
By: Drags111
Description: Does the next object question.
*******************************************************************************}
function R_MNextObject: boolean;
var
Cat: String;
MF: Boolean;
i, qx, qy, fi: integer;
begin
fi := 5;
repeat
if not ValidInterface(103) then Exit;
Inc(fi);
if (fi > 8)then Exit;
Writeln(inttostr(GetComponentID(103, fi)));
Cat := R_MIDToClass(GetComponentID(103, fi));
Writeln('Current category is: '+Cat);
if not ValidInterface(103) then Exit;
for i := 10 to 13 do
if (R_MIDToClass(GetComponentID(103, i)) = Cat)then
begin
MF := True;
Break;
end;
if not ValidInterface(103) then Exit;
if MF then
begin
Result := true;
Writeln('Found item at slot: '+inttostr(i-9));
While not OptionExists('Select') do
begin
MMouse(7+(i-9)*99, 244, 3, 3);
wait(50+Random(50));
end;
GetMousePos(qx, qy);
Mouse(qx, qy, 0, 0, true);
While ValidInterface(103) do wait(100+Random(100));
end;
until Result;
end;

{*******************************************************************************
procedure RS_MouseCardSlot(slot: integer);
By: Drags111
Description: Read the name, im tired. its late.
*******************************************************************************}
procedure RS_MouseCardSlot(slot: integer);
var
P: TPoint;
begin
Writeln(inttostr(GetComponentID(559, slot+41)));
case slot of
1: P := Point(67, 78);
2: P := Point(133, 68);
3: P := Point(204, 76);
4: P := Point(271, 81);
5: P := Point(341, 79);
6: P := Point(67, 167);
7: P := Point(133, 167);
8: P := Point(204, 167);
9: P := Point(271, 167);
10: P := Point(341, 167);
11: P := Point(67, 253);
12: P := Point(133, 253);
13: P := Point(204, 253);
14: P := Point(271, 253);
15: P := Point(341, 253);
end;
Mouse(P.x, P.y, 5, 5, true);
wait(500+Random(500));
end;

{*******************************************************************************
function R_MRelatedCards: boolean;
By: Drags111
Description: Referr to previous description.
*******************************************************************************}
procedure R_MRelatedCards;
var
Cat: String;
i: integer;
begin
if not ValidInterface(559) then Exit;
Writeln(GetInterfaceText(559, 25));
Cat := R_MQuestionToClass(GetInterfaceText(559, 25));
Writeln(Cat);
for i := 42 to 56 do
begin
if (R_MIDToClass(GetComponentID(559, i)) = Cat) then
RS_MouseCardSlot(i-41);
end;
if not ValidInterface(559) then Exit;
MouseBox(422, 262, 436, 276, 1);
While ValidInterface(559) do wait(100+Random(100));
wait(1000+Random(1000));
end;

{*******************************************************************************
function R_SolveMordaut: boolean;
By: Drags111
Description: Weeeeee
*******************************************************************************}
function R_SolveMordaut: boolean;
var
QT: String;
begin
if not R_InMordaut then Exit;
//Inc(R_RandomsDetected);
Writeln('*** Mordaut Detected! ***');
R_SetMordautVars;
while R_InMordaut do
begin
if not R_InMordaut then Break;
while (QT = '') do
begin
R_MTalkWait;
QT := R_MGetQuestion;
end;
Writeln('QT := '+QT);
wait(2000+Random(1000));
case QT of
'Door': R_ExitMordaut;
'Cards': R_MRelatedCards;
'Objects': R_MNextObject;
end;
QT := '';
end;
if R_LoggedIn then
begin
Result := True;
//Inc(RSolved[RSchool]);
AddToReport('Solved Mordaut Random!');
end else
//Inc(RFailed[RSchool]);
end;

So that works like a charm BUT it cant find the door. After some tuning up, hopefully that can be [re?-]included.


Just check the questions and solutions with the rsbot one. Also you can steal the id's from them.

Naike

2010-10-29 03:16:45

From: mormonman
Just check the questions and solutions with the rsbot one. Also you can steal the id's from them.


We're doing that already mate :redface:

Naike

2010-10-29 04:08:51


"I never leave the house without some sort of jewellery.", this.Jewellery), new SimilarObjectQuestion("There is no better feeling t
"There is no better feeling than", this.Jewellery2), new SimilarObjectQuestion
"I'm feeling dehydrated", this.Drinks), new SimilarObjectQuestion("All
"All this work is making me thirsty", this.Drinks), new SimilarObjectQuestion(
"quenched my thirst", this.Drinks), new SimilarObjectQuestion(
"light my fire", this.Firemaking), new SimilarObjectQuest
"fishy", this.Fishing), new SimilarObjectQuestion("fi
"fishing for answers", this.Fishing), new SimilarObjectQuestion(
"fish out of water", this.Drinks), new SimilarObjectQuestion("
"strange headgear", this.Hats), new SimilarObjectQuestion("t
"tip my hat", this.Hats), new SimilarObjectQuestion(
"thinking cap", this.Hats), new SimilarObjectQuestion(
"wizardry here", this.Magic), new SimilarObjectQuestion
"rather mystical", this.Magic), new SimilarObjectQuestion(
"abracada", this.Magic), new SimilarObjectQuestion(
"hide one's face", this.Hats), new SimilarObjectQuestion("
"shall unmask", this.Hats), new SimilarObjectQuestion(
"hand-to-hand", this.Combat), new SimilarObjectQuestio
"melee weapon", this.Combat), new SimilarObjectQuestion(
"prefers melee", this.Combat), new SimilarObjectQuestion(
"me hearties", this.Pirate), new SimilarObjectQuestion(
"puzzle for landlubbers", this.Pirate), new SimilarObjectQuestion(
"mighty pirate", this.Pirate), new SimilarObjectQuestion(
"mighty archer", this.Ranged), new SimilarObjectQuestion(
"as an arrow", this.Ranged), new SimilarObjectQuestion(
"Ranged attack", this.Ranged), new SimilarObjectQuestion(
"shiny things", this.Crafting), new SimilarObjectQuestio
"igniting", this.Firemaking), new SimilarObjectQuestio
"sparks from my synapses.", this.Firemaking), new SimilarObjectQuestion(
"fire.", this.Firemaking), new SimilarObjectQuestion(
"disguised", this.Hats), new SimilarObjectQuestion("range
"range", this.Ranged), new SimilarObjectQuestio
"arrow", this.Ranged), new SimilarObjectQuestion(
"drink", this.Drinks), new SimilarObjectQuestion(
"logs", this.Firemaking), new SimilarObjectQuest
"light", this.Firemaking), new SimilarObjectQuestion(
"headgear", this.Hats), new SimilarObjectQuestion("hat",
"hat", this.Hats), new SimilarObjectQuestion(
"cap", this.Hats), new SimilarObjectQuestion(
"mine", this.Mining), new SimilarObjectQuestio
"mining", this.Mining), new SimilarObjectQuestion(
"ore", this.Mining), new SimilarObjectQuestion(
"fish", this.Fishing), new SimilarObjectQuestion
"fishing", this.Fishing), new SimilarObjectQuestion(
"thinking cap", this.Hats), new SimilarObjectQuestion("co
"cooking", this.Cooking), new SimilarObjectQuesti
"cook", this.Cooking), new SimilarObjectQuestion(
"bake", this.Cooking), new SimilarObjectQuestion(
"farm", this.Farming), new SimilarObjectQuestion(
"farming", this.Farming), new SimilarObjectQuestion(
"cast", this.Magic), new SimilarObjectQuestion("m
"magic", this.Magic), new SimilarObjectQuestion(
"craft", this.Crafting), new SimilarObjectQuesti
"boot", this.Boots), new SimilarObjectQuestion("ch
"chop", this.Woodcutting), new SimilarObjectQue
"cut", this.Woodcutting), new SimilarObjectQuestion(
"tree", this.Woodcutting) };
Successfully executed.

Should help you some..

EDIT:

Did some work on mordaut, it's now working :)
Fixed the doors, flawless system when it comes to walking out!

However, going to add a lot more failsafes and such.. be patient!

Cstrike, hit me up on Irc when you're on!


[Reflection] Trying to solve: Exam
[Reflection] Setting Mordaut vars..
[Reflection] Question type: Next Object.
[Reflection] 11634
[Reflection] Current category is: Cooking
[Reflection] Found item at slot: 1
[Reflection] Question type: Next Object.
[Reflection] 11537
[Reflection] Current category is: Combat
[Reflection] Found item at slot: 2
[Reflection] Question type: Related Cards.
[Reflection] There are many ways to hide one's face; much like the way that this pattern is hidden.
[Reflection] Class: Hats
[Reflection] Moving mouse to: 11654
[Reflection] Moving mouse to: 11557
[Reflection] Moving mouse to: 11619
[Reflection] Question type: Next Object.
[Reflection] 11542
[Reflection] Current category is: Drinks
[Reflection] Found item at slot: 1
[Reflection] Time to leave! Door: purple, Direction: north
Status: Solved Mordaut Random!
[Reflection] Random solved



    [*]Beekeeper - Working!
    [*]Forester - Working!
    [*]Frog - Working!
    [*]Leo - Working!
    [*]Sandwich lady - Working!
    [*]Mordaut - Working!
    [*]Mime - Working!
    (heard someone say one emote was failing, could need one..) [*]Molly - Working!
    (same as mime, but with door clicking) [*]Abyss - No account given, at all.
    [*]Certer - No account given, at all.
    [*]EvilBob - No account given, at all.
    [*]PrisonPete - 15 mins, come on.. Will do this on main whenever I get it.
    [*]CapNArnav - Need more, cstrike got a simple template ready!
    [*]Demon - Need more, tweaks needed
    [*]Maze - Need one more, final test!
    [*]Pillory - Got the file, needs testing!
    [*]Pinball - Same as pillory
    [*]Quiz - Got the file, needs testing!

Cstrike

2010-11-14 21:35:45

Mordaut messes up on doors [north west one in particular], here's a quick fix.

My suggested new code [see comment]
{*******************************************************************************
function R_ExitMordaut: boolean;
By: Drags111
Description: Exits through the right door.
*******************************************************************************}
function R_ExitMordaut: boolean;
var
ID, Time: integer;
OffsetX, OffsetY: Extended;
Door: TRSObject;
T: TPoint;
begin
Case LowerCase(RS_MDoor) of
'red': ID := 2188;
'green': ID := 2193;
'blue': ID := 2189;
'purple': ID := 2192;
else Writeln('INVALID DOOR COLOR');
end;

Door := GetObjectByID(ID, OBJECT_TYPE_WALLOBJECT, 40);
If (Door.ID < 1)then
begin
Writeln('[Reflection] Failed exiting mordaut');
Exit;
end;

Case LowerCase(RS_MDir) of

'north':
begin
OffsetX := 0.5;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X, Door.Tile.Y - RandomRange(1,2))]); // Added this [Cstrike] temporary fix
end;

'south-west':
begin
OffsetX := 1.0;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X + RandomRange(1,2), Door.Tile.Y)]); // Added this [Cstrike] temporary fix
end;

'south-east':
begin
OffsetX := 0.0;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X - RandomRange(1,2), Door.Tile.Y)]); // Added this [Cstrike] temporary fix
end;

'north-west':
begin
OffsetX := 1.0;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X + RandomRange(1,2), Door.Tile.Y)]); // Added this [Cstrike] temporary fix
end;

end;
if not TileOnMS(Door.Tile, 15)then
WalkToTile(Door.Tile, 0, 0);

While CharacterMoving do
Wait(100+Random(100));

Wait(1000+Random(1000));

T := TileToMSEx(Door.Tile, OffsetX, OffsetY, 600+Random(200));
Mouse(T.X, T.Y, 5, 5, False);
Result := WaitOption('pen', 200+Random(100));
If not Result then
Exit;

WaitToMove(1000);
While CharacterMoving do
Wait(100+Random(100));

MarkTime(Time);
While R_InMordaut and (TimeFromMark(Time) < 5000) do
Wait(100+Random(100));
end;


It failed opening the door once, walked back to the middle, then walked back (+1 tile north) and solved it.
Temporary fix I guess?

pyroryan

2010-11-15 21:05:47

From: cstrike
Mordaut messes up on doors [north west one in particular], here's a quick fix.

My suggested new code [see comment]
{*******************************************************************************
function R_ExitMordaut: boolean;
By: Drags111
Description: Exits through the right door.
*******************************************************************************}
function R_ExitMordaut: boolean;
var
ID, Time: integer;
OffsetX, OffsetY: Extended;
Door: TRSObject;
T: TPoint;
begin
Case LowerCase(RS_MDoor) of
'red': ID := 2188;
'green': ID := 2193;
'blue': ID := 2189;
'purple': ID := 2192;
else Writeln('INVALID DOOR COLOR');
end;

Door := GetObjectByID(ID, OBJECT_TYPE_WALLOBJECT, 40);
If (Door.ID < 1)then
begin
Writeln('[Reflection] Failed exiting mordaut');
Exit;
end;

Case LowerCase(RS_MDir) of

'north':
begin
OffsetX := 0.5;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X, Door.Tile.Y - RandomRange(1,2))]); // Added this [Cstrike] temporary fix
end;

'south-west':
begin
OffsetX := 1.0;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X + RandomRange(1,2), Door.Tile.Y)]); // Added this [Cstrike] temporary fix
end;

'south-east':
begin
OffsetX := 0.0;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X - RandomRange(1,2), Door.Tile.Y)]); // Added this [Cstrike] temporary fix
end;

'north-west':
begin
OffsetX := 1.0;
OffsetY := 0.5;
WalkPath ([Tile(Door.Tile.X + RandomRange(1,2), Door.Tile.Y)]); // Added this [Cstrike] temporary fix
end;

end;
if not TileOnMS(Door.Tile, 15)then
WalkToTile(Door.Tile, 0, 0);

While CharacterMoving do
Wait(100+Random(100));

Wait(1000+Random(1000));

T := TileToMSEx(Door.Tile, OffsetX, OffsetY, 600+Random(200));
Mouse(T.X, T.Y, 5, 5, False);
Result := WaitOption('pen', 200+Random(100));
If not Result then
Exit;

WaitToMove(1000);
While CharacterMoving do
Wait(100+Random(100));

MarkTime(Time);
While R_InMordaut and (TimeFromMark(Time) < 5000) do
Wait(100+Random(100));
end;


It failed opening the door once, walked back to the middle, then walked back (+1 tile north) and solved it.
Temporary fix I guess?


Committed.

HyperSecret

2010-11-15 22:58:27

Good job Guys!