SRL Archive - SRL Bugs

Gametab fix


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.

{.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 //old

Shouldn'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;

{*******************************************************************************

Timer

2010-02-02 22:14:51

Personally. I like this better then other fixes. <3

Gj.

Wanted

2010-02-02 22:20:29

From: Timer
Personally. I like this better then other fixes. <3

Gj.


Thanks, but I didn't make this to be better ;)… the other ones didn't fully work. So I made this one.

Wizzup?

2010-02-03 06:13:46

From: IceFire908
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.


Haha. That really doesn't matter… ;)
Looks fine to me.

Sir R. M8gic1an

2010-02-03 08:24:43

FindColorTolerance ranther than FindColorsTolerance might be faster.

~RM

Wanted

2010-02-03 10:31:12

From: Rasta Magician
FindColorTolerance ranther than FindColorsTolerance might be faster.

~RM


True, I was using this for debugging ATPA to make sure it worked correctly. It would be a good idea to switch back to normal FindColor… although it would probably only improve speed by 1/16th~1/32nd of a ms who ever commits this should do that.

Wizzup?

2010-02-03 10:36:57

When will we stop caring about speed?

Sex

2010-02-03 10:38:07

Yeah, speed doesn't matter when it comes to macroing really because a human doesn't even react as fast as this does :P.

Wanted

2010-02-03 10:44:17

Well, as I understand it. FindNormalRandoms checks gametab quite a bit, and some scripts loops FindNormalRandoms quite a lot. So over time… 16 game tabs, looping several times in FindNormalRandoms, looping in script random detection, looped over hours of usage. Could amount to something significant eventually… and switching FindColors to FindColor is easier and requires less CPU/memory/variable usage… so I agree with RM on this one.

Wizzup?

2010-02-03 10:52:42

If you really cared about speed you'd just make a system that will only update the gametab status every X milliseconds (500 or 1000 for example), IOW one that caches the states…

Sex

2010-02-03 10:58:32

Well IceFire, obviously you would want to do what RM said. I wasn't disagreeing with him nor was Wizzup I believe.
Since you weren't doing anything with the TPA and only using that to check if the color exist, it would be best to just use FindColorTolerance.

Wanted

2010-02-03 11:03:14

From: Sex
Well IceFire, obviously you would want to do what RM said. I wasn't disagreeing with him nor was Wizzup I believe.
Since you weren't doing anything with the TPA and only using that to check if the color exist, it would be best to just use FindColorTolerance.


Well I was using DeBugTPA at the time ;)

@Wizzup, true.

We need to start gathering all the new tabs that are visible during randoms… because TeleportRandoms is pretty broken.

Sex

2010-02-03 11:08:04

From: IceFire908
Well I was using DeBugTPA at the time ;)

@Wizzup, true.

We need to start gathering all the new tabs that are visible during randoms… because TeleportRandoms is pretty broken.

Yeah so you would need that while developing it. It was just left over because you forgot to change it back :P.
But for which random(s) do you need the tabs that are visible?

Wanted

2010-02-03 11:09:21

From: Sex
Yeah so you would need that while developing it. It was just left over because you forgot to change it back :P.
But for which random(s) do you need the tabs that are visible?


I have accounts in forester, mime, and mordaut (all have changed) ATM so I guess we just need screen shots/ reports of all the other randoms aswell :(

Sex

2010-02-03 11:10:28

I'll create a few accounts and try suicide botting and see if I get a random :p. What activities should I do to get a random?

Wanted

2010-02-03 11:11:42

From: Sex
I'll create a few accounts and try suicide botting and see if I get a random :p. What activities should I do to get a random?


Essence mining is probably one of the fastest ways… all accounts I auto on get a random in like 1-2 hours or less (per account)

Power miner essence anyone?

Sex

2010-02-03 11:16:28

Alright, after school I'll do Rune Mysteries on a few accounts and auto simultaneously with the POMS Essence Miner :D.

Wanted

2010-02-03 16:56:38

Mordaut has everything but magic tab visible -> Needs changing to Type (1) id? I think
I can confirm Freaky Forester still has all but magic.
I can confirm Mime still has all but magic

Naum

2010-02-03 17:12:48

From: IceFire908
Mordaut has everything but magic tab visible -> Needs changing to Type (1) id? I think
I can confirm Freaky Forester still has all but magic.
I can confirm Mime still has all but magic


Maze has all but Magic as does certer.

Wanted

2010-02-03 17:14:43

From: Naum
Maze has all but Magic as does certer.


Maze is already type 1 (14? tabs) and certer is still type two which is (6 tabs?)