User Guide
256 APPENDIX E
chat.onConnect = function()
{
chat.createSharedObject(“myGlobe”);
}
getSharedProperty(str objectName, str propertyName)
This method is a local check of the property value; it does not communicate with the server
chat.getSharedProperty(“myGlobe”,”isSpinning”);
requestSharedProperty(str objectName, str propertyName)
Notice that only a “request” method exists; there is no method to “create” a shared property. This prevents new
visitors from forcibly (accidentally) resetting the value of the shared property when they arrive. When this
method is called, it will trigger the onSharedPropertyChange(sName, sProp, sValue) callback for the sender only.
If the property already exists, the callback will return the property and current value. If it does not exist, the
property will be created, and the value will be an empty string upon return.
chat.requestSharedProperty(“myGlobe”,”isSpinning”);
setSharedProperty(str objectName, str propertyName, str Value)
Use this method to set the shared property value. This method must be called only after ‘objectName’ and
‘propertyName’ are known to exist.
chat.setSharedProperty(“myGlobe”,”isSpinning”, “true”);
Callbacks
fi lterInput(textInput)
When you type text into the local chat line and then press the Enter key, the string from the chat line is fi rst
passed through this method (if present) before being sent to the chat server. This method can be present in a
script attached to your Avatar, or be present in a script which is attached to a world you created. Used in the
latter manner, as the world designer you can fi lter out words for everyone who is visiting your world. It must
return true if the input has been captured, and false if the input should be passed on to the chat server.
chat.fi lterInput = function(msg)
{
if (msg.match(/^PING!/))
{
chat.print(‘PONG!’);
return true; //Don’t send the “PING!” on to the server.
}
else
{
return false; //Otherwise, let the message pass.
}
}










