NPC player

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

kayosys
Posts: 9
Joined: 19 Nov 2019, 05:55

Re: NPC player

Postby kayosys » 28 Nov 2019, 10:29

Hi,
Thanks Lapo for guiding.As you mentioned above. I created bot, but after sometime it gets automatically disconnected .Do you have any solution.I want that bot should not be automatically disconnect.
User avatar
Lapo
Site Admin
Posts: 23025
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: NPC player

Postby Lapo » 28 Nov 2019, 10:41

Users are disconnected if they don't interact with the server for too long (configured in your zone via User Max Idle Timer)
One way to avoid that the bot doesn't get disconnected is to send a "ping" to the server every 30-60 seconds so that it remains active and doesn't get disconnected for being idle.

Usually we suggest to ping the server with an empty Extension request, such as this:

Code: Select all

sfsClient.send(new ExtensionRequest("ping", new SFSObject());

On the server side make sure to add a new request handler for the "ping" command, which you can leave empty, as all you need is the client request to reset the idle timer.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Stevenor and 47 guests