SRL Archive - SRL Archives

Cooking.Scar


Tickyy

2009-07-04 05:29:50


//-----------------------------------------------------------------//
//-- 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;

Uhhmmm… i like just like it is atm, don't do shorting stuff pl0x :p

Tell me if anything is missing.

Awkwardsaw

2009-07-04 05:31:07

D=.
 tags pl0x

Tickyy

2009-07-04 05:31:46

From: akwardsaw
D=.
 tags pl0x


uhhmmm.. what?

Awkwardsaw

2009-07-04 05:39:17

From: Tickyy
uhhmmm.. what?


oh your good. ;)

and as for the procedures, they all look good tbh(not talking about how it can be shortened) although there are things that i would do a little different, although it does the same thing :P

Blumblebee

2009-07-04 05:55:30

in findCRange you dont set the ColorSpeed back to the original.

Tickyy

2009-07-04 12:30:09

From: Blumblebee
in findCRange you dont set the ColorSpeed back to the original.


The normal ColorToleranceSpeed is 2….

Naum

2009-07-04 13:27:52

From: Tickyy
The normal ColorToleranceSpeed is 2….


program New;
{.Include SRL/SRL.Scar}

Var x, y : Integer;

begin
SetupSRL;
WriteLn(GetColorToleranceSpeed);
end.

:). Good work rep+

Tickyy

2009-07-04 13:34:13

From: NaumanAkhlaQ
program New;
{.Include SRL/SRL.Scar}

Var x, y : Integer;

begin
SetupSRL;
WriteLn(GetColorToleranceSpeed);
end.

:). Good work rep+


oww, i thought it was 2, thanks tho… :)

Fixed.

Sir R. M8gic1an

2009-07-04 13:39:14

Ok, let me just ask you this: what the hell is the point of adding this, if people will still have to go and pick colors?

And if the CookFish goes by colors, then why not 'CookAll' ?

~RM

Tickyy

2009-07-04 13:45:43

From: Rasta Magician
Ok, let me just ask you this: what the hell is the point of adding this, if people will still have to go and pick colors?

And if the CookFish goes by colors, then why not 'CookAll' ?

~RM


2 Things:

There are 60,000+ members out there, maybe one of them is going to make a simple script, then why not use a TPA instant of simple Findcolor thing, i made it in color because ranges always can change in the future, so this never gets outdated….

From: Rasta Magician


And if the CookFish goes by colors, then why not 'CookAll' ?

~RM



MouseBox(224, 391, 285, 433, 2);
Result := WaitOption('All', 250);
end;

Did you even read it properly?

Sir R. M8gic1an

2009-07-04 13:58:39

From: Tickyy
2 Things:

There are 60,000+ members out there, maybe one of them is going to make a simple script, then why not use a TPA instant of simple Findcolor thing, i made it in color because ranges always can change in the future, so this never gets outdated….




MouseBox(224, 391, 285, 433, 2);
Result := WaitOption('All', 250);
end;

Did you even read it properly?


1: FindObjectCustom, FindObjectTPA, FindObjectRecord pretty much cover and are better than your first function.

2: I mean 'cookAll' as a name, as in being able to cook meat, since all it does is look for colors anyway. And for this again, FindObject + WaitOption.

~RM

Tickyy

2009-07-04 15:12:04

I Like it as it is, and i use it all the time, if you don't like it then don't use it.

Simple.

Sir R. M8gic1an

2009-07-04 15:15:57

lol, if you post it in public svn then i'm guessing you were expecting it to get added, otherwise i can move it to public test corner if you'd rather have it there.

and i was explaining why it wouldn't be added instead of just simply posting no.

~RM

Tickyy

2009-07-04 15:23:17

Dude, i am trying to contribute, i don't choose which one should be added and which one not, if they like just one of them then take just one of them, JaGeX is doing everything to prevent Marcoing, i am just trying my best for a better future, even if i'm not such a good scripter, i'm trying my best, i hope you understand what i mean.

And yes, i like your idea with the cook all, if you don't mind i'll change the name right now :D!

Sir R. M8gic1an

2009-07-04 15:29:57

relax, i know you're trying your best, which is why i criticize your function. It's not to put you down, it's to help you develop your skills more.

~RM