SRL Archive - SRL Archives

Logout updated


Coh3n

2010-04-28 11:12:59

They added and "Exit to logout" button in the logout tab. I've tested this and it works.

[PHP]
function Logout: Boolean;
var
x, y, t: Integer;
begin
if (SRL_Procs[srl_OnLogOut] <> nil) then
SRL_Procs[srl_OnLogOut]();
if (not GameTab(tab_Logout)) then
Exit
else
if (FindText(x, y, 'ogin', UpChars, MIX1, MIY1, MIX2, MIY2)) then
begin
MouseBox(606, 416, 675, 421, 1);

t := GetSystemTime + 10000;
while (GetSystemTime < t) do
begin
Wait(RandomRange(50, 100));
if (not LoggedIn) then
begin
Result := True;
Exit;
end;
end;
end;
end;
[/PHP]

I was also thinking about adding a wait for the logout text. Not sure if there's a WaitText function or not. Also wasn't sure if it is really needed seeing as it's never been there before.

Coh3n

itSchRis917

2010-04-28 11:38:24

Thank you sir. Just noticed it was changed. :)

aran armath

2010-04-28 11:46:47

I don't believe there is a WaitText function. Maybe some kind of repeat until function. Another idea is to have is randomly log out to either the lobby then out or just logout.

Naum

2010-04-28 11:52:43

From: aran armath
I don't believe there is a WaitText function. Maybe some kind of repeat until function. Another idea is to have is randomly log out to either the lobby then out or just logout.


There is; in Timing.scar:
{*******************************************************************************
function WaitUptext(S: String; Time: Integer): Boolean;
By: Marpis edited by N1ke!
Description: Waits for an UpText, returns true if found
*******************************************************************************}

aran armath

2010-04-28 12:09:45

From: Naum
There is; in Timing.scar:
{*******************************************************************************
function WaitUptext(S: String; Time: Integer): Boolean;
By: Marpis edited by N1ke!
Description: Waits for an UpText, returns true if found
*******************************************************************************}


In order to find the UpText, your mouse must be hovering over the area where the logout button is. I guess you could use it, my only thought that we shouldn't is because we have to move the mouse onto where the logout button will appear. My first thought when I looked at it was that it seemed robotic to use it, just moving the mouse to where it should be and waiting for it. Second thoughts, might work, doesn't seem that robotic.

Coh3n

2010-04-28 13:52:07

From: Naum
There is; in Timing.scar:
{*******************************************************************************
function WaitUptext(S: String; Time: Integer): Boolean;
By: Marpis edited by N1ke!
Description: Waits for an UpText, returns true if found
*******************************************************************************}

Doesn't that only check in the upper left corner though?

I was talking about if there's lag from when you click the logout tab to when the text appears in the inventory.

NCDS

2010-04-28 14:12:47

From: Coh3n
Doesn't that only check in the upper left corner though?

I was talking about if there's lag from when you click the logout tab to when the text appears in the inventory.


Maybe try a WaitColor(); or something? I believe there is a WaitColorCount(); as well.

Nava2

2010-04-28 14:33:51

There is also a waitFunc last I checked.. :)

Naum

2010-04-28 15:02:45

From: Coh3n
Doesn't that only check in the upper left corner though?


Yes, yes it does.
If you want to check for it, just use a wait color count as NCDS mentioned.
@Nava AFAIK, last time I checked, WaitFunc doesn't allow you to pass parameters.

Coh3n

2010-04-28 15:16:26

From: Naum

@Nava AFAIK, last time I checked, WaitFunc doesn't allow you to pass parameters.

That's what I thought also, thus why I didn't use it.

Dgby714

2010-04-28 17:00:50

Whats wrong with?

{*******************************************************************************
function ExitToLobby: Boolean;
By: Starblaster100, Raymond, & IceFire908
Description: Exits to the Lobby (for breaks?)
*******************************************************************************}
function ExitToLobby: Boolean;
var
x, y, c, i: Integer;
begin
Result := LobbyScreen;
if Result = True then
Exit;
if (SRL_Procs[srl_OnExitToLobby] <> nil) then
SRL_Procs[srl_OnExitToLobby]();
if (not (GameTab(tab_LogOut))) then
Exit;
Wait(200 + Random(100));
while (LoggedIn) and (c < 10) do
begin
Inc(c);
if(FindText(x, y, 'obb', UpChars, MIX1, MIY1, MIX2, MIY2))then
begin
MouseBox(579, 367, 699, 386, 1);
for i := 0 to 10 do
begin
Wait(1000);
if (LobbyScreen) then
begin
Result := True;
Exit;
end;
end;
end else
if(FindText(x, y, 'lick', UpChars, MIX1, MIY1, MIX2, MIY2))then
begin
MouseBox(579, 367, 699, 386, 1);
for i := 0 to 10 do
begin
Wait(1000);
if not(LoggedIn) then
begin
Result := True;
Exit;
end;
end;
end
end;
end;

