Richard
2009-04-05 18:17:08
I had no internet connection for the last couple of days and was rather bored, so I made some adjustments/additions to some of the includes. They're not very good, as I've only worked on them for a little while, I may work on them/add more when I feel in the mood.
SRL/SRL/skill/BuySell.scar
This is the same as BuyColor, but with multiple colours so you can be more sure you'll get the right item.
SRL/SRL/skill/Crafting.scar
Waits for the clay making screen until the time runs out or it finds the screen, returns the result true if it finds the screen.
Same as FindClayScreenEx, except doesn't have a timer.
Will click the clay making box if the screen is present, uses the different options for increased efficiency.
SRL/SRL/skill/Fighting.scar
Will fight the NPc the same as FightNPC, except this can also deal with it when the monster is a higher level than the character.
Feel free to insult the ideas, but with suggestions ;)
SRL/SRL/skill/BuySell.scar
{*******************************************************************************
Procedure BuyColors(Colors: TIntegerArray; Amount: Integer);
By: Richard
Description: Same as BuyColor, but with multiple colors.
*******************************************************************************}
Procedure BuyColors(Colors: TIntegerArray; Amount: Integer);
Var
i, x, y : Integer;
Begin
For i := 0 to High(Colors) do
While (FindColorSpiral(x, y, Colors[i], 16, 53, 501, 321)) do
BuyCoords(x, y, Amount);
end;This is the same as BuyColor, but with multiple colours so you can be more sure you'll get the right item.
SRL/SRL/skill/Crafting.scar
{*********************************************************************
Function FindClayScreenEx(MaxWait: Integer): Boolean
By: Richard
Description: Will return the result true if the clay crafting screen
is found within the max time given.
**********************************************************************}
Function FindClayScreenEx(MaxWait: Integer): Boolean;
Var
x, y, i: Integer;
Begin
MarkTime(i);
Repeat
If (TimeFromMark(i) >= MaxWait) then
Begin
Result := False;
Exit;
end;
Until FindText(x, y, 'make', NPCChars, MCX1, MCY1, MCX2, MCY2);
end;Waits for the clay making screen until the time runs out or it finds the screen, returns the result true if it finds the screen.
{*********************************************************************
Function FindClayScreen: Boolean
By: Richard
Description: Will return the result true if the clay crafting screen
is found.
**********************************************************************}
Function FindClayScreen: Boolean;
Var
x, y: Integer;
Begin
Result := FindText(x, y, 'make', NPCChars, MCX1, MCY1, MCX2, MCY2);
end;Same as FindClayScreenEx, except doesn't have a timer.
{*******************************************************************
Procedure MakeClay(Amount: Integer);
By: Richard
Description: Will make the desired amount of clay if the clay screen
is present.
********************************************************************}
Procedure MakeClay(Amount: Integer);
Begin
If not(FindClayScreen) then
Begin
srl_Warn('MakeClay', 'No clay making screen', warn_AllVersions);
Exit;
end;
Begin
Case Amount of
1: Begin
Mouse(220, 390, 50, 50, True);
Exit;
end;
5, 10: Begin
Mouse(220, 390, 50, 50, False);
ChooseOption(IntToStr(Amount));
Exit;
end;
end;
Begin
If Amount >= 14 then
Begin
Mouse(220, 390, 50, 50, False)
ChooseOption('ll');
end else
Begin
Mouse(220, 390, 50, 50, False);
ChooseOption('X');
TypeSend(IntToStr(Amount));
end;
end;
end;
end;Will click the clay making box if the screen is present, uses the different options for increased efficiency.
SRL/SRL/skill/Fighting.scar
{*******************************************************************************
function FightNPCEx(Colors : TIntegerArray, tol, TimeOut: Integer,
HigherLevel: Boolean): Boolean;
By: WT-Fakawi, Cazax & Richard
Description: Fights NPC. Input an array of colors. (May be the same colors),
tol = tolerance, TimeOut = amount of time before clicking on next NPC,
HigherLevel = is the monster higher level than the character?
*******************************************************************************}
function FightNPCEx(Colors : TIntegerArray; tol, TimeOut: Integer; HigherLevel: Boolean): Boolean;
var
Mark, x, y: Integer;
begin
if (not LoggedIn) then Exit;
If not(HigherLevel) then
Begin
if (FindObjCustom(x, y, ['evel'], Colors, tol)) then
begin
Result := True;
GetMousePos(x, y);
if (not (LoggedIn)) or (FindDead) then
begin
Result := False;
Exit;
end;
Mouse(x, y, 0, 0, True);
Wait(1000 + Random(500));
FFlag(10);
end;
end else
Begin
if (FindObjCustom(x, y, ['evel'], Colors, tol)) then
begin
Result := True;
GetMousePos(x, y);
if (not (LoggedIn)) or (FindDead) then
begin
Result := False;
Exit;
end;
Mouse(x, y, 0, 0, False);
ChooseOption('ttack');
Wait(1000 + Random(500));
FFlag(10);
end;
end;
Begin
MarkTime(Mark);
repeat
if (not (LoggedIn) or (FindDead) or (FindNormalRandoms)) then Break;
Wait(1000 + Random(500));
if (TimeFromMark(Mark) > TimeOut) then Break;
until ((not FindColorSpiral(x, y, 65280, 240, 140, 290, 175))
or (FindDead)
or (TimeFromMark(Mark) > TimeOut));
end;
end;Will fight the NPc the same as FightNPC, except this can also deal with it when the monster is a higher level than the character.
Feel free to insult the ideas, but with suggestions ;)