Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here
NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

You are here: Big Brother Bot ForumAdd-OnsPlugins Discussion (Moderator: MordyT)!mapstats is reset at scoreboard
Pages: [1]   Go Down
  Print  
Author Topic: !mapstats is reset at scoreboard  (Read 670 times) Bookmark and Share
Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« on: August 14, 2010, 07:46:11 AM »

Hi there,

A bug has been found in !mapstats with OA. When the match ends ("scoreboard showtime" Wink ), if you issue !mapstats, you will see that it already has been reset (except the Skill param which seems to be kept for the whole gaming session).

The problem is that generally, people tends to look at their stats at the end of the match, so the stats should be reset at the beginning of each maps, not the opposite.

Im taking a look into the code, but I admit that I have no clue where it could come from for the moment.
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #1 on: August 14, 2010, 08:09:48 AM »

Have a look the spawnstats plugin by Beber888, it will display those stats every time you die
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #2 on: August 14, 2010, 08:40:39 AM »

Um... Thank you for the link, I keep it aside, but I won't use it for now since the bot is already too much spamming (and Ive removed a lot of stuffs !).

Ok fixed, it was because the stats clearing would happen at match end, I edited it so it happens at match beginning (with round_start event).

Here is attached the stats plugin v1.2.4

PS : I tried to edit the _eventMap in the OA parser, but no luck, didn't work at all. Anyway, I think the stats plugin has to be edited directly, because I can't think of a game where the stats would be better cleared at the end of a match rather than at the beginning.

[attachment deleted by maintenance]
« Last Edit: August 14, 2010, 08:43:09 AM by grosbedo » Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #3 on: August 14, 2010, 08:42:09 AM »

oh, and spwanstat would sucks until the tell command work for OA
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #4 on: August 14, 2010, 08:43:40 AM »

oh, and spwanstat would sucks until the tell command work for OA

Ah indeed XD

PS : I edited my precedent post.
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #5 on: August 14, 2010, 10:18:40 AM »

thx, the dev team foresee no issue with that change. push to my github repo
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #6 on: August 14, 2010, 11:14:37 AM »

I've gone further with my edits of this plugin since it seems it has been abandonned with the new xlrstats plugin which, although being better, use more ressources and needs a database (and it's overkill when you don't want to provide continuous stats but just punctual stats for the current map, as I don't believe in longterm stats, it push the players to do everything to get better stats, like leaving or spawnkilling...).

Here is the new stats v1.3.0.

Changelog :

Code:
8/14/2010 - 1.3.0 GrosBedo
* Stats are now cleared at the beginning of next round (so they are still available at scoreboard)
* Moved the parameters to the xml config file (and added more)
* Added XP score and !topxp
* Setting to enable/disable score reset at round start

[attachment deleted by maintenance]
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #7 on: August 14, 2010, 12:30:31 PM »

Thanks, I pushed your new version to my github repo but I changed it a bit regarding the config file.

As you can see, we like to see a 'commands' section in the config which take care of commands level and command aliases.

Can you test this one ? http://github.com/courgette/big-brother-bot/commit/f25f1536820536a827331aa4fd7a7217905c3a4b
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #8 on: August 14, 2010, 01:08:11 PM »

Cool ! Cheesy
No sorry, I didn't know, I will take this habit in the future Smiley

Anyway, there seems to be a problem in the method used to grab the command :

Code:
100814 23:03:14 BOT    Starting Plugin stats
100814 23:03:14 INFO STDOUT Error: StatsPlugin instance has no attribute 'getCmd'
  File "C:\b3\b3\__init__.py", line 167, in start
    console.start()
  File "C:\b3\b3\parser.py", line 356, in start
    self.startPlugins()
  File "C:\b3\b3\parser.py", line 577, in startPlugins
    p.onStartup()
  File "C:\b3\b3\plugins\stats.py", line 100, in onStartup
    func = self.getCmd(cmd)

100814 23:03:14 INFO STDOUT

100814 23:03:14 INFO STDOUT 223
100814 23:03:14 INFO STDOUT

100814 23:03:14 BOT    Shutting down...

Give me a new version and I will gladly test Smiley

-------------------------

Another thing : the resetxp setting will not work anyway since it's linked to the values of resetscore. I will edit the file.
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #9 on: August 14, 2010, 01:22:33 PM »

can you try replacing
Code:
func = self.getCmd(cmd)
with
Code:
func = self._adminPlugin.getCmd(cmd)
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #10 on: August 14, 2010, 01:37:20 PM »

Works but this is weird, commands are not recognized.

Here is the log :

