SRL Archive - SRL Archives

GetSkillsFlahing / IsSkillFlashing (Faster than Nadeems)


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
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

ZaSz

2009-05-15 02:20:21

Nadeems gave credits for me for the idea :p

Nadeem

2009-05-15 02:23:23

lol, Shuttleu :P Up for a challenge eh? xP Now imma have to tweak up as promised!

btw, there is only one me ;) It should be Nadeem's !!


~NS

Shuttleu

2009-05-15 02:27:25

From: zasz
Nadeems gave credits for me for the idea :p


okie doke i have now
sorry i forgot
i just wanted to release it and show people that his was slow :p

~shut

ZaSz

2009-05-15 02:28:31

ty :p

Nadeem

2009-05-15 02:49:43

Bro you have now been beat! :) My tweaked function now goes through process of checking for all flashing functions within 172ms! Read my thread and use updated function, then tell me whats good :P Fastest time I got though was 101ms whilst looking for mining.



~NS

Shuttleu

2009-05-15 03:00:22

nope i havent
Successfully compiled (2430 ms)
SRL Compiled in 16 msec
2043
True
Successfully executed
Successfully compiled (2487 ms)
SRL Compiled in 15 msec
110
False
Successfully executed
Successfully compiled (2396 ms)
SRL Compiled in 0 msec
93
False
Successfully executed
Successfully compiled (2328 ms)
SRL Compiled in 15 msec
1623
True
Successfully executed
Successfully compiled (2366 ms)
SRL Compiled in 15 msec
1669
True
Successfully executed
Successfully compiled (2310 ms)
SRL Compiled in 15 msec
110
False
Successfully executed
Successfully compiled (2433 ms)
SRL Compiled in 16 msec
124
False
Successfully executed
Successfully compiled (2436 ms)
SRL Compiled in 16 msec
109
False
Successfully executed
Successfully compiled (2456 ms)
SRL Compiled in 16 msec
109
False
Successfully executed
Successfully compiled (2396 ms)
SRL Compiled in 0 msec
1638
True
Successfully executed

see when it does find it, it takes 1.6 seconds
and the majority of the time it doesnt even find it
atleast with mine it finds it perfectly each time
Successfully compiled (2523 ms)
SRL Compiled in 32 msec
202
True
Successfully executed
Successfully compiled (2374 ms)
SRL Compiled in 16 msec
218
True
Successfully executed
Successfully compiled (2391 ms)
SRL Compiled in 32 msec
202
True
Successfully executed
Successfully compiled (2529 ms)
SRL Compiled in 15 msec
219
True
Successfully executed
Successfully compiled (2694 ms)
SRL Compiled in 16 msec
203
True
Successfully executed
Successfully compiled (2331 ms)
SRL Compiled in 0 msec
203
True
Successfully executed
Successfully compiled (2506 ms)
SRL Compiled in 46 msec
203
True
Successfully executed
Successfully compiled (2428 ms)
SRL Compiled in 15 msec
203
True
Successfully executed
Successfully compiled (2430 ms)
SRL Compiled in 16 msec
203
True
Successfully executed
Successfully compiled (2387 ms)
SRL Compiled in 16 msec
203
True
Successfully executed

so i have not been beaten yet

~shut

Nadeem

2009-05-15 03:08:11

Hrmmm…. :/ kk ty! I'll check them all once agian!

Edit: Shuttlu, download the attachment script i've upped on my thread and then try it…

~NS

Shuttleu

2009-05-15 03:09:28

lol its like the battle of the includes XD

~shut

Nadeem

2009-05-15 03:15:54

lmao xP Its good for us, we'll learn to process data faster :P

EDIT: PWNED! :P I just beat you now! :D



~NS

Shuttleu

2009-05-15 19:42:35

made faster to compete with Nadeem

~shut

impiwimpi

2009-05-15 19:46:32

lol, if you do this with every function, srl would be uberfast ;)

Nadeem

2009-05-15 19:53:51

Give me new times, my function does not still take 2s… :P I'm at school right now so I can't really do anything.



~NS

Shuttleu

2009-05-15 20:02:40

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
:)

~shut

Nadeem

2009-05-15 22:45:58

ty :) You may have beat me in the singles currently, but I still pwn you in checking for all :P



~NS

Shuttleu

2009-05-15 23:19:52

From: Nadeem
ty :) You may have beat me in the singles currently, but I still pwn you in checking for all :P



~NS


thats because you dont scroll down to check the rest of the levels
mine may be about 100 ms slower but i do acctually check all the skills unlike you

~shut