SRL Archive - Senior Scripts and Snippets

Solving Mr. Mordaut


pwnaz0r

2008-10-09 21:14:24


function TalkToMordaut: boolean;
var
Tile, Modaut: TPoint;
begin
SetAngle(true);
Tile:= Point(1886, 5022);
Modaut:= TileToMS(Tile, 5);
Mouse(Modaut.X, Modaut.Y, 5, 5, false);
result:= ChooseOption('k-t');
end;

function RetrieveQuestionType(var Question: string): boolean;
begin
Question:= '';
if FindNPCChatText('bjec', Nothing)then
Question:= 'Pattern';
if FindNPCChatText('xamin', Nothing)then
Question:= 'Hint';
result:= (not(Question = ''));
end;

function AnsweredCorrect: boolean;
var
Str: Array of string;
i : integer;
begin
Str:= ['rrec', 'onder'];
for I:= 0 to High(Str) do
begin
result:= FindNPCChatText(Str[I], Nothing);
if result then exit;
end;
end;

function FinishedTest: boolean;
begin
result:= FindNpcChatText('WELL DONE', nothing);
end;

function FindDoorColor: boolean;
var
ColorList: Array of String;
I: integer;
begin
ColorList:= ['red', 'blue', 'green', 'purple'];
for I:= 0 to High(ColorList) do
begin
if FindNPCChatText(ColorList[I], Nothing)then
begin
DoorColor:= ColorList[I];
result:= true;
exit;
end;
end;
end;

function TestScreen: boolean;
begin
result:= (GetColor(22, 8) = 1855055);
end;

function HandleMrMordaut: boolean;
begin
MakeCompass('N');
if not TestScreen then
begin
If not ClickToContinue then TalkToMordaut;
FFlag(0);
wait(500+random(500));
While ClickContinue(true, true) do
wait(500);
result:= true;
end;
if RetrieveQuestionType(CurrentQuestion) then
Writeln('Question Type Found: '+CurrentQuestion);
end;

function HintBox(Col, Row: integer): TBox;
var
StartPoint: Tpoint;
begin
StartPoint:= Point(40, 30);
Result.X1:= StartPoint.X + (66 * (Row - 1));
Result.Y1:= StartPoint.Y + (90 * (Col - 1));
Result.X2:= Result.X1 + 66;
Result.Y2:= Result.Y2 + 90;
end;

function BoxClicked(Col, Row:integer): boolean;
var
OurBox: TBox;
XX, YY: integer;
begin
OurBox:= HintBox(Col, Row);
result:= FindColor(XX, YY, 2105631, OurBox.X1, OurBox.Y1, OurBox.X1+(64-40), OurBox.Y1+(54-30));
if Not Result then
Writeln(IntToStr(GetColor(OurBox.X1+4, OurBox.Y1+4)));
end;

function ClickBox(Col, Row: integer):boolean;
var
OurBox: TBox;
Mark: Integer;
ClickPoint: TPoint;
begin
OurBox:= HintBox(Col, Row);
Mark:= GetSystemTime;
repeat
Mouse(OurBox.X1, OurBox.Y1, 66, 90, true);
Wait(300+random(500));
if ((GetSystemTime - Mark) >= 5000)then
exit;
result:= BoxClicked(Col, Row);
if result then exit;
until(false);
end;

function HandleHint(Answers: TIntegerArray): boolean;
var
I, x, y: integer;
begin
if not TestScreen then exit;
for I:= 0 to High(Answers) do
begin
X:= Answers[I] mod 5;
if (X <= 0) then X:= 5;
If Inrange(Answers[I], 1, 5)then
Y:= 1;
If Inrange(Answers[I], 6, 10)then
Y:= 2;
If Inrange(Answers[I], 11, 15)then
Y:= 3;
if not ClickBox(Y, X)then exit;
end;
result:= true;
while TestScreen do
begin
wait(300);
Mouse(418, 260, (441-418), 23, true);
end;
end;

function GetToDoor(Color: string): boolean;
var
Dir: string;
DoorPoints: array [0..1] of TPoint;
ClickPoint: TPoint;
begin
case Capitalize(Color) of
'Blue':
begin
Dir:= 'W';
DoorPoints[0]:= Point(1882, 5030);
DoorPoints[1]:= Point(1881, 5030);
end;
'Red':
begin
Dir:= 'W';
DoorPoints[0]:= Point(1882, 5022);
DoorPoints[1]:= Point(1881, 5022);
end;
'Purple':
begin
Dir:= 'N';
DoorPoints[0]:= Point(1886, 5032);
DoorPoints[1]:= Point(1886, 5033);
end;
'Green':
begin
Dir:= 'E';
DoorPoints[0]:= Point(1890, 5019);
DoorPoints[1]:= Point(1891, 5019);
end;
end;
WalkToTile(DoorPoints[0], 0, 0);
Wait(500+random(1000));
MakeCompass(Dir);
ClickPoint:= TileToMS(DoorPoints[1], 3);
Mouse(ClickPoint.X, ClickPoint.Y, 0, 0, false);
result:= ChooseOption('pen');
end;

