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

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
OWHorus
Grandmaster Poster
Posts: 105
Joined: Sat Feb 04, 2006 1:24 pm
Location: Vienna, Austria

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

Post 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
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

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

Post 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.
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

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

Post 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
Post Reply