Shuttleu
2009-05-15 02:18:37
well i finished working on my version of the IsSkillFlashing function and i tested Nadeem's against mine
Nadeem's
Mine
as you can see there is quite a large differance of 2 seconds which can be quite a lot if you want to only check it quickly
single skill
all skills
Enjoy :D
Oh and credit to zasz for the idea :p
~shut
Nadeem's
Successfully compiled (2454 ms)
SRL Compiled in 31 msec
2309
True
Successfully executed
Mine
Successfully compiled (2454 ms)
SRL Compiled in 31 msec
203
True
Successfully executed
as you can see there is quite a large differance of 2 seconds which can be quite a lot if you want to only check it quickly
{*******************************************************************************
function GetSkillsFlashing: TStringArray;
By: Shuttleu
Description: Returns a Array of skills that are flashing
*******************************************************************************}
function GetSkillsFlashing: TStringArray;
var
SkillPoint : TPoint;
SkillOffPut : TPointArray;
SkillName : TStringArray;
OriginalColor, SkillColor : TIntegerArray;
i, p, xx, yy : Integer;
begin
if GameTab(2) then
begin
SetArrayLength(SkillName, 24);
SkillName:=['attack', 'hitpoints', 'mining', 'strength', 'agility',
'smithing', 'defence', 'herblore', 'fishing', 'range',
'thieving', 'cooking', 'prayer', 'crafting', 'firemaking',
'magic', 'fletching', 'woodcutting', 'runecrafting', 'slayer',
'farming', 'construction', 'hunting', 'summoning'];
SetArrayLength(OriginalColor, 24);
OriginalColor:= [11053479, 143297, 7829622, 5669024, 3692653, 3357758,
8882557, 25088, 12568251, 607086, 2827562, 202813,
10666673, 603476, 3239099, 10619427, 949280, 949280,
937437, 11447468, 16732742, 2768209,3748925, 15261406];
SetArrayLength(SkillOffPut, 24);
SkillOffPut:= [Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10),
Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10),
Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 9), Point(10, 8), Point(10, 10),
Point(10, 10), Point(10, 10), Point(10, 10), Point(10, 10), Point(9, 10), Point(10, 10)];
SetArrayLength(SkillColor, 24);
for p:=0 to 23 do
begin
if (p = 0) and (not(GetColor(724, 246)=4873574)) then
begin
MMouse(719, 228, 5, 5);
GetMousePos(xx, yy);
HoldMouse(xx, yy, True);
Wait(300+Random(300));
ReleaseMouse(xx, yy, True);
end;
if (p = 21) and (GetColor(724, 246)=4873574) then
begin
MMouse(721, 440, 5, 5);
GetMousePos(xx, yy);
HoldMouse(xx, yy, True);
Wait(300+Random(300));
ReleaseMouse(xx, yy, True);
end;
SkillPoint:= SkillToCoords(True, SkillName[p]);
SkillColor[p]:= GetColor(SkillPoint.x - SkillOffPut[p].x, SkillPoint.y + SkillOffPut[p].y);
end;
for i:=0 to 24 do
if (not(OriginalColor[i] = SkillColor[i])) then
begin
SetArrayLength(Result, GetArrayLength(Result)+1);
Result[GetArrayLength(Result)-1]:= SkillName[i];
break;
end;
end;
end;
{*******************************************************************************
function IsSkillFlashing(skill: string): boolean;
By: Shuttleu
Description: Returns true if the input skill is flashing
*******************************************************************************}
function IsSkillFlashing(skill: string): boolean;
var
SkillOffPut, SkillPoint : TPoint;
OriginalColor, i, xx, yy, SkillColor : Integer;
Scroll : Boolean;
begin
if GameTab(2) then
begin
case skill of
'attack', 'hitpoints','hp',
'mining', 'strength', 'agility',
'smithing', 'defence', 'herblore',
'fishing', 'range','ranged',
'thieving', 'cooking', 'prayer',
'crafting', 'firemaking', 'woodcutting',
'runecrafting', 'slayer', 'farming',
'construction', 'summoning': SkillOffPut:= Point(10, 10);
'magic': SkillOffPut:= Point(10, 9);
'fletching': SkillOffPut := Point(10, 8);
'hunting', 'hunter': SkillOffPut := Point(9, 10);
else begin
Writeln('Incorrect Skill');
exit;
end;
end;
case skill of
'attack': OriginalColor := 11053479;
'hitpoints','hp': OriginalColor := 143297;
'mining': OriginalColor := 7829622;
'strength': OriginalColor := 5669024;
'agility': OriginalColor := 3692653;
'smithing': OriginalColor := 3357758;
'defence': OriginalColor := 8882557;
'herblore': OriginalColor := 25088;
'fishing': OriginalColor := 12568251;
'range','ranged': OriginalColor := 607086;
'thieving': OriginalColor := 2827562;
'cooking': OriginalColor := 202813;
'prayer': OriginalColor := 10666673;
'crafting': OriginalColor := 603476;
'firemaking': OriginalColor := 3239099;
'magic': OriginalColor := 10619427;
'fletching': OriginalColor := 949280;
'woodcutting': OriginalColor := 949280;
'runecrafting': OriginalColor := 937437;
'slayer': OriginalColor := 11447468;
'farming': OriginalColor := 16732742;
'construction': OriginalColor := 2768209;
'hunting', 'hunter': OriginalColor := 3748925;
'summoning': OriginalColor := 15261406;
end;
case skill of
'construction', 'hunting', 'hunter', 'summoning': Scroll:= True;
else
Scroll:= False;
end;
if (not(Scroll)) and (not(GetColor(724, 246)=4873574)) then
begin
MMouse(719, 228, 5, 5);
GetMousePos(xx, yy);
HoldMouse(xx, yy, True);
Wait(300+Random(300));
ReleaseMouse(xx, yy, True);
end;
if Scroll and (GetColor(724, 246)=4873574) then
begin
MMouse(721, 440, 5, 5);
GetMousePos(xx, yy);
HoldMouse(xx, yy, True);
Wait(300+Random(300));
ReleaseMouse(xx, yy, True);
end;
SkillPoint:= SkillToCoords(True, skill);
SkillColor:= GetColor(SkillPoint.x - SkillOffPut.x, SkillPoint.y + SkillOffPut.y);
if (not(OriginalColor = SkillColor)) then Result:= True;
end;
end;
single skill
Successfully compiled (2345 ms)
SRL Compiled in 16 msec
0
True
Successfully executed
Successfully compiled (2306 ms)
SRL Compiled in 16 msec
0
True
Successfully executed
Successfully compiled (2427 ms)
SRL Compiled in 0 msec
0
True
Successfully executed
Successfully compiled (2302 ms)
SRL Compiled in 16 msec
0
True
Successfully executed
Successfully compiled (2431 ms)
SRL Compiled in 16 msec
0
True
Successfully executed
Successfully compiled (2324 ms)
SRL Compiled in 0 msec
0
True
Successfully executed
Successfully compiled (2327 ms)
SRL Compiled in 15 msec
0
True
Successfully executed
Successfully compiled (2354 ms)
SRL Compiled in 16 msec
0
True
Successfully executed
Successfully compiled (2310 ms)
SRL Compiled in 15 msec
0
True
Successfully executed
Successfully compiled (2286 ms)
SRL Compiled in 16 msec
0
True
Successfully executed
all skills
Successfully compiled (2409 ms)]
SRL Compiled in 0 msec
359
fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2538 ms)
SRL Compiled in 15 msec
312
fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2396 ms)
SRL Compiled in 15 msec
359
fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2401 ms)
SRL Compiled in 15 msec
390
fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2412 ms)
SRL Compiled in 16 msec
390fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2438 ms)
SRL Compiled in 16 msec
358
fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2785 ms)
SRL Compiled in 16 msec
343
fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2705 ms)
SRL Compiled in 16 msec
296
fishing
cooking
firemaking
woodcutting
construction
summoning
Successfully executed
Successfully compiled (2488 ms)
SRL Compiled in 31 msec
499
fishing
cooking
firemaking
woodcutting
Successfully executed
Successfully compiled (2417 ms)
SRL Compiled in 16 msec
499
fishing
cooking
firemaking
woodcutting
Successfully executed
Enjoy :D
Oh and credit to zasz for the idea :p
~shut