function HandleMordaut: boolean;
begin
end;

begin
SmartSetup('world'+inttostr(SmartWorld), true, Signed, false);
while not SmartActive do wait(100);
SetTargetDC(SmartGetDC);
SetupSRL;
DeclarePlayers;
if not LoggedIn then LoginPlayer;
end.

Thats what I have. Its pretty far. Just needs to actually find the answers, haha. I guess I will leave that to people who know more about reflection or whatever. I haven't been here for awhile as some of you guys know, so yeah. I might get around to solving the actual questions, but for now this is enough to do almost everything.

Problems -
- I couldn't get FindNPCChatText to work for determining what kind of question it was, but I suppose it can be done several ways, I just ran out of questons :).

- Have to actually get the answers, I'm assuming you can do it just like you would the box, however I wasn't here when we solved it so I don't know how we did it. Leave it to greater minds.





Everything else works perfectly. Good luck whoever wants it.

Wizzup?

2008-10-10 02:24:12

I've taken some looks at Mordaut, and so has SkyScripter.
Basically, identifying all the items isn't even the hardest part, but getting all their information is hard. I wanted to solve it Quiz-Alike. There are just too many items… :)

SKy Scripter

2008-10-10 02:48:09

Hah, First of all.
Each individual item are the same colors… which eliminates all colors.
So no color solving. (Like the sandwich lady)

Second of all.
Each item vary in size meaning they actually change sizes. So no size measuring. (Checking the width and height of the object).

Looks Like that leaves us to one thing…

Shape recognition.
This includes counting corners, holes, lines, and curves…
these are hard algorithms but not only that, they don't give a precise constants with one another. I.E. A Staff and a banana would both give 2 corners…


Once you have got this down. You still have to collect a shit load of data so you can actually determine each item and the variables they have.
then you must distinguish them from each other after words.


The random would be reasonably easier if there wasn't such a wide variety of topics (cooking, woodcutting, and magic) and items you must analyze…

Bam Bam

2008-10-10 06:05:13

From: SKy Scripter
Hah, First of all.
Each individual item are the same colors… which eliminates all colors.
So no color solving. (Like the sandwich lady)

Second of all.
Each item vary in size meaning they actually change sizes. So no size measuring. (Checking the width and height of the object).

Looks Like that leaves us to one thing…

Shape recognition.
This includes counting corners, holes, lines, and curves…
these are hard algorithms but not only that, they don't give a precise constants with one another. I.E. A Staff and a banana would both give 2 corners…


Once you have got this down. You still have to collect a shit load of data so you can actually determine each item and the variables they have.
then you must distinguish them from each other after words.


The random would be reasonably easier if there wasn't such a wide variety of topics (cooking, woodcutting, and magic) and items you must analyze…


Would it be possible to use height - width ratios in conjunction with others to more positively ID the items?

-Bam

n3ss3s

2008-10-10 06:50:12

The ratios seem to be our best clue… Also, reflection can't be used for an official solver, because SRL isn't reflection dependant, so no worries

I guess I will leave that to people who know more about reflection or whatever.


:)

Wizzup?

2008-10-10 07:52:17

From: Bam Bam
Would it be possible to use height - width ratios in conjunction with others to more positively ID the items?

-Bam


That's what I did in the quiz, though.

@ N3ss3s, I thought it was meant to be made for SRL… Didn't read that part.

n3ss3s

2008-10-10 08:15:04

@ N3ss3s, I thought it was meant to be made for SRL… Didn't read that part.


Well my comment was for the point of view that it would be made for SRL? :D

tarajunky

2008-10-10 11:55:07

If we could get a non-official reflection solver, it would immensely help us in creating an official non-reflection solver.

n3ss3s

2008-10-10 13:27:07

I can't understand how. A reflection solver for mordaut would use

a) Interfaces for the main solving
b) Tiles for doors

Despite the fact neither of those has got any similarities with color solving, we won't be able to use Interfaces until we get a SmartGetFieldArray2D…

