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..