SRL Archive - OSR Help

LoginPlayer


Bixby Sayz

2011-04-10 22:16:39

How odd.

This works:
LoginPlayer;

As does this:
SomeBooleanVar := LoginPlayer;

But this does not. It returns immediately with a result of True.
Players[CurrentPlayer].Active := LoginPlayer;

footballjds

2011-04-10 22:47:25

From: Bixby Sayz
How odd.

This works:
LoginPlayer;

As does this:
SomeBooleanVar := LoginPlayer;

But this does not. It returns immediately with a result of True.
Players[CurrentPlayer].Active := LoginPlayer;


LoginPlayer;
Players[currentPlayer.Active := LoggedIn;

Bixby Sayz

2011-04-10 23:16:23

From: footballjds
LoginPlayer;
Players[currentPlayer.Active := LoggedIn;


Yes I realize that.

I just found it odd that the function completely failed to operate in that circumstance. No typing, no nothing.

footballjds

2011-04-10 23:30:45

read the login.scar
it will not login a player that is not active.
thus you must set the player as active AHEAD of time. then you can reset their activeness based on loginplayer

Bixby Sayz

2011-04-10 23:38:02

This player is active. Thus the first 2 attempts work.

On the third code example the player is again active. But it does not work.

This will not work:
Players[CurrentPlayer].Active := True;
Players[CurrentPlayer].Active := LoginPlayer;

Edit: This appears to be a "quirk" of Simba.

Just tried this with another routine where the call looks like this:
Players[CurrentPlayer].Active := SomeBooleanFunction

It appears that inside that routine changing the value of Result updates Active in real time. Result is passed back and placed in Active before the actual return call. Every time you change Result it again gets passed back at that moment.

So in the case of LoginPlayer, the first thing it does is Result := LoggedIn, which sets Result to False, which sets the player active to False, which causes it to not login. Ugh.

Don't think is this 100% proper Pascal handling of the return result but at least now I know what is going on.