SRL Archive - SRL Snippets

Crafting functions


Er1k

2012-01-11 08:31:32

Just came across the crafting skills library and thought I could add a bit onto it. These are some checks I used in my crafting scripts. I wish I could add the mouseboxes for crafting the items as well but I wouldn't want to share an untested snippet as I don't have p2p to get all the boxes tested.

{*******************************************************************************
function TanScreen: Boolean;
Description: Checks if the tanning screen is open
*******************************************************************************}
function TanScreen: Boolean;
var x, y: integer;
begin
Result:= FindText(x, y, 'hides', UpCharsEx, 92, 29, 396, 54);
end;

{*******************************************************************************
function GoldScreen: Boolean;
Description: Checks if the jewelry crafting screen is open
*******************************************************************************}
function GoldScreen: Boolean;
var x, y: integer;
begin
Result:= FindText(x, y, 'like to make', UpCharsEx, 92, 29, 396, 54);
end;

{*******************************************************************************
function SilverScreen: Boolean;
Description: Checks if the silver crafting screen is open
*******************************************************************************}
function SilverScreen: Boolean;
var x, y: integer;
begin
Result:= FindText(x, y, 'Silver Casting', UpCharsEx, 92, 29, 396, 54);
end;

Coh3n

2012-01-11 21:52:08

Since those use the same fonts and search box, they could be combined into one function:

function CraftingScreen(text: string): boolean;
var
x, y: integer;
begin
result:= FindText(x, y, text, UpCharsEx, 92, 29, 396, 54);
end;

// then call it like
CraftingScreen('Silver Casting');