But anyway, if someone is able to contact Ben and able to make him add a 2D, it'd be nice, whether it'd help with development of mordaut or not…

tarajunky

2008-10-10 13:55:09

I think it would be very helpful just for data collection.

Collecting data on the characteristics of all possible objects would be extremely labor intensive, since a person would have to sit there and identify each object manually. If we can use reflection to identify the objects, it could all be automated.

pwnaz0r

2008-10-10 14:15:37

Ok thats all good, we do need 2d arrays and anyone who can contact ben, let's do it. However, to solve the random, we just need to know how the items get there. The answers have to be somewhere in the client don't they? i know its server side, but still shouldn't it send the correct answer to the client? ethier way, it has to have source to know which items to display.. maybe the use the same UIDs for the objects as in the real game? idk some of this might have already have been established, and i guess thats what n3ss3s was talking about when he said we need interfaces to solve main. The doors are already done, the only problem is I couldn't get FindNPCChatText to work….

Widget

2008-10-10 14:22:52

Just throwing ideas out, but would it be possible to use our minimap autocolors on a larger scale? (The kind where you take the difference of two pixels next to each other and they equal a constant). Generating a new bitmap based on subtraction might yield useful results

pwnaz0r

2008-10-10 14:27:04

I don't understand what you mean Widget?

Wizzup?

2008-10-10 14:37:39

NewAutoColor.scar, right?

Widget

2008-10-10 14:41:35

I'm pretty sure this is how it worked at least. Check NewAutoColor.scar in misc

function GetLadderColor: boolean
var x, y: integer;
begin
for x := MMX1 to MMX2 do
for y := MMY1 to MMY2 do
if (GetColor(x, y) - GetColor(x - 1, y) = 2268414) then
Result := GetColor(x, y);
end;
(That function probably doesn't work :p)

Do something like this on the whole image, maybe it'll give us some more colors to work with :)

Edit: Wizzy beat me :)

Smartzkid

2008-10-10 15:25:48

Find out how RSBot/iBot solve it

HyperSecret

2008-10-10 15:45:01

RSBot/iBot can't solve it afaik…at least RSBot couldn't…

Boreas

2008-10-10 17:49:31

Does anyone still have that list of sets with attributes? It was floating around months ago.

Narcle

2008-10-10 18:22:50

If you have him get 2D's is GetSmartExtended possible? Would be nice >.<

Bobarkinator

2008-10-10 21:48:47

I don't see Ben putting anything into smart for a while. He doesn't really have any time. I can link him here if you want the next time he gets on

Narcle

2008-10-10 23:23:26

From: Bobarkinator
I don't see Ben putting anything into smart for a while. He doesn't really have any time. I can link him here if you want the next time he gets on


Should make a small list for that, lol.

SKy Scripter

2008-10-11 02:06:11

From: Boreas
Does anyone still have that list of sets with attributes? It was floating around months ago.


{



-Weapens
1. Scimitar - Sword - Battle Axe
Tiara - Arrows - Staff - *Mace*

2. Shortbow - Arrows - Crossbow
*Longbow* - Pickaxe - Mind talisman - Spear

-Armor
1. Sq shield - Wooden shield - Antidragon shield
*Kiteshield* - Ore - Some drink - Cake

2. Spear - Full helm - Kiteshield
Fire rune - Earth rune - Bullseye lantern - Platebody

3. Boots - Boots - Boots
*Fighing boots* - Platelegs - cape - poison

4. sword - full helm - kite shield
*platebody* - lantern - earth rune - fire rune

-Accessories
1. Necklace - Tiara - Holy symbol
Pickaxe - Hammer - Fish - *Ring*

2. Thieve mask - Lederhosen hat - Captain hat
Logs - *jester hat* - Cake - pickaxe

-Food
1. Banana - Strawberry - Pineapple
Arrows - Sword - *Berry's* - Hammer

2. Bread - Cake - Pizza
Arrows - *Apple pie* - Bowl - Earth rune

3. Cup - Beer - Rum
*Gnome cocktail* - Lederhosen hat - Fish - Apple pie

4. Banana - Garlic - Watermelon?
*Pineapple* - Feather - Fish - Bar

-Fish/Fishing
1. Fish - Harpoon - Swordfish
PickAxe - Pie - Drink - *Fish*


2. Shrimp - Sardine - trout
*swordfish*, earth rune, ore, pineapple

-Smith/Mining
1. Pickaxe - Ore - Hammer
Gnome cocktail - Empty vial - *Bar* - Watering Can

2. Platebody - Bar - Ore
Some bottle - Fish - *Pickaxe* - Cape

-WoodCutting/FireMaking
1. Thinderbox - Logs - Candle
Pickaxe - *Bullseye lantern* - Harpoon - Arrows

-Runes/Magic
1. Air rune - Fire rune - Staff
Arrows - Hammer - Logs - *Earth rune*

-Farming
1. Rake - Watering can - Spade
Cake - Gloves - *Gardening Trowel* - Earth rune


}


