You don't need frames to view this website. Flash communication server. Flash mx xml socket server.
Home
Main Menu
Home
- - - - - - -
What is Palabre ?
Features
News
FAQ
Forum
DEMO
- - - - - - -
Downloads !
Browse SVN
- - - - - - -
Search
Contact Us
- - - - - - -
Sourceforge Project Page
Python
Links
Palabre on Facebook






Actionscript for Multiplayer games
 
Download Palabre Flash Xml Socket Server DOWNLOAD Download Palabre Flash Xml Socket Server FORUM Download Palabre Flash Xml Socket Server FAQ Download Palabre Flash Xml Socket Server WHAT IS IT
 



Using Palabre ? Coming here for Support ? Please consider making an (even small) donation :)
Palabre Forum  


::post new topic::
seeing server variables in modules - 2008/03/26 00:05 I'm writing a simple (I hope) module to allow the user to query whether a specific room or users exists.

So far, I can send:

<exists nickName="nameToTest" />
or
<exists room="roomToTest" />


And get it to echo to the client:

<existst>What I Sent</exists>

But what I can't seem to grasp is how get the information I need to make the comparison. It looks like (for the name part, anyway) what I want to look at is:

allNickNames.values

But, I can't seem to access that from my module.




Code:

 from palabre import logger,logging class existsQueries:     def __init__(self,server):                  self.server server                  self.name "existsQueries"                  # Registering the EXISTS node         self.server.registerNode('exists',self.name)                  return               def doNode(self,nodeName,node,client):                  if nodeName == 'exists':             # Check to see if Nickname exists             # Did user send nickName?             if node["attrs"].has_key('nickName'):                 # Filter out user requesting room and nick info at the same time                 if node["attrs"].has_key('room'):                     logger.info("Cannot ask for nickName and Room in same request")                     return                 else:                     client.clientSendMessage(self.server.formatMessage('exists',[],node["attrs"].get('nickName')))                                                   # Check to see if a Room exists             # Did user send Room?             if node["attrs"].has_key('room'):                 client.clientSendMessage(self.server.formatMessage('exists',[],node["attrs"].get('room')))                              return

  reply | quote
Re:seeing server variables in modules - 2008/03/26 10:25 Hi,

You can access all the methods and properties of the server via :
Code:

  self.server.XXX



so for the nicknames just write:
Code:

  self.server.allNickNames




so your test might look like :

Code:

  if self.server.allNickNames.has_key(node["attrs"]["nickName"]):      client.clientSendMessage("blabla")



You can also access to a client object via :
self.server.allNickNames[ClientNickName]

And to a room object via :
self.server.allRooms[RoomName]


And then access to all the methods and properties of each object, for example :
Code:

  self.server.allNickNames[clientNickName].clientSendErrorMessage("Cannot ask for nickName and Room in same request") ...



or
Code:

  self.server.allRooms[RoomName].removeRoom() ..




Good luck :)
Célio Conort
Lonesome Palabre developper
  reply | quote
Re:seeing server variables in modules - 2008/03/26 16:22 Fantastic! That helps a lot.

Thanks!
  reply | quote
::post new topic::
SORRY, website is currently mostly broken due to software changes on the server.
Hope to fix it soon ...

In the meantime you may still download palabre or use the forum