SRL Archive - Research & Development Lounge

Lag Handling


mormonman

2009-04-14 20:59:11

Well, I don't know what is wrong with my internet, but it has lags spikes all the time. I am getting a new router, but who knows if it will work?… I whipped this up to handle those lags that bring up the Welcome Screen.

function findscreen : boolean;
var time : longint;
begin
result:= (GetColor(207, 409) = 238301);
if not result then
begin
marktime(time);
while not (loggedin or result) do
begin
if (timefrommark(time) > 30000) then break;
wait(500);
end;
end;
end;

Use:

if not logged in then//login check whenever you use it...
if not findscreen then
begin
logout;
nextplayer(false);
end else
begin//Click Here to Continue
wait(1000 + random(3000));
mousebox(249, 419, 521, 445, 1);
marktime(s);
while (timefrommark(s) < 30000) and (not(loggedin)) do
wait(1000 + random(1000));
end;

Questions, Comments, Criticism?

Method

2009-04-15 06:18:32

If you're going to check Result in that if statement, you need to update it inside that loop. Right now it will always wait for 30 seconds or to be logged out, not for the color to be updated at (207, 409).

mormonman

2009-04-15 06:50:45

It seems to work for me… I have tested it pretty extensively for the past week.

Method

2009-04-15 07:25:39

It may work because LoggedIn might return false, which will end the loop, but Result's value will never change. You can test that out by removing the LoggedIn segment from the if statement.

Da 0wner

2009-04-17 11:28:54

function findscreen : boolean;
var
time : longint;
begin
result := (GetColor(207, 409) = 238301);
if not result then
begin
marktime(time);
while not (loggedin or result) do
begin
result := (GetColor(207, 409) = 238301);
if (timefrommark(time) > 30000) then break;
wait(500);
end;
end;
end;
?

momosimo

2009-04-24 17:12:13

How would I go about putting this into the script, though? (Sorry for the noob question, just started scripting in SCAR)

mormonman

2009-04-25 01:24:21

Find places in the script where it sets a player false for being logged out, and add the example.

Edit: This could be kind of implemented in SRL. Just add a findscreen check to LoggedIn, but have it checked for loggedin colors first, and if it find those then exit else check for screen and click to continue.