SRL Archive - SRL Archives

Fletching.scar


Richard

2009-05-26 03:31:50

So I went through the includes folder, strolled across fletching.scar, and saw that it was rather empty, so I thought I'd make something useful for it:

{*******************************************************************************
Function FletchingInterface: Boolean;
By: Richard
Description: Returns true if the fletching interface is in the chatbox
*******************************************************************************}
Function FletchingInterface: Boolean;
Begin
Result := (GetColor(370, 462) = 0) or (GetColor(421, 446) = 0);
end;

{*******************************************************************************
Function: MakeBow(BowType: String; Amount: Integer): Boolean;
By: Richard
Description: Clicks on the correct bow, and makes the desired amount
*******************************************************************************}

Function MakeBow(BowType: String; Amount: Integer): Boolean;
Var
BoxPoint: TPoint;
Begin
If not(FletchingInterface) then
Exit;
BoxPoint.y := 415;
Begin
If (GetColor(80, 408) = 734808) then
Begin
Case lowercase(BowType) of
'arrow shafts' : BoxPoint.x := 75;
'short bow' : BoxPoint.x := 197;
'long bow' : BoxPoint.x := 317;
'crossbow stock' : BoxPoint.x := 437;
else
srl_Warn('MakeBow', BowType+ ' is not a valid bow type', warn_AllVersions);
end;
end else
Begin
Case lowercase(BowType) of
'short bow' : BoxPoint.x := 109;
'long bow' : BoxPoint.x := 260;
'crossbow stock' : BoxPoint.x := 406;
else
srl_Warn('MakeBow', BowType+ ' is not a valid bow type', warn_AllVersions);
end;
end;
end;
Mouse(BoxPoint.x, BoxPoint.y, 10, 10, False);
If InStrArr(IntToStr(Amount), ['1', '5', '10'], True) Then
Result := ChooseOption('ake ' + IntToStr(Amount))
else
Begin
Result := ChooseOption('ake X');
TypeSend(IntToStr(Amount));
end;
end;

Comments/suggestions please :)

Smarter Child

2009-05-26 03:34:25

How can [PHP]Function: MakeBow(BowType: String; Amount: Integer): Boolean;[/PHP] determine the type, such as yew/maple/oak/etc.
You can also use the same function with a lot of tweaking, and make a function for stringing bows. Very good though:D

Edit: Is the amount option only 1,5,10?

Edit: Nvm/.

Richard

2009-05-26 03:39:03

From: Smarter Child
How can [PHP]Function: MakeBow(BowType: String; Amount: Integer): Boolean;[/PHP] determine the type, such as yew/maple/oak/etc.
You can also use the same function with a lot of tweaking, and make a function for stringing bows. Very good though:D


Except for normal logs, the interface for making bows is exactly the same. And it already checks whether its a normal log or not.

Nava2

2009-05-30 22:01:22

If we add these, it kinda defeats the purpose of writing a fletching script..

Does a lot of the work for you.

jakeyboy29

2009-05-30 22:51:11

nice, people can make super flectchers now!

Dynamite

2009-05-30 23:09:53

From: jakeyboy29
nice, people can make super flectchers now!


Why it doesn't make a difference to how good they are.
It just how much the scripter actually needs to do.

T~M

NCDS

2009-05-31 00:26:53

From: Nava2
If we add these, it kinda defeats the purpose of writing a fletching script..

Does a lot of the work for you.


I see no reason why it would cause any trouble. Most everyone that can make that function themselves, and want to, will.

Also, having function's like that in SRL might end up encouraging someone new to start scripting.

I haven't tested but it look's like Richard did a good job with these.

Just my thought's :)

jakeyboy29

2009-05-31 01:29:17

From: The Man
Why it doesn't make a difference to how good they are.
It just how much the scripter actually needs to do.

T~M


the flecthing part cant fail now ;)