SRL Archive - SRL Bugs

SetRun Doesn't Work Below 18%


LolL

2011-03-28 16:04:56

From: Narcle
I'm guessing there is a bug in the run function in SRL.


Whenever the run energy is over 18%16%, SetRun works perfectly (it will turn run on or off when you tell it to and it won't touch run if it's already at that setting). However, as it goes below 18% and you tell it to turn run on, even though it's already on, it clicks it which turns it off.

I've tried this with the client loaded in the browser and through SMART.


program TestSetRun;
{$i SRL/SRL.scar}

procedure RunTest;
var
i : Integer;
begin
for i := 0 to 10 do
begin
SetRun(True);
Sleep(RandomRange(500, 1000));
MMouse(MSCX, MSCY, 350, 250);
Sleep(RandomRange(500, 1000));
end;
end;

begin
SetupSRL;
ActivateClient;
Sleep(RandomRange(1000, 2000));
RunTest;
end.

Run this and see what I mean. If your run energy is above 18%16% it will turn it on once (if it's not already) and then not touch it for the rest of the script. If your run energy is 18%16% or below, it will turn it on, then off, then on, then off, etc.

i luffs yeww

2011-03-28 16:58:58

Can you run "Writeln(CountColorTolerance(3467501 , 720, 117, 723, 119, 80) > 1);" when run percent is <= 18 and when it's >= 18? Thanks.

LolL

2011-03-28 18:20:12

I did. Loaded the client through Firefox and checked all settings were correct (Safe Mode too). Whenever the energy reaches 16 or below (I checked and double-checked and triple-checked the value this time) the code prints False; anything above 16 prints True.

i luffs yeww

2011-03-28 18:29:21

Well that doesn't make any sense.. 0 xor 1 == 1 and 1 xor 1 == 0, last time I checked.. So it's a problem with the CountColorTolerance params. Can you print out what you get under 16 and above 16?

Shower.

Gu3st...

2011-03-28 19:16:01

Increase the tolerance / use CTS 2 / change the color

Wanted

2011-03-28 20:10:28

I've found it's more reliable to use the color of the numbers than the actual numbers.

i luffs yeww

2011-03-28 20:36:57

From: IceFire908
I've found it's more reliable to use the color of the numbers than the actual numbers.


SRL doesn't use the numbers. It's just a countcol. Colors changed probably.

Wanted

2011-03-28 20:53:21

From: i luffs yeww
SRL doesn't use the numbers. It's just a countcol. Colors changed probably.


I mean than that too honestly.

No one really needs to know the actual (OCR) or approx(Count) percentage of run left. I find it to be faster/reliable to put in some tolerance and check for red/orange/yellow/green.

i luffs yeww

2011-03-28 20:54:28

I'm very confus.. It doesn't check percentage left.

Wanted

2011-03-28 20:57:05

From: i luffs yeww
I'm very confus.. It doesn't check percentage left.


I'll explain in detail, give me a minute to review the code again. It's been a long time since anything has been touched with run.

LolL

2011-03-28 21:09:59

I'm thinking you meant "WriteLn(CountColorTolerance(3467501 , 720, 117, 723, 119, 80));"?

<= 16 returns 0
17-19 returns 4
>= 20 returns 5

i luffs yeww

2011-03-28 21:18:17

Ah. I don't get what color it could be searching for that it doesn't find it when it's < 16%..

Thanks btw. The color it should be looking for is the highlighted/glowing color on the ring of the circle. Could you maybe spend a few minutes finding a color that works < 16% and > 16%? :D

Wanted

2011-03-28 21:31:09

From: i luffs yeww
Ah. I don't get what color it could be searching for that it doesn't find it when it's < 16%..

Thanks btw. The color it should be looking for is the highlighted/glowing color on the ring of the circle. Could you maybe spend a few minutes finding a color that works < 16% and > 16%? :D


I just spent 10 minutes comparing pictures of Rest w/ run, Rest w/o run, Run, and Walk, zoomed way in.

Unfortunately, there is no difference between rest enabled run and rest disabled run. It is impossible using color to know if run is activated if it's empty and your resting. Unless you moved the mouse over it to see if it came up 'turn on' or 'turn off run', very impractical :(. Rest will have to be assumed if it's less than 16 (or whatever, no energy in the circle) so you can't make a color if there is no color… when it runs that low that is.

However, it is possible to know using color if the Boot (not resting) is lit up.

Simple added or clause.

WriteLn(SimilarColors(GetColor(725, 111), 6608616, 10)); //detects change in boot color

Patch

--- C:/Users/James/AppData/Local/Temp/gametab.sc-revBASE.svn002.tmp.scar	Mon Mar 28 20:42:09 2011
+++ C:/Users/James/Documents/SCAR Divi/Includes/SRL/SRL/core/gametab.scar Mon Mar 28 20:42:03 2011
@@ -1002,18 +1002,19 @@

{*******************************************************************************
function SetRun(Run: Boolean): Boolean;
-By: Wizzup? & EvilChicken!
+By: Wizzup?, EvilChicken!, & IceFire908
Description: Sets Run on or off.
*******************************************************************************}
+
function SetRun(Run: Boolean): Boolean;
-Begin
+begin
Result := false;
- if ((CountColorTolerance(3467501 , 720, 117, 723, 119, 80) > 1)) xor (Run) then
+ if (((CountColorTolerance(3467501, 720, 117, 723, 119, 80) > 1) or (SimilarColors(GetColor(725, 111), 6608616, 10))) xor (Run)) then
begin
Mouse(715, 95, 10, 10, True);
Result := True;
end;
-End;
+end;

{*******************************************************************************
function RunEnergy(Min: Integer): Boolean;
@@ -1559,4 +1560,4 @@
P := TPA[Random(Length(TPA))];
Mouse(P.X, P.Y, 0, 0, False);
Result := WaitOptionMulti(['Res', 'ese', 'set'], 1000);
-end;
+end;
\ No newline at end of file

I'll commit soon. Try testing.

i luffs yeww

2011-03-28 21:35:55

Lol. So many parentheses.

I'll trust you.

Wanted

2011-03-28 21:43:03

From: i luffs yeww
Lol. So many parentheses.

I'll trust you.


Ok deleted those other two posts. I had myself confused because of the < 1.

Here we go

--- C:/Users/James/AppData/Local/Temp/gametab.sc-revBASE.svn002.tmp.scar	Mon Mar 28 20:42:09 2011
+++ C:/Users/James/Documents/SCAR Divi/Includes/SRL/SRL/core/gametab.scar Mon Mar 28 20:42:03 2011
@@ -1002,18 +1002,19 @@

{*******************************************************************************
function SetRun(Run: Boolean): Boolean;
-By: Wizzup? & EvilChicken!
+By: Wizzup?, EvilChicken!, & IceFire908
Description: Sets Run on or off.
*******************************************************************************}
+
function SetRun(Run: Boolean): Boolean;
-Begin
+begin
Result := false;
- if ((CountColorTolerance(3467501 , 720, 117, 723, 119, 80) > 1)) xor (Run) then
+ if (((CountColorTolerance(3467501, 720, 117, 723, 119, 80) > 1) or (SimilarColors(GetColor(725, 111), 6608616, 10))) xor (Run)) then
begin
Mouse(715, 95, 10, 10, True);
Result := True;
end;
-End;
+end;

{*******************************************************************************
function RunEnergy(Min: Integer): Boolean;
@@ -1559,4 +1560,4 @@
P := TPA[Random(Length(TPA))];
Mouse(P.X, P.Y, 0, 0, False);
Result := WaitOptionMulti(['Res', 'ese', 'set'], 1000);
-end;
+end;
\ No newline at end of file

LolL

2011-03-28 21:52:38


program TestIsRunOn;

//Returns true if run is on and false otherwise.
function IsRunOn : Boolean;
begin
result := False;
if CountColorTolerance(6740460, 721, 108, 725, 112, 5) > 1 then
begin
result := True;
end;
end;

begin
WriteLn('Is run on? ' + BoolToStr(IsRunOn));
end.

Run it and see if it works (make sure boot is visible!!). Tolerance might have to be increase a bit if not. Worked for me after logging out and in 5 times. So all this does is checks if the middle of the boot is yellow (boot is ALWAYS yellow when run is on even when run is only like 1 or 2).

Btw, if this function works can someone commit it because I can imagine sometimes a scripter would just like to see if run is on or not without setting it (no such function exists AFAIK; SetRun sets it whether you want it to or not).

Another thing, can we change SetRun to a function that returns a boolean value: true if it changed the run setting and false if not. I know I'd find uses for it (e.g., waiting after calling SetRun waits regardless if the mouse actually moved or not–there's no SIMPLE way to tell).

Edit: WTF ICEFIRE. beat me you haxor.

Wanted

2011-03-28 21:54:42

From: LolL


Edit: WTF ICEFIRE. beat me you haxor.


You fixed it doing the same thing I did, but you forgot about people who set run while in rest mode ;)

LolL

2011-03-28 23:24:09

Looks good. I tested it while resting and not and I'm pretty sure it's all in order now. :D

Wanted

2011-03-28 23:25:48

From: LolL
Looks good. I tested it while resting and not and I'm pretty sure it's all in order now. :D


The only problem that could arise is if you are below 18%, in rest mode, and already have run activated. It will then think it's not already on and try and turn it on, thereby turning it off :(

No practical way to fix that using color, but I don't see it being a problem.