this?

n3ss3s

2008-10-11 03:24:51

Next time someone gets a mordaut, and if RSBot has been fixed, run the interface explorer script and see if the items have any relation to their 'real' IDs…

Boreas

2008-10-11 13:18:53

From: SKy Scripter
{



-Weapens
1. Scimitar - Sword - Battle Axe
Tiara - Arrows - Staff - *Mace*

2. Shortbow - Arrows - Crossbow
*Longbow* - Pickaxe - Mind talisman - Spear

-Armor
1. Sq shield - Wooden shield - Antidragon shield
*Kiteshield* - Ore - Some drink - Cake

2. Spear - Full helm - Kiteshield
Fire rune - Earth rune - Bullseye lantern - Platebody

3. Boots - Boots - Boots
*Fighing boots* - Platelegs - cape - poison

4. sword - full helm - kite shield
*platebody* - lantern - earth rune - fire rune

-Accessories
1. Necklace - Tiara - Holy symbol
Pickaxe - Hammer - Fish - *Ring*

2. Thieve mask - Lederhosen hat - Captain hat
Logs - *jester hat* - Cake - pickaxe

-Food
1. Banana - Strawberry - Pineapple
Arrows - Sword - *Berry's* - Hammer

2. Bread - Cake - Pizza
Arrows - *Apple pie* - Bowl - Earth rune

3. Cup - Beer - Rum
*Gnome cocktail* - Lederhosen hat - Fish - Apple pie

4. Banana - Garlic - Watermelon?
*Pineapple* - Feather - Fish - Bar

-Fish/Fishing
1. Fish - Harpoon - Swordfish
PickAxe - Pie - Drink - *Fish*


2. Shrimp - Sardine - trout
*swordfish*, earth rune, ore, pineapple

-Smith/Mining
1. Pickaxe - Ore - Hammer
Gnome cocktail - Empty vial - *Bar* - Watering Can

2. Platebody - Bar - Ore
Some bottle - Fish - *Pickaxe* - Cape

-WoodCutting/FireMaking
1. Thinderbox - Logs - Candle
Pickaxe - *Bullseye lantern* - Harpoon - Arrows

-Runes/Magic
1. Air rune - Fire rune - Staff
Arrows - Hammer - Logs - *Earth rune*

-Farming
1. Rake - Watering can - Spade
Cake - Gloves - *Gardening Trowel* - Earth rune


}


this?


Almost. Start with that, then replace items with their attribute. IE staff and spear to long thin, runes and cake to round, arrows to groups, etc. Start with those easy ones, and then go to more advanced shape detection until each group is unique. This way you won't have to tell the difference between a sword and staff, just tell the difference between groups as a whole.

Yakman

2008-10-12 05:38:24

you can access each index of a java array individually, i think.

something like this

var
list, indexone, indextwo: Integer;

//same as doing indextwo:= list[2][4];
list:= SmartGetField('some.2d.array');
if(list = 0)then Exit;
indexone:= SmartGetFieldArray(list, 2);
if(indexone = 0)then Exit;
indextwo:= SmartGetField(indexone, 4);

it should work, thats exactly how its done in java bytecode


getstatic int[][] list //push the 2d array on the stack
iconst_2 //push integer 2 on the stack
aaload //get an object at index 2, and push it on the stack
iconst_4 //push integer 4 on the stack
iaload //get an integer at index 4
putstatic int somewhere //store the value somewhere

n3ss3s

2008-10-12 05:52:49


Procedure Blah;

Var
A, B, C, D, E: Integer;
Begin
A := SmartGetFieldArraySize(0, getInterfaceCache);
For B := 0 To A - 1 Do
Begin
D := SmartGetFieldArrayObject(0, getInterfaceCache, B);
If D > 0 Then
Writeln(IntToStr(D) + ' : ' + IntToStr(B));
E := SmartGetFieldArraySize(D, '');
If E > 0 Then
Writeln('S: ' + IntToStr(E));
SmartFreeObject(D);
End;
End;


It's saying all of the getInterfaceCache's indexes' sizes are -1