Wanted
2010-02-02 22:11:50
The other fixes that have been posted do not fully work.
Well Jagex affectively killed the color pattern that was used previously to do a simple GetPixel, but this will use the color of the borderline of any of the game tabs (if they exist) so it will return if the tab exists correctly even if you're banking/inrandom what not… and TimeTest shows 0ms (even when looping all 16 in a row) so it should be fast enough. The colors I used were ACA'd very accurately, you can test if you want ;)
I also had to change the LogOut tab color/cords…
Oh and the tabs visible when you are in randoms has changed… so Random.scar other various random files are going to need changing!
Edit: Benchmarking the new one and old one (10,000 x 16) shows, this one is 1/16th of a ms slower when massively looped.
Shouldn't be a big deal eh?
For anyone wanting the unified diff:
Well Jagex affectively killed the color pattern that was used previously to do a simple GetPixel, but this will use the color of the borderline of any of the game tabs (if they exist) so it will return if the tab exists correctly even if you're banking/inrandom what not… and TimeTest shows 0ms (even when looping all 16 in a row) so it should be fast enough. The colors I used were ACA'd very accurately, you can test if you want ;)
I also had to change the LogOut tab color/cords…
Oh and the tabs visible when you are in randoms has changed… so Random.scar other various random files are going to need changing!
Edit: Benchmarking the new one and old one (10,000 x 16) shows, this one is 1/16th of a ms slower when massively looped.
{.Include SRL\SRL.SCAR}
var
T, I, II: LongInt;
begin
SetUpSRL;
ActivateClient;
Wait(1000);
T := GetSystemTime;
for I := 1 to 10000 do
for II := 21 to 37 do
TabExists(II);
WriteLn(((GetSystemTime - T) * 1.0) / 160000.0);
end.0.1541 //new
Successfully executed
New client targeted
Successfully compiled (4379 ms)
SRL Compiled in 15 msec
0.09140625 //oldShouldn't be a big deal eh?
{*******************************************************************************
function TabExists(Tab: Integer): Boolean;
By: ZephyrsFury & IceFire908
Description: Returns True if the Tab exists.
*******************************************************************************}
function TabExists(Tab: Integer): Boolean;
var
TPA: TPointArray;
tP: TPoint;
begin
if (tab < 20) then
begin
SRL_Warn('TabExists', 'Tab ' + IntToStr(Tab) + ' is not using the new constants! Please upgrade your script.', warn_AllVersions);
Exit;
end;
if (not(InRange(Tab, Tab_Combat, Tab_LogOut))) then
begin
SRL_Warn('TabExists', 'Tab ' + IntToStr(Tab) + ' is not a valid tab number.', warn_AllVersions);
Exit;
end;
if (Tab = tab_LogOut) then
begin
Result := (GetColor(746, 0) = 65536);
Exit;
end;
tP := Point(((Tab - 21) mod 8 * 30) + 536, ((Tab - 21) div 8 * 298) + 187);
Result := FindColorsTolerance(TPA, 591881, tP.X - 12, tP.Y - 12, tP.X + 12, tP.Y + 12, 15);
end;For anyone wanting the unified diff:
--- C:/DOCUME~1/James/LOCALS~1/Temp/GameTab.sca-revBASE.svn001.tmp.scar Tue Feb 2 21:21:56 2010
+++ C:/Documents and Settings/James/My Documents/SCAR 3.23 Beta/Includes/SRL/SRL/core/GameTab.scar Tue Feb 2 21:21:44 2010
@@ -88,12 +88,13 @@
{*******************************************************************************
function TabExists(Tab: Integer): Boolean;
-By: ZephyrsFury
+By: ZephyrsFury & IceFire908
Description: Returns True if the Tab exists.
*******************************************************************************}
function TabExists(Tab: Integer): Boolean;
var
+ TPA: TPointArray;
tP: TPoint;
begin
@@ -111,12 +112,12 @@
if (Tab = tab_LogOut) then
begin
- Result := (GetColor(753, 6) = 6327197);
+ Result := (GetColor(746, 0) = 65536);
Exit;
end;
- tP := Point(536 + (Tab - 21) mod 8 * 30, 187 + (Tab - 21) div 8 * 298);
- Result := (GetColor(tP.X, tP.y) <> 4478564);
+ tP := Point(((Tab - 21) mod 8 * 30) + 536, ((Tab - 21) div 8 * 298) + 187);
+ Result := FindColorsTolerance(TPA, 591881, tP.X - 12, tP.Y - 12, tP.X + 12, tP.Y + 12, 15);
end;
{*******************************************************************************