You are here: Big Brother Bot ForumCommunity DevelopersPlugin DevelopersRehash client info on B3 start?
Pages: [1]   Go Down
  Print  
Author Topic: Rehash client info on B3 start?  (Read 489 times) Bookmark and Share
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« on: October 15, 2011, 08:02:02 AM »

Hey guys! My plugin relies heavily on the accuracy of b3.team. If I have to restart B3 for maintenance, and there are players already on the server, B3 does not recognize the players on the server's teams. Is there any way I can rehash the connected players' teams on B3 start?

Thanks,
Leito
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: October 15, 2011, 09:33:45 AM »

Hi Leito,

try iourt41.py v1.11.3  that you can find on my github repo : https://github.com/courgette/big-brother-bot/raw/79fc3bc7374c4de71986f957835529efb2e80040/b3/parsers/iourt41.py
it has a better way of recoginizing teams when B3 starts and should help your plugin.

Please report any progress/issue with this new code.
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #2 on: October 16, 2011, 09:26:10 AM »

I've updated further the above code. See https://github.com/courgette/big-brother-bot/blob/4748b133217b87b6e2e64cb1a01564a50b40c45f/b3/parsers/iourt41.py for latest
Logged

Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« Reply #3 on: October 17, 2011, 08:19:47 AM »

Awesome thank you! It seems to be running well on my dev server. I'll move it over to the public server tomorrow and let you know how it works out. I've gotta finish this college application essay by tonight!  Cheesy

Unrelated: Also, should the --InitGame-- and --InitRound-- game log statements both trigger EVT_GAME_ROUND_START? It seems as if InitGame is better as a separate event, especially if you are using ROUND_START to cue rcon commands on the start of TeamSurvivor rounds. B3 sends rcon commands to clients loading the map (because InitGame triggers the ROUND_START event) and sometimes causes clients to be dropped with the 'A reliable command was cycled out' message. InitGame is the beginning of a new map. InitRound is the beginning of a Team Survivor round. I think they should be separated. Thoughts?
« Last Edit: October 17, 2011, 08:26:40 AM by Leito » Logged
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 244
Offline Offline
« Reply #4 on: October 17, 2011, 09:07:38 AM »

Also I'm not reporting any issues so far with the new parser.
Logged

Dev. Team
*
OS: Linux
Type: Home user
Gameservers: UrT
Posts: 198
Offline Offline
WWW
« Reply #5 on: October 18, 2011, 06:36:37 AM »

I don't have a server to test this with at the moment, but when I looked at the changelog for the parser I noticed you renamed the local variable map to map_name, but then immediately do an if map: rather then if map_name:

That's only an error if map is not a global, and I'm not overly familiar with the internals of B3 python stuff, but I think that if needs to be renamed?
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #6 on: October 18, 2011, 08:57:40 AM »

I don't have a server to test this with at the moment, but when I looked at the changelog for the parser I noticed you renamed the local variable map to map_name, but then immediately do an if map: rather then if map_name:
Good catch! thank you for doing a code review.
Latest parser is now : https://github.com/courgette/big-brother-bot/blob/e3f49617893ce9da38c93da9ac40cfcdc708cf80/b3/parsers/iourt41.py

That's only an error if map is not a global, and I'm not overly familiar with the internals of B3 python stuff, but I think that if needs to be renamed?
map is a python reserved name. If you open up a python shell and type :
Code: python
type(map)
, python answers with
Code:
<type 'builtin_function_or_method'>
. So using 'map' for a local variable is bad practice as it overrides the builtin map function in the current scope. In the parser it was not actually an issue as we were not using the map() function in that scope, but one should fix bad practice when it sees it Smiley
« Last Edit: October 18, 2011, 09:03:37 AM by Courgette » Logged

Dev. Team
*
OS: Linux
Type: Home user
Gameservers: UrT
Posts: 198
Offline Offline
WWW
« Reply #7 on: October 18, 2011, 09:39:20 AM »

Totally forgot about map being a built in, I know just enough python to get myself into trouble. Wink Fixing bad practice is never a bad thing! Glad I could be of assistance.
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #8 on: October 18, 2011, 10:04:31 AM »

Unrelated: Also, should the --InitGame-- and --InitRound-- game log statements both trigger EVT_GAME_ROUND_START? It seems as if InitGame is better as a separate event, especially if you are using ROUND_START to cue rcon commands on the start of TeamSurvivor rounds. B3 sends rcon commands to clients loading the map (because InitGame triggers the ROUND_START event) and sometimes causes clients to be dropped with the 'A reliable command was cycled out' message. InitGame is the beginning of a new map. InitRound is the beginning of a Team Survivor round. I think they should be separated. Thoughts?
I guess it was made this way to accommodate game mods having no round (FFA I guess) so in such game mods plugins relying on the EVT_GAME_ROUND_START event can still know the game started.
What about modifying the OnInitgame game event handler so that it triggers a EVT_GAME_ROUND_START event only for game mods having no rounds ? (and for that we need a exhaustive list of such game mods)
Logged

Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal