Else i have to modify the source code of palabre (roomPalabre.py)
I just want to add a new property : room.maxClients
And check this property when a client join a room
In order to force client to stay into a room.
karl
Hi!
I get a syntax error if I attempt +=, must be using an older version of python.
Code:
Python 2.3.5 (#1, Dec 7 2006, 14:50:51) [GCC 4.0.1 (Apple Computer, Inc. build 5363) (+4864187)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
chromecow
Looks great. There's one way to save a bit of typing:
Code:
roomID = roomID+1
can be replaced with
Code:
roomID += 1
Handy if you're doing a lot of incrementing.
-Sean
karl
Hi Sean,
Thanks for getting back to me.
The idea is to setup an overflow method for room connections. ie: When the room reaches a connection limit, create a new room.
My limit for example is 10. When the room has 10 clients, we spawn a new room and fill that until 10, then repeat.
My code so far:
Code:
# count existing rooms roomID = 0 for p in self.server.allRooms.values(): roomID = roomID+1
# if a room exists if roomID > 0: # count clients for p in self.server.allRooms.values():
if len(p.allNickNames) < MaxPerRoom: # force client to join room client.clientSendMessage('<join room="'+p.name+'" />')
else: # no rooms are created, make the first room client.clientSendMessage('<join room="r'+str(roomID)+'" />')
I'm relatively new to Python so please excuse my code structure. It will be refined as I learn.
chromecow
Hi Karl,
I think the variable you want to look at is: self.allParams.items()
Accessed from a module, I think it would look something like this: