Ticket #314 (closed task: fixed)

Opened 22 months ago

Last modified 14 months ago

Pubbot module: move idle players to ?go afk

Reported by: Maverick Owned by: fantus
Priority: normal Component: Bots - PubHub/PubBot
Version: Latest version from repository Severity: minor
Keywords: Cc:

Description

Task:
Create a pubbot module (pubbot-module only, an empty pubhub module will suffice) which moves idle players from a public arena to ?go afk arena.

For moving players you can use the *sendto command:
*sendto [IP],[Port],[Arena] (Sysop only)
Note: Using a incorrect syntax for this command will crash the zone. Because of this, testing this new module must be done on a local server.

A player is idle if he is a spectator and hasn't talked for a set amount of time. This amount of time must be settable in either the source code or the .cfg file.

For determining if a player is idle, I would recommend recording when a spectator has talked for the last time. Then every 5 minutes a TimerTask would run to check if the spectators haven't talked for x amount of minutes, after which the player will be moved by using the *sendto command.

Attachments

Change History

Changed 22 months ago by milosh

Sounds good to me. A few specifications I've learned by positive and negative experiences with *sendto:

  • Incorrect syntax of the command will not crash the zone as long as the command is private.
  • The command sent publicly(with or without correct syntax) will crash the zone.
  • If the command is sent to players who are currently downloading the arena it will crash the continuum client and boot them off.

So keep those things in consideration while you are creating this module. Perhaps players should be allowed extra idle time upon entry in case they are downloading a large map and have a slow connection. Make sure the bot does not move other bots(use the isBotExact() boolean condition from OperatorList) Make sure the bot never... ever... EVER uses this command in public chat(I personally have crashed a zone doing this _). It would be beneficial to send players a message(or possibly even a warning prior to the move) that notifies them of what is happening. If you're new to the team and are feeling intimidated by this project just ASK QUESTIONS!!!

Changed 22 months ago by hectic

  • owner changed from nobody to hectic
  • status changed from new to assigned

Changed 20 months ago by hectic

  • owner changed from hectic to nobody
  • status changed from assigned to new

Changed 16 months ago by fantus

  • owner changed from nobody to fantus
  • status changed from new to assigned

Changed 16 months ago by fantus

  • status changed from assigned to closed
  • resolution set to fixed

Done, see changeset #3196

Changed 16 months ago by Maverick

  • status changed from closed to reopened
  • resolution fixed deleted

I'm sorry fantus but I don't feel you've solved this task yet.

Using the IDLE: property of the *einfo output isn't the way to determine how long idle a player is. This has been proven by the mrarrogant bot (which uses the same way of checking for idlers) which doesn't work right; this property is reset too easily and is cheated by players.

You should have the pubbot track players by if they say anything in the chat and if they are in spec. If they haven't said anything for x minutes, they should be moved to ?go afk. This can be easily done by maintaining a list of players that are in spec and tracking their idle time. It should also be possible to see this list via a !command.

Furthermore, a small enhancement would be to alert players before moving them to ?go afk (like after 5 minutes) that if they stay in spec for too long, they will be moved to ?go afk. This is to accomodate newbies.

Changed 16 months ago by fantus

Oké, I didn't know about that.. thought *einfo was enough, but I will implement your suggestions. Giving them a early warning is a nicer solution anyway.

Changed 16 months ago by fantus

Done once more.

Added following commands:
!listidle -- list idle players
!move <player> -- move <player> to the afk arena
!help

(You might want to adjust WARNING_MESSAGE, WARNING_TIME, and MOVE_TIME.)

Changed 16 months ago by fantus

  • status changed from reopened to closed
  • resolution set to fixed

The module should cover everything that was summed.

Closing this ticket.

Changed 16 months ago by Maverick

  • status changed from closed to reopened
  • resolution fixed deleted

Nice work, fantus.

I skimmed over the code you committed. I noticed you're making an IdlePlayer object for each spectator in the arena. Unfortunately you've decided to create a TimerTask on each IdlePlayer that's counting minutes of idle time. I think this isn't quite efficient as it would mean the bot is maintaining up to 15 timertasks per public arena.

A better way of tracking the time of idle players is to record the current time in milliseconds. This can be done using either System.currentTimeMillis() or new java.util.Date().getTime() (the first is more efficient as no object creation is necessary). To get the idle time of a player is only a matter of comparing the current time to the recorded time.

It would be great if you can change that.
For the rest, good work :)

Changed 16 months ago by fantus

  • status changed from reopened to closed
  • resolution set to fixed

Done

Changed 16 months ago by Maverick

I wanted to add to this ticket that the module has been completed first by fantus. He made the changes I suggested and everything worked fine.

I tested the module offline and made a few very minor bugfixes (making the check task every minute and modifying the check method to only warn a player once instead of every minute once the warning time has passed).

Furthermore, it was necessary to differ in handling idle staffers as some staffers may be near-idle when spectating suspected cheaters, teamkillers or such. This new feature I added to the module.
Finally I improved the !listidle command so it's clear for every moderator when the module is going to act against a certain spectator. This helps people in understanding the bot.

The grunt of the work was already done by fantus though for which I thank him ;-)

Add/Change #314 (Pubbot module: move idle players to ?go afk)

Author


E-mail address and user name can be saved in the Preferences.


Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.