Server Side Python is an amazing thing with lots of potential for giving shard admins power over their own worlds. Unfortunately it is hampered by several issues. Included in these are that the client does not announce itself to the server python system when joining an age. The only way to enable these types of things would be to upgrade the clients KI or watch for when a client leaves an age and send a message to a predefined AdminKI. The problem with the AdminKI is that client must stay logged in. Which implies the potential necessity to write a program that emulates the client and has the ability to send messages to the server.
With all of that being said, here are all of the findings so far, do with them as you will -- share your scripts and any findings you may have, and enjoy! Oh and if someone could work on the final item in the above paragraphs issues, you'd be a God.. well at least a Saint. '
So, here's what we got:
Known age files loaded: BaronCityOffice.py city.py Cleft.py Garden.py Garrison.py Gira.py GreatZero.py Kadish.py Neighborhood.py Nexus.py Personal.py Teledahn.py
CODE:
from plasmaServer: ['doc', 'name', 'ptKey', 'ptPythonMsg']
from doc: ['class', 'delattr', 'doc', 'getattribute', 'hash', 'init', 'new', 'reduce', 'repr', 'setattr', 'str']
from name: ['add', 'class', 'contains', 'delattr', 'doc', 'eq', 'ge', 'getattribute', 'getitem', 'getslice', 'gt', 'hash', 'init', 'le', 'len', 'lt', 'mul', 'ne', 'new', 'reduce', 'repr', 'rmul', 'setattr', 'str', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'replace', 'rfind', 'rindex', 'rjust', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
from ptKey: ['class', 'delattr', 'dict', 'doc', 'eq', 'getattribute', 'hash', 'init', 'module', 'ne', 'new', 'reduce', 'repr', 'setattr', 'str', 'weakref']
from ptPythonMsg: ['class', 'delattr', 'dict', 'doc', 'getattribute', 'hash', 'init', 'instance_size', 'module', 'new', 'reduce', 'repr', 'setattr', 'str', 'weakref', 'getContents', 'getKey', 'getSenderID', 'send', 'setContents', 'setKey']
We also have the following predefined system called functions: CODE:
onInit() onShutdown() onUpdate(seconds) onClientLeft() onMsgReceived(message)
Where seconds is microtime seconds and message is of class ptPythonMessage()
So here is what we can do with ptPythonMessage and how to use it
CODE:
msg = ptPythonMsg() msg.setKey(self.key) msg.setContents(str(contents)) msg.send(self.ID)
That sends a message to a user as defined by their key and ID.. where Contents is the message.
Now Code: def onMsgReceived(msg):
- msgContents = msg.getContents() senderID = msg.getSenderID() key = msg.getKey()
Receives messages from the client where msg is the message, contains the senderID, its contents, and the users Key. you'll note that earlier I said msg is of ptPythonMessage() which it is.
Ok, how do we put this to use? Well, it requires a message from the client in order to be able to respond. The only age that has a responder built in on the client side is the Neighborhood. Now we can release a KI upgrade to make it all useful.. Maybe chip and Cyan would even include it on the data server (that'd be nice)..
The following code would make the client announce to the server when it joins an age (i think...) add to xKI.py: Code: def OnInit(self):
- hello = ptPythonMsg() hello.setKey(self.key) hello.setContents('Hello') hello.send()
as part of the OnInit function/class/method whatever you want to call it.
We could potentially also add def OnNetPythonMsg(self, msgContents): to the xKI.py also, but I'm not sure if that'd conflict with nb01RPSGame.py or not? Any ideas? Guess we'll just have to test it.
An example of how this might be useful is to send the "AdminKI" a message telling them that a user just left the AvatarCustomization age. The Admin setup could then check the user for "CleftSolved == yes" and set it yes if it isn't, plus set their KI on and send them to their Relto when they join. Now, if the client said hello when it joined each age, we could make it do it when the person first joined the AvatarCustomization age instead of when they are leaving. I'm not entirely sure what the setKey does either... or if it's even necessary... but you can't get the key unlesss the client actually sends a message... so I think we're screwed without a client update of some kind...
So there we go, that's all I know for sure. I suppose the admin could join that age and have AdminKI set so when they join AvatarCustomization it sends a message to the server so it knows who AdminKI is.. I think I'll work on setting up a working example of this.
Now, one last problem. Something that we need if we really want to make good use of this. We need a ghost client. Something that can fully simulate the client, without being the client, and send messages and receive messages from the server.. Also be able to call special functions/etc with the server for updating other avatars information. Someone probably needs to poke at how the VaultManager works in order to be able to build something like this. Or does someone already have something like this? We know Cyan did, but we aren't going to get a copy of that any time soon.
Ok, have at it boys, we got our toys, lets play!