SRL Archive - OSR Help

Failsafe login


Joe

2012-04-10 17:46:05

If my script were to log out and I want it to log back in, how do I do that?
I've tried
If (not loggedin) then 
loginplayer

but that spouts my name and password, how do I fix this?

Brotein

2012-04-10 18:50:59

This is how I do it
    if (not(LoggedIn)) then
if Players[CurrentPlayer].Active then
LoginPlayer;

Also get into the practice of following standards when you code, it makes it easier to read. Hope this helps.

Abu

2012-04-11 08:13:22

Correct me if I'm wrong Brotein but you indented three times on your second line instead of once = incorrect standards

I'm sure this would be the way to do it:
if not LoggedIn then //removed unnecessary brakets
if (Players[CurrentPlayer].Active = True) then // you didn't set Active to true...
LoginPlayer;

Kyle Undefined

2012-04-11 09:12:11

From: abu_jwka
Correct me if I'm wrong Brotein but you indented three times on your second line instead of once = incorrect standards

I'm sure this would be the way to do it:
if not LoggedIn then //removed unnecessary brakets
if (Players[CurrentPlayer].Active = True) then // you didn't set Active to true...
LoginPlayer;


Your Active Player code is sort of correct, but Brotein had it right in his. You're not setting it to True, you're checking if it's True. ;)

Abu

2012-04-11 09:26:56

From: Kyle Undefined
Your Active Player code is sort of correct, but Brotein had it right in his. You're not setting it to True, you're checking if it's True. ;)


I didn't mean setting it to true, I meant checking :duh:

But isn't that what you want to do? Check if the player is active before logging him in?

Kyle Undefined

2012-04-11 09:43:09

Yes, but he was checking if the player is Active.

if(Players[CurrentPlayer].Active = True)then
is the same as
if(Players[CurrentPlayer].Active)then

Personally, I like the second method better.

Joe

2012-04-11 16:22:59

Thanks for the help everyone, will be sure to add it into my latest script.

Brotein

2012-04-11 16:36:53

From: abu_jwka
Correct me if I'm wrong Brotein but you indented three times on your second line instead of once = incorrect standards


Whoops, I typed it out inside the simba brackets, couldn't tell how many tabs I put there.