ContinueFunc
Clicks Continue until the continues dissapear.. Made by Danrox2004
SCAR Code:
function ContinueFunc(): boolean;begin
if (ClickToContinue) then
begin
result:=true
repeat
wait(1000 + random(1000));
until (not ClickToContinue)
end else
Result := false;
end;
Check4Head
Checks for a color in the left of the chat box suggesting the face of an npc might be there which means you are talking to an NPC. Made by Danrox2004
SCAR Code:
function Check4Head(color: integer): boolean;
begin
Result:=FindColorTolerance(x, y, color, MCX1, MCY1, MCX2, MCY2, 15)
end;
TalkToNPC
Function used alot in my tutorial island script. Description below. Made by Danrox2004.
SCAR Code:
function TalkToNPC(Color: integer; Head: integer): boolean;
begin
Time := 0;
MarkTime(Time);
repeat
repeat
SendArrowSilentWait(1, 1000 + random(1000));
wait(500 + random(1000));
if (TimeFromMark(Time) > (60000)) then
break;
until (FindObjMultiText(x, y, 'Talk-to', 'Talk', '-to', Color, 15))
if (TimeFromMark(Time) > (60000)) then
NextChar;
mouse(x, y, 10, 10, true);
Flag;
wait(1000 + random(1000));
until (Check4Head(Head))
ContinueFunc;
Result := true;
end;
This is a function I used alot during my Tutorial Island Script.
It is very useful because it is fairly fast. It finds NPC's based on a color and clicks on it if Talk is in the top left. It then checks that it is talking to the NPC by checking for a specific color in the text window, where the NPC's face should be. It then Clicks to continue until Click to continue disappears.
If it doesn't find Talk-to in the top left or cannot find the face of the NPC in the chat box then it looks again for the NPC, for up to 60 seconds. If it cannot find it it returns false.
I have only tested this on tutorial island and it works very well.
I had some free time and decided to modify some procedures which searched for more then one thing and make them arrays so they search for as many things as they want.
None of these have been tested
sorry
Thanks for xxKanexx for showing how to do arrays in functions.
FindBitmapsProgressiveTol
Credits go to Stupid3000 for origional function.
SCAR Code:
{*******************************************************************************
function FindBitmapsProgressiveTol(Bmp: array of Integer;tolmax, step, xs, ys, xe, ye: Integer): Boolean;
By: Stupid3000
Description: Finds any of maximum 5 bitmaps in box specified by xs,ys,xe,ye.
If you only need to find one bitmap, fill in 0 for others.
*******************************************************************************}
function FindBitmapsProgressiveTol(Bmp: array of Integer; tolmax, step, xs, ys, xe, ye: Integer): Boolean;
var //by Stupid3ooo
c, i: Integer;
begin
for i:= 0 to GetarrayLength(Bmp)-1 do
begin
while (c < tolmax) do
begin
c := c + step;
if (Bmp[i] > 0) then
begin
if (FindBitmapSpiralTolerance (Bmp[i], x, y, xs, ys, xe, ye, c)) then
begin
Result := True;
break;
end;
end;
end
end;
end;
DropMulti
SCAR Code:
{*******************************************************************************
procedure DropMulti(I: Array of Integer);
By: Danrox2004
Description: Drops all except item(s) specified by inventory number(s).
*******************************************************************************}
procedure DropMulti(a: array of Integer);
var
InvSpot, i: integer;
begin
for InvSpot := 1 to 28 do
begin
for i:= 0 to GetarrayLength(a)-1 do
begin
if(InvSpot = a[i]) then
If(ItemExists(InvSpot) then DropItem(InvSpot)
end
end
end;