Page 1 of 1

character.connected versus character.ip (or character.client.ip)

Posted: Wed Aug 10, 2016 12:34 pm
by OWHorus
Hello,

another question to the state of a connection:

At this time we use character.ip to determine, if a user is still online. This was the first method, and we use it often.

At some time the new member character.connected was introduced - we stayed with character.ip, which works fine.

Now - what is better to - for example - end a loop when the player logs off?

Code: Select all

while (character.client.ip)
...
or

Code: Select all

while (character.connected)
...
What is the recommended method?

OWHorus

Re: character.connected versus character.ip (or character.client.ip)

Posted: Wed Aug 10, 2016 10:49 pm
by CWO
I'm sure if you've always used character.ip, it should work fine for you. Character.connected was specifically added to check to test if the client is still connected. It will be immediately set to 0 as soon as they disconnect even if they are lingering in the world for an amount of time after logging off (sets to 0 before logofftest is run). I'm not sure when ip unsets but it could be at the same time so they can both easily serve the same purpose.

Re: character.connected versus character.ip (or character.client.ip)

Posted: Thu Aug 11, 2016 1:16 pm
by Austin
CWO wrote:I'm not sure when ip unsets but it could be at the same time so they can both easily serve the same purpose.
ip unsets once the time returned from logofftest has expired