SRL Archive - OSR Help

Problem with LoginPlayerToLob


loragnor

2013-06-18 12:44:45

Hello.

I am trying to implement a bit of code to ensure the user has the optimal graphics settings for autoing. To do this, I have put in the following bit of code:


procedure SetupScript;
begin
// Set up the script and begin writing to the debug window
DefineVars;
SetupSRL;

// Set up and declare the player
DeclarePlayers;

// Login to the lobby screen and ensure the graphics are set as we want them
LoginPlayerToLob;
if (not LobbyScreen) then
begin
Writeln('Failed to login to the lobby screen. Please try again.');
Exit;
end
else
begin
Writeln('Setting your graphics properties to autoing optimal');
SetAutoingDefaults;
end;
end;

The difficulty occurs when the client is set to High resolution graphics. In that mode, there is a failure in the RSReady function of SRL/core/login.simba. It is not able to find the correct color to tell it that the client is done loading:


function RSReady: Boolean;
var
x, y: Integer;
begin
Result := (LoggedIn) or (LobbyScreen);
if (not Result) then
begin
ImageResetClientArea;
Result := (GetColor(745, 17) = 16645629) or FoundBar; // X button in top right && Navigation Bar.
SRL_ResetNavBar;
end;
if (GetColor(755, 43) = 16645629) then // X button on resizeable client
begin
WriteLn('You are using the "Resizeable" screen option in RS.');
WriteLn('Changing to "Fixed" screen option.');
Mouse(735, 44, 2, 2, mouse_Left);
Wait(600 + Random(800));
if FindBitMapToleranceIn(SRL_OPTIONS_BITMAP, x, y, 130, 40, 640, 265, 5) then
begin
Mouse(200, 270, 5, 5, mouse_Left); //Fixed button
Wait(1200 + Random(1200)); //Wait while the screen changes
Mouse(621, 71, 3, 3, mouse_Left); //Close the Options interface
Wait(600 + Random(240));
end
else
begin
WriteLn('Unable to find Options Screen.');
WriteLn('Please manually change to "Fixed" screeb size');
TerminateScript;
end;
end;
if (FindBitMapToleranceIn(SRL_OPTIONS_BITMAP, x, y, 130, 40, 640, 265, 5)) then
begin
Writeln('Failed to close Options Interface. Please report on Villavu Forum');
TerminateScript; //Failsafe if we fail to close the Interface for some reason
end;
end;

The problem seems to be in this block of RSReady:


if (not Result) then
begin
ImageResetClientArea;
Result := (GetColor(745, 17) = 16645629) or FoundBar; // X button in top right && Navigation Bar.
SRL_ResetNavBar;
end;

RSReady is called from this block in LoginPlayerToLob:


{Wait for the client to finish loading.}

T := GetSystemTime;
repeat
if (RSReady) then
Break;
if ((GetSystemTime - T) > 180000) then
begin
WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
TerminateScript;
end;
Wait(RandomRange(1000, 2000));
until (False);
WriteLn('Welcome to Runescape.');

The color found with GetColor in RSReady is 197379 instead of 16645629. Eventually, LoginPlayerToLob hits the 3 minute mark and it terminates.

Any help here would be appreciated. If I have to have it set to low graphics so that I can determine if the client is loaded, then my efforts here are already partially negated.

On another note, can someone please tell me how this repeat..until block in LoginPlayerToLob is evaluated? How is 'False' validated?

Thanks in advance.

rj

2013-06-18 12:56:26

Why go through all the trouble, the user should have the correct graphical settings

loragnor

2013-06-18 13:02:58

It is my first script, so I guess I'm going a little 'Rube Goldberg' on it. ;)

I want to try out some of the optional stuff to see how it works and ask questions when I can't figure it out.

loragnor

2013-06-18 18:28:31

After some more poking, it seems that this occurs when the graphics are set to either High or Med with a resizable screen selected. If it is set to Low or Min with a resizable screen, the correct color is detected and a fixed screen is selected by the script. If the graphics are set to High or Med with a fixed screen, the correct color is detected.

t4q

2013-06-20 05:59:18

Use only lowest details and fixed screen

loragnor

2013-06-20 20:12:49

From: t4q
Use only lowest details and fixed screen


Yeah, I figured that out. But I see many posts in several of the forums about "Why won't this script detect this" or "Why can't I walk over here" or some other thing and the answer is "Use the lowest settings and a fixed screen." I want to be able to detect that and either change the settings with the script or pause the script and tell the user they need to make the change. Is the author of login.simba still active in the community?

t4q

2013-06-21 03:47:48

From: loragnor
Yeah, I figured that out. But I see many posts in several of the forums about "Why won't this script detect this" or "Why can't I walk over here" or some other thing and the answer is "Use the lowest settings and a fixed screen." I want to be able to detect that and either change the settings with the script or pause the script and tell the user they need to make the change. Is the author of login.simba still active in the community?

login.simba is working fine, what do you need to change there?

Element17

2013-06-21 10:33:13

What you are trying to do I believe has already been suggested and done. I believe someone, I wanna say @DannyRS ??, has made a script that will set all the graphics correctly for you. I would search to find it. Good luck.