{*******************************************************************************
function LeaveLobby: Boolean;
By: IceFire908
Description: Logs you out from lobby screen.
*******************************************************************************}
function LeaveLobby: Boolean;
var
T: LongInt;
begin
T := GetSystemTime;
while ((not (Result)) and ((GetSystemTime - T) < 30000)) do
begin
MouseBox(678, 24, 699, 43, 1);
Wait(RandomRange(1000, 2000));
Result := (not (LobbyScreen));
end;
end;

{*******************************************************************************
function Logout: Boolean;
By: IceFire908
Description: Logs you all the way out from ingame.
*******************************************************************************}
function Logout: Boolean;
begin
if (SRL_Procs[srl_OnLogOut] <> nil) then
SRL_Procs[srl_OnLogOut]();
if (ExitToLobby) then
Result := LeaveLobby;
end;

Coh3n

2010-04-28 17:03:18

You can logout from the game now… You don't have to go through the Lobby.

Dgby714

2010-04-28 17:05:54

Kool haven't played rs in a long time….

Here:
{*******************************************************************************
function Logout: boolean;
By: Coh3n
Description: Logs Out.
*******************************************************************************}
function Logout: boolean;
var
x, y, t: integer;
begin
if (SRL_Procs[srl_OnLogOut] <> nil) then
SRL_Procs[srl_OnLogOut]();

if (not (GameTab(tab_Logout))) then
Exit;

if FindText(x, y, 'ogin', UpChars, MIX1, MIY1, MIX2, MIY2) then
begin
MouseBox(606, 416, 675, 421, 1);
t := GetSystemTime + 10000;
while (GetSystemTime < t) do
begin
Wait(RandomRange(50, 100));
if (not LoggedIn) then
begin
Result := True;
Exit;
end;
end;
end;
end;

Coh3n

2010-04-29 09:06:20

I don't see what you changed… other than taking out the else in which case I'd like to ask why?

Nava2

2010-04-29 09:17:35

Why not have a logout with a param for whether you want to go to the logout screen or the lobby?

Coh3n

2010-04-29 09:27:56

From: Nava2
Why not have a logout with a param for whether you want to go to the logout screen or the lobby?

You could, but that would require everyone to change every logout used in their scripts to make it work which isn't a big deal I guess. I think it's just easier to have separate functions, but that's just me.

Gu3st...

2010-04-29 11:59:20

{*******************************************************************************
function Logout: boolean;
By: Coh3n
Description: Logs Out.
*******************************************************************************}
function LogoutEx(Lobby : Boolean): boolean;
var
x, y, t: integer;
P : TPoint;
begin
if (SRL_Procs[srl_OnLogOut] <> nil) then
SRL_Procs[srl_OnLogOut]();

if Lobby then
P := Point(606, 374)
else
P := Point(606, 416);

if (not (GameTab(tab_Logout))) then
Exit
else
if FindText(x, y, 'ogin', UpChars, MIX1, MIY1, MIX2, MIY2) then
begin
MouseBox(P.X, P.Y, P.X+69, P.Y+5, 1);
t := GetSystemTime + 10000;
while (GetSystemTime < t) do
begin
Wait(RandomRange(50, 100));
if (not LoggedIn) then
begin
Result := True;
Exit;
end;
end;
end;
end;

function Logout;
begin
Result := LogoutEx(False);
end;

Coh3n

2010-04-29 12:05:52

Yeah… Or that. :p

Dgby714

2010-04-29 13:27:07

Or just use Logout; and ExitToLobby; lol….


From: Coh3n
I don't see what you changed… other than taking out the else in which case I'd like to ask why?


Theres no point in adding a else if it exit;'s when true….

Coh3n

2010-04-29 13:36:44

From: Dgby714
Theres no point in adding a else if it exit;'s when true….

I guess… it was just there before so I kept it (the ExitToLobby function).

Wanted

2010-04-29 19:33:46

Resolved, basically used Coh3ns but with Tara's unsigned support.

From: Nava2
Why not have a logout with a param for whether you want to go to the logout screen or the lobby?


Edit:
Originally, there was ExitToLobby which would log you out to the lobby and leave you there (for breaks/world switching ect..) , then Logout would use ExitToLobby in it along with a final logout button clicker, now the two are completely separate.

So now if they want to do like Logout(False) they can simply use ExitToLobby; or Logout;