SRL Archive - SRL Archives

LoggedIn


Wanted

2009-08-20 20:57:09

LoggedIn uses WHITE which is extremely common to be picked up falsely by lag or by SMART's annoying white screen… I think the color should be changed to the red part of the report button and have that wait in there…. this is causing mass havoc in certain scenarios. Waits/retrys for small temporary lag.

I made this

Edit:

Optimized
{*******************************************************************************
function LoggedIn: Boolean;
By: IceFire908.
Description: Detects if you're logged in and compensates for white screen lag,
general lag, and false detections.
*******************************************************************************}

function LoggedIn: Boolean;
var
C: LongInt;
I: Byte;
begin
for I := 1 to 10 do
begin
C := GetColor(412, 484);
Result := ((C = 2302834) or (C = 3356886));
if (Result) then
Exit;
Wait(200);
end;
end;

{*******************************************************************************
function LoggedIn: Boolean;
By: IceFire908.
Description: Detects if you're logged in and compensates for white screen lag,
general lag, and false detections.
*******************************************************************************}

function LoggedIn: Boolean;
var
P: TPoint;
I: Byte;
begin
for I := 1 to 10 do
begin
Result := FindColor(P.X, P.Y, 2302834, 404, 481, 514, 502);
if (not (Result)) then
Result := FindColor(P.X, P.Y, 3816406, 404, 481, 514, 502);
if (Result) then
Exit;
Wait(200);
end;
end;

NCDS

2009-08-20 21:04:56

Would't FindColorsTolerance work better?

It just doesn't seem like there are many static colors in RS anymore.

Also that would allow for the function to be shorter as then you wouldn't need to search for two different colors two separate times.

I could be wrong though.

Blumblebee

2009-08-20 21:12:05

the problem with tolerance is that it allows other colors to be picked up, colors that may be found on the screen when logged out.

Wanted

2009-08-20 21:17:10

The two colors I used are from the report button, and the report button if you have the mouse over it (making it lit), the window is the report button, and tolerance isn't needed.

Gu3st...

2009-08-20 21:19:33

Add a "Result := False" to the start and I'll be satisfied :)

Wanted

2009-08-20 22:13:10

From: Zyt3x
Add a "Result := False" to the start and I'll be satisfied :)


It's false by default, why do people insist on unessential things? :rolleyes:

ian.

2009-08-20 22:58:43

Multiplayer? :) It'll be true if you use it a second time.

Wanted

2009-08-20 23:00:32

From: ian.
Multiplayer? :) It'll be true if you use it a second time.


Result := Boolean;

No it won't

FindColor will return true or false.. and result is set to that.

ian.

2009-08-20 23:41:48

Ohhh.. Haha sorry I just woke up. :)

Gu3st...

2009-08-21 00:10:32

From: IceFire908
Result := Boolean;

No it won't

FindColor will return true or false.. and result is set to that.

Ow, sorry. Lmao I feel like an idiot now, ofc Result := False; isn't needed here… :rolleyes:

ZephyrsFury

2009-08-21 13:44:20

If you can search for colours in a smaller area (like 1 px x 1 px) it might be a good addition. Realise that LoggedIn is called in every function in every loop in every script so we must optimise it as much as we can.

Wanted

2009-08-21 17:42:05

From: ZephyrsFury
If you can search for colours in a smaller area (like 1 px x 1 px) it might be a good addition. Realise that LoggedIn is called in every function in every loop in every script so we must optimise it as much as we can.


DTM Editer -> Paste color -> Show matching pixels -> GetColor from the biggest lump of the color (upper left of the report button)

I'll tweak it when I can, I have to leave right now.

TRiLeZ

2009-08-22 03:54:58

I made my own function for LoggedIn.
I based it off yours so I put your name in it.

Goes in a loop, if not loggedin then it will check if your at the login screen. If your at the login screen then the result will be false and will exit out of function.
If its not loggedin and not on the login screen then it will wait 600 ms and try again to see if your loggedin or not. Total of 6 seconds before determating if your loggedin or not.
The new color i picked for determating if your loggedin is a color of the rim around the minimap.


{*******************************************************************************
function LoggedIn: Boolean;
By: TRiLeZ & IceFire908
Description: Detects if you're logged in and compensates for white screen lag,
general lag, and false detections.
*******************************************************************************}

function LoggedIn: Boolean;
var
I: Integer;
begin
for I:= 1 to 20 do
begin
Result := (GetColor(567, 135) = 9288161);
if (not Result) then
begin
if (GetColor(745, 93) = 3102893) then
begin
Result := False;
Exit;
end;
Wait(500);
end else
Exit;
end;
end;

Edit: Changed the total waiting time to 10 seconds before determating. Better for laggy computers.

ZephyrsFury

2009-08-22 06:36:39

From: TRiLeZ
I made my own function for LoggedIn.
I based it off yours so I put your name in it.

Goes in a loop, if not loggedin then it will check if your at the login screen. If your at the login screen then the result will be false and will exit out of function.
If its not loggedin and not on the login screen then it will wait 600 ms and try again to see if your loggedin or not. Total of 6 seconds before determating if your loggedin or not.
The new color i picked for determating if your loggedin is a color of the rim around the minimap.


{*******************************************************************************
function LoggedIn: Boolean;
By: TRiLeZ & IceFire908
Description: Detects if you're logged in and compensates for white screen lag,
general lag, and false detections.
*******************************************************************************}

function LoggedIn: Boolean;
var
I: Integer;
begin
for I:= 1 to 20 do
begin
Result := (GetColor(567, 135) = 9288161);
if (not Result) then
begin
if (GetColor(745, 93) = 3102893) then
begin
Result := False;
Exit;
end;
Wait(500);
end else
Exit;
end;
end;

Edit: Changed the total waiting time to 10 seconds before determating. Better for laggy computers.


Why must you check twice if the pixel is around the minimap? Wouldn't one colour check be enough?

TRiLeZ

2009-08-22 06:45:01

From: ZephyrsFury
Why must you check twice if the pixel is around the minimap? Wouldn't one colour check be enough?



Result := (GetColor(567, 135) = 9288161);
This finds the pixel around the minimap.


if (GetColor(745, 93) = 3102893) then
This finds the a pixel on the login screen.

Wanted

2009-08-30 04:35:24

Optimized
{*******************************************************************************
function LoggedIn: Boolean;
By: IceFire908.
Description: Detects if you're logged in and compensates for white screen lag,
general lag, and false detections.
*******************************************************************************}

function LoggedIn: Boolean;
var
C: LongInt;
I: Byte;
begin
for I := 1 to 10 do
begin
C := GetColor(412, 484);
Result := ((C = 2302834) or (C = 3356886));
if (Result) then
Exit;
Wait(200);
end;
end;