Code:
100814 23:33:34 BOT     Loading Plugin #6 stats [@conf\plugin_stats.xml]
100814 23:33:34 BOT     StatsPlugin: Loading config @conf\plugin_stats.xml for StatsPlugin
100814 23:33:34 DEBUG StatsPlugin: Using default value (0) for commands::mapstats
100814 23:33:34 DEBUG StatsPlugin: Using default value (0) for commands::testscore
100814 23:33:34 DEBUG StatsPlugin: Using default value (2) for commands::topstats
100814 23:33:34 DEBUG Register Event: Stop Process: StatsPlugin
100814 23:33:34 DEBUG Register Event: Program Exit: StatsPlugin
(...)
23:33:51 CONSOLE 299:41 say: UnnamedPlayer: !mapstats
100814 23:33:51 DEBUG XLR--------> line matched ^(?P<action>[a-z_]+):\s*(?P<data>.*)$
100814 23:33:51 DEBUG AdminPlugin: OnSay handle 5:"!mapstats"
100814 23:33:51 DEBUG AdminPlugin: Handle command !mapstats

/Edit :

In fact, your function returns None :
Code:
100815 00:02:31 BOT     Starting Plugin stats
100815 00:02:31 DEBUG StatsPlugin: Hihi: None
100815 00:02:31 DEBUG StatsPlugin: Hihi: None
100815 00:02:31 DEBUG StatsPlugin: Hihi: None
100815 00:02:31 DEBUG StatsPlugin: Hihi: None

None is the content of func...

/Edit2 : for the following debugging code :

Code: python
                self.debug('Hoho: %s' % cmd)
               func = self._adminPlugin.getCmd(cmd)
               self.debug('Hihi: %s' % func)

I get this result :

Code:
100815 00:05:32 BOT     Starting Plugin stats
100815 00:05:32 DEBUG StatsPlugin: Hoho: testscore
100815 00:05:32 DEBUG StatsPlugin: Hihi: None
100815 00:05:32 DEBUG StatsPlugin: Hoho: topxp
100815 00:05:32 DEBUG StatsPlugin: Hihi: None
100815 00:05:32 DEBUG StatsPlugin: Hoho: topstats
100815 00:05:32 DEBUG StatsPlugin: Hihi: None
100815 00:05:32 DEBUG StatsPlugin: Hoho: mapstats
100815 00:05:32 DEBUG StatsPlugin: Hihi: None
100815 00:05:32 DEBUG Register Event: Client Team Damage: StatsPlugin
100815 00:05:32 DEBUG Register Event: Client Team Kill: StatsPlugin
100815 00:05:32 DEBUG Register Event: Client Kill: StatsPlugin
100815 00:05:32 DEBUG Register Event: Client Damage: StatsPlugin
100815 00:05:32 DEBUG Register Event: Game Round Start: StatsPlugin
100815 00:05:32 BOT     Starting Plugin status
100815 00:05:32 BOT     Starting Plugin welcome
100815 00:05:32 DEBUG Register Event: Client Authenticated: WelcomePlugin

There seems to be a problem with the getCmd...

/Edit 3 : it seems that getCmd is only made to work with the adminPlugin (it uses 'self'). Either copy the function in the stats plugin, or find a way to import it... (I tried "from b3.plugin.admin import getCmd" but no luck...)
« Last Edit: August 14, 2010, 02:13:10 PM by grosbedo » Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #11 on: August 14, 2010, 02:14:53 PM »

sorry, I should have test more  Lips sealed

v1.3.1 from my repo has been tested.
Note the autmated tests at the bottom of the file. You can run them by running the plugins/stats.py file directely (no need to run b3)

To run the automated tests :
Code:
set PYTHONPATH=C:\Users\Courgette\workspace\b3\src\
cd C:\Users\Courgette\workspace\b3\src\b3\plugins
c:\Python26\python.exe stats.py
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #12 on: August 15, 2010, 01:00:14 PM »

Great news Cheesy Ive looked at the changes, unit testing is cool, Ive seen the fake.py but not any concrete use atm, now Ive seen one Smiley

Ive done a last update, to fix disabling resetxp (the xp was always reset if resetscore was enabled). Now it should be saved.

v1.3.2 attached.

[attachment deleted by maintenance]
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #13 on: August 15, 2010, 01:09:46 PM »

last version is push to github.

Note that the fake stuff is just a convenience for the developer. It is not proper unit testing as the validation still needs a human to read the log Smiley
Logged

Former Dev. (senate)
*****
OS: Linux
Type: Owner dedicated server(s)
Gameservers: OpenArena
Posts: 258
Offline Offline
« Reply #14 on: August 16, 2010, 01:27:44 AM »

Note that the fake stuff is just a convenience for the developer. It is not proper unit testing as the validation still needs a human to read the log Smiley

Ok I see, but nice nevertheless, it speeds up the process of testing Smiley
Logged
Tags: mapstats  stats plugin 
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal