Pages: [1] 2   Go Down
  Print  
Author Topic: Custom Playlist Plugin  (Read 968 times) Bookmark and Share
Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« on: September 23, 2011, 10:32:51 AM »

Hello all. I am currently working on a plugin for our squads server, which will allow us to setup a custom playlist, and have it rotate through to set the gametype/map. I am not a programmer but I am able to read and write code, I just do not do it on a daily basis, so it's a lot of researching to figure out how to do something. I have or I think I have majority of everything figured out, except sending the commands to the server.

I have read through the rotationmanager plugin, first off thanks tou xlr8or, Just a baka, and 82ndab-Bravo17, for this plugin as it helped me alot to figure out my plugin, and I have used some of the code within it. What I am interested in is the following code segment:

Code: python
def cod7maprotate(self):
       self.debug('COD7MAPROTATE: next map will be %s at %s' % (self._nextmap7[0], self._nextmap7[1]))

       # Set the playlist thus changing the gametype
       self.console.write('setadmindvar playlist %s' % self._cod7Playlists[self._slot_num][self._game_mode][self._nextmap7[0]])

       # Build a map exclusion rule then apply it. Will exclude every map except the next one.
       exclusion = copy.copy (self._cod7Maps)
       exclusion.remove (self._nextmap7[1])
       self.console.write ('setadmindvar playlist_excludeMap "%s"' % ' '.join(exclusion))

       # Keep playlist_excludeGametypeMap empty, I'm in charge here!
       # If next map is in this dvar, server will keep not changing maps until it recieves something that's not restricted
       self.console.write ('setadmindvar playlist_excludeGametypeMap ""')

I believe this is what I need to do to change the gametype and map for each round, but I am unsure. From this code I am interpreting it as:

Code: python
self.console.write('setadmindvar playlist %s' % self._cod7Playlists[self._slot_num][self._game_mode][self._nextmap7[0]])

This code will set the gametype for next map.

Code: python
self.console.write ('setadmindvar playlist_excludeMap "%s"' % ' '.join(exclusion))

Exclude all maps except for the map you want to play next round

Code: python
self.console.write ('setadmindvar playlist_excludeGametypeMap ""')

Keep this empty so if that the maps will change.

As I do not know how the server end of things work, could you please explain to me why I would have to do things this way, or is there a different way to change the gametype/map for each round?

The plugin I am working on is an event driving one, so there are no in game commands to run, I will have the gametype/map changed upon the b3.events.EVT_GAME_ROUND_START event. Once I have successfuly completed everything and tested to make sure it does work, i can then upload for others to use, but in the mean time any insight I can get is greatly appreciated. Thank you.
« Last Edit: September 23, 2011, 10:43:20 AM by Phyxious2 » Logged

Dev. Team
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: COD2,COD4,COD5
Posts: 1098
Offline Offline
« Reply #1 on: September 23, 2011, 11:20:58 AM »

Have you looked at the rotationmanager plugin?
Logged
Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« Reply #2 on: September 23, 2011, 11:47:22 AM »

Yes I have as I did mentioned it in my post. But from what I understand the rotationmanager plugin automatically selects gametype/maps. We want to setup our own gametype/map config, so we can play our favorites more then any other type.
Logged
Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« Reply #3 on: September 27, 2011, 06:34:23 AM »

I have everything working the way I want it to now, but I think I have a little bug in my code. I have my plugin fire off on the EVT_GAME_ROUND_START event. Once this event is fired. my plugin takes action, waits like 30 secs after the event, then sends the commands to the console to change the playlist and map.

It all seems to work fine, until we get to a search and destroy playlist, then it looks like my code is fired off, multiple time during the game. I am taking that the EVT_GAME_ROUND_START is fired off, during each round, so S&D can have what like 5 rounds?

What doesn't make since to me, is when playing other game types, dem, dom, ctf, sab, hq, everything seems to work fine, where dem, dom, and ctf, can have up to 3 rounds, but the code is only executed once.

So does the EVT_GAME_ROUND_START, get fired off multiple times during a map? Would there be a better event to use, that usually only gets fired once, during a map?
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #4 on: September 27, 2011, 08:37:24 AM »

EVT_GAME_ROUND_START is indeed fired every time a round starts. If your game mod is based on multiple rounds before changing map then it will be fired multiple times on the same map.

Why don't you try the EVT_GAME_MAP_CHANGE event which is fired once a new map is loaded ?
Logged

Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« Reply #5 on: September 27, 2011, 09:20:42 AM »

I will give that one a try and see if it fixes that issue.

Also, while I am at it, is there any tutorials or documentation on how to use a plugin against a table in mysql? Im not sure if database access methods are already created in B3, or if I will need to do everythign from scratch?
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: September 27, 2011, 09:29:31 AM »

no manual, but you can take the chatlogger plugin as an example.
Logged

Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« Reply #7 on: October 03, 2011, 05:45:08 AM »

OK, the EVT_GAME_MAP_CHANGE works alot better, but we had to upgrade our B3 first, as we were on an old version. I just need to clean the code up some but once that is done, how do I publish the plugin for others to use if they want to?
Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #8 on: October 03, 2011, 07:39:17 AM »

how do I publish the plugin for others to use if they want to?

Submit it to the downloads section. Once it is approved, you can create a topic (if it isn't done already). In fact, you could create the topic first I think if you want.
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« Reply #9 on: October 14, 2011, 06:34:28 AM »

How do I know if my plugin was approved? I uploaded it I think last week, but am waiting approval........
Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #10 on: October 17, 2011, 09:13:59 AM »

Go here:
http://forum.bigbrotherbot.net/downloads/?sa=myfiles;u=4109

At least for me it says Download Approved.

And see: http://forum.bigbrotherbot.net/downloads/?sa=view;down=171
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« Reply #11 on: October 18, 2011, 09:44:27 AM »

Yes it was approved a couple days after I posted that, thank you for your help.
Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2627
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #12 on: October 18, 2011, 10:42:41 AM »

Sorry, my bad. I was missing for the past few days, so I was catching up and didn't see the date.
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Jr. Member
**
OS: Linux
Type: Home user
Gameservers: CoD7
Posts: 10
Offline Offline
« Reply #13 on: October 19, 2011, 06:56:23 AM »

Not a problem, I do appreciate yours or anyones help when giving :-)
Logged
Newbie
*
OS: Windows
Type: Renting Server, no B3
Gameservers: CoD7
Posts: 3
Offline Offline
« Reply #14 on: October 26, 2011, 12:35:01 PM »

Thanks for this Phyxious2. I am running it successfully on my server.

You noted that one could set up multiple playlist but they weren't supported yet.

I have set up multiple plays as was wondering if there was a command or anything to switch the current playlist to one of the others I've setup.

My default playlist is simply "DM_ALL" which is FFA on all maps.

Then i set up a DM_SMALL which is FFA on all small sized maps. I di the same for TDM (TDM_ALL, TDM_SMALL, TDM_MEDIUM). And one big mix... "MIX_ALL" which is back and forth between TDM and FFA on all maps.)

The ability to do something like "!customplaylist DM_ALL" to switch them would be awesome.

Any plans on doing anything like that?
Logged

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


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal