SRL Archive - Reflection Development

Sandwich Lady Solver


Bad Boy JH

2010-10-14 00:15:10

function InSandwichLadyRandom: Boolean;
begin
Result := ValidInterface(243);
end;

function DetectFreeItem: Integer;
var
S: string;
begin
S := Between('have a ', ' for free', GetInterfaceText(243, 6));
Case lowercase(S) of
'doughnut' : Result := 45666;
'baguette' : Result := 10726;
'roll' : Result := 10727;
'chocolate bar' : Result := 10728;
'meat pie' : Result := 10730;
'square sandwich' : Result := 10731;
'triangle sandwich' : Result := 10732;
end;
end;

Function FoodPoint(ID: Integer): TPoint;
var
I: Integer;
Children: TIntegerArray;
begin
Children := [11, 13, 15, 17, 19, 21, 45];
For I := 0 to 6 do
if GetModelID(297, Children[i]) = ID then
Break;
Case I of
0 : Result := Point(129, 209);
1 : Result := Point(220, 215);
2 : Result := Point(332, 226);
3 : Result := Point(432, 223);
4 : Result := Point(180, 148);
5 : Result := Point(442, 152);
6 : Result := Point(296, 145);
7 : Result := Point(-1, -1);
end;
end;

Function WaitForSelectionScreen: Boolean;
var
Mark: Integer;
begin
MarkTime(Mark);
while TimeFromMark(Mark) < 60000 do
begin
Wait(randomRange(500, 1500));
if ValidInterface(297) then
begin
Result := True;
Exit;
end;
end;
end;

Procedure ExitSandwichRandom;
var
ThePoint: TPoint;
begin
ThePoint := TileToMS(Tile(10141, 3926), Random(10);
Mouse(ThePoint.x, ThePoint.y, 20, 20, True);
end;

Function SolveSandwichRandom: Boolean;
var
Item: Integer;
ThePoint: TPoint;
begin
if not InSandwichLadyRandom then
Exit;
Item := DetectFreeItem;
R_ClickToContinue;
WaitForSelectionScreen;
ThePoint := FoodPoint(Item);
if (ThePoint.x = -1) or (ThePoint.y = -1) then
Exit;
Mouse(ThePoint.x, ThePoint.y, 10, 10, True);
ExitSandwichRandom;
Result := True;
end;

This should work, however I am unsure about the strings in detect free Item. Other than that I don't really like the detect random, but when in the random, I ran…

DumpNPCs(GetNPCS);
but It didn't print anything…which is weird..

i luffs yeww

2010-10-14 00:21:27

Could she be an object?

EDIT: There should be a DumpEverything(); procedure.. :p

Cstrike

2010-10-14 00:50:23

May be the problem I have (check my thread on Null NPC's)

Bad Boy JH

2010-10-14 00:50:34

no…all npcs (which includes Fishing spots) have a yellow uptext. Objects have a blue uptext.

She has a yellow uptext.

pyroryan

2010-10-14 13:15:49

Try
DumpNPCs(GetNPCs);
with a lowercase "s"

noidea

2010-10-14 13:21:26

From: pyroryan
Try
DumpNPCs(GetNPCs);
with a lowercase "s"


pascal/Simba is not case sensitive iirc

pyroryan

2010-10-14 13:51:27

From: noidea
pascal/Simba is not case sensitive iirc


Lol I always forget which languages are or aren't, so I always stick with the case sensitive style. But if it doesn't matter, then I'll look into this later on today.

Cstrike

2010-10-14 14:12:27

function InSandwichLadyRandom: Boolean;
begin
Result := ValidInterface(243);
end;

Is there another way to do this? My frog random returns interface 243 as well, I use NPCsNull since it'd probably return the same for most randoms (if youre still in it, try out the Null modification in my other thread)

mormonman

2010-10-14 15:15:19


function InSandwichLadyRandom: Boolean;
begin
Result := ValidNPC('Sandwich Lady');//not sure if that is her name exactly
end;

This needs to be heavily edited….you just have the basics done. Your solving procedure needs some help :P it isn't failsafed at all.

Bad Boy JH

2010-10-14 22:47:34

mormonman, I created a basic structure, a framework to build off, I don't understand exactly what you guys want. It is failsafed, but maybe not to the standard you guys want. I just thought if I could even get a good framework it would be better than having nothing.

I understand your issue cstrike, and if you read the whole post, I said I was looking for a better way, but she wasn't returning as a validNPC.

also I now have a picture/cup thing…apparently

Cstrike

2010-10-14 23:02:22

From: Bad Boy JH
I understand your issue cstrike, and if you read the whole post, I said I was looking for a better way, but she wasn't returning as a validNPC.


From: Cstrike
(if youre still in it, try out the Null modification in my other thread)

:garfield:


BTW there is new detection framework getting setup, so you and I need not worry about making R_InRand procedures ;) It will hopefully emerge in the near future. Stay tuned!

kingarabian

2010-10-15 00:44:27

Best of luck. Im going to be changing my random solving path's in my scripts pretty soon.