SCAR Code:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Cooking routines --//
//-----------------------------------------------------------------//
// * Function FindRange(Var x, y : Integer; x1, y1, x2, y2 : Integer) : Boolean; | By Squigglyo edited by Bebemycat2
// * Function FindCRange(Col : integer): Boolean; | By Tickyy
// * Function CookMenu: Boolean; | By Tickyy
// * Function CookAnything(Color : Integer; Uptext : string; RangColor : Integer): boolean; | by Tickyy
{*******************************************************************************
function FindRange(var x, y : Integer; x1, y1, x2, y2: Integer): Boolean;
By: Squigglyo edited by Bebemycat2
Description: Will find a range inside the variables given, it wont
click it, but it will put the coords in the first 2 variables
*******************************************************************************}
function FindRange(var x, y: Integer; x1, y1, x2, y2: Integer): Boolean;
var
DTMRange: Array [1..6] of Integer;
FX, FY, i: Integer;
begin
DTMRange[1] := DTMFromString('78DA6364606460B8CD0006AC108AA14D868F4' +
'10E48036518FE0301E30B20E30AAA1A2D0D0DB81A1060E406B22E' +
'A3AAB9612083AA4600C8BA89AAC6DCC808550D2B907517554D517' +
'636A69A8BA86AD2EC3851D40000287B0FD4');
DTMRange[2] := DTMFromString('78DA637464646058CA0006AC108A212F2D8D4' +
'10E48036518FE0301A30990B51655CD726531B81A10603403B2E6' +
'A3AA3137324255E30964ED475563626080AA460FC83A82AA264D8' +
'C13450D00E6AA0D1F');
DTMRange[3] := DTMFromString('78DA63D461646098C30006AC108A61AEA2108' +
'31C9006CA30FC07024679206B2AAA1A732323B81A10607406B256' +
'11506300644D445593939282AA460DC85A84AA668D9A18AA1A0B2' +
'06B3BAA1A3D1D1D14350062B70E6A');
DTMRange[4] := DTMFromString('78DA6314666460686200035608C5A0A7A3C32' +
'007A481320CFF81809103C86A435573514F12AE060418F580AC76' +
'54355A1A1AA86A5881AC1A543587B5D0CC01B9A71B554DAF9C108' +
'A1A00FF8B0B8D');
DTMRange[5] := DTMFromString('78DA637CC9C0C03089010C582114C3491D490' +
'63920CD08C4FF8180F133905185AA464612A1060418BF02891E54' +
'35FD7242A86A1E00896E54357E1E1E286A00B11B0D5E');
DTMRange[6] := DTMFromString('78DA637CC1C0C03087010C582114839E8E0E8' +
'31C906604E2FF40C0780DC8988DAAC6CBD515AE0604181F018989' +
'A86AD4949551D5DC02125351D5E4A4A4A0AA790E24A6A0AA690BE' +
'243510300B6840FE8');
for i := 1 to 6 do
begin
if (FindDtm(DTMRange[i], FX, FY, x1, y1, x2, y2)) then
begin
if (FX > 10) and (FY > 10) and (FX < 500) and (FY < 330) then
begin
MMouse(FX, FY, 6, 6);
Result := True;
Exit;
end;
end;
Wait(10);
end;
For i := 1 to 6 do
FreeDTM(DTMRange[i]);
end;
{*******************************************************************************
Function FindCRange(Col : integer): Boolean;
By: Tickyy
Description: Finds the range based on your color and MMouses on it.
*******************************************************************************}
Function FindCRange(Col : integer): Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
I, GCT, H, X, Y : Integer;
begin
if not LoggedIn then
Exit;
GCT := GetColorToleranceSpeed;
If Not GCT = 2 Then
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Col, MSX1, MSY1, MSX2, MSY2, 5);
If Length(TPA) = 0 Then
FindColorsSpiralTolerance(MSCX, MSCY, TPA, Col, MSX1, MSY1, MSX2, MSY2, 10);
If Length(TPA) = 0 Then
Exit;
ATPA := TPAtoATPA(TPA, 15);
H := High(ATPA);
For i := 0 To H do
begin
MiddleTPAex(ATPA[i], X, Y);
MMouse(X, Y, 3, 3);
Wait(250 + Random(100));
if IsUpTextMultiCustom(['ange', 'ptions']) then
begin
Wait(100);
GetMousePos(x, y);
Result := True;
ColorToleranceSpeed(1);
Exit;
end;
end;
end;
{*******************************************************************************
Function CookMenu: Boolean;
By: Tickyy
Description: Returns true if the Cooking menu appears..
*******************************************************************************}
Function CookMenu: Boolean;
begin
Result := FindTextTPA(128, 0, 119, 351, 369, 419, 'bject', StatChars, nothing);
end;
{*******************************************************************************
Function CookAnything(Color : Integer; Uptext : string; RangColor : Integer; CookAll : Boolean): boolean;
By: Tickyy
Description: Finds the item based on your color and Uptext, and will Click on
the Cook-all Button.
Color = The color of your item
Uptext = The uptext of your item
RangColor = The color of the cooking range
CookAll = If you wanna cook them all
*******************************************************************************}
Function CookAnything(Color : Integer; Uptext : string; RangColor : Integer; CookAll : Boolean): boolean;
var
x, y : integer;
begin
if not LoggedIn then
exit;
if GetCurrentTab <> 4 then
GameTab(4);
if FindColor(x, y, Color, MIX1, MIY1, MIX2, MIY2) then
MMouse(x, y, 2, 2);
If IsUpText(uptext)then
begin
GetMousePos(x, y);
Mouse(X, Y, 0, 0, True);
end;
Wait(200);
FindCRange(RangColor);
if CookMenu then
if CookAll =: True then
begin
MouseBox(224, 391, 285, 433, 2);
Result := WaitOption('All', 250);
End else
MouseBox(224, 391, 285, 433, 1);
end;
end;