Although the ScriptHook service was intended for use in automated testing of the ThereClient, it can be used by other applications in many ways. A ScriptHook service request looks like this:
http://localhost:9999/ScriptHook/operation?Path=path
This service allows you to manipulate a tree of nodes by specifying the node's path and an operation to perform. Paths are similar to Unix file names in that they have multiple components separated by "/" characters, and the root of the tree is referred to as a path containing a single "/" character.
Each node has three elements:
Wait operation on such a node, it will never terminate.
Container, Value or Method. Value nodes and method nodes are the leaves of the tree, while container nodes make up the body of the tree.
The operation used for the service can be one of the following:
Browse can be used to get an HTML view of the node.
Get provides an XML view of the node.
Wait (with an additional &Version=ver parameter) allows you to perform a Get but will not return until the version of the node is different from the provided ver parameter.
Invoke (with an additional &Args=args parameter) allows a method node to be invoked.
Set (with an additional &Value=v parameter) allows a value node to be set.
If you perform a Get or Wait operation on a value node, you will see something like this:
http://localhost:9999/ScriptHook/Get?Path=/thobs/196772622/edprops/forcefield/value
<Answer>
<Result>1</Result>
<Node>
<Version>1</Version>
<Type>Value</Type>
<Value>0</Value>
</Node>
</Answer>
If you perform a Get or Wait operation on a container node, you will see something like this:
http://localhost:9999/ScriptHook/Get?Path=/thobs/196772622
<Answer>
<Result>1</Result>
<Node>
<Version>4</Version>
<Type>Container</Type>
<Children>
<Child>
<Name>edprops</Name>
<Type>Container</Type>
</Child>
<Child>
<Name>state</Name>
<Type>Value</Type>
</Child>
<Child>
<Name>presence0</Name>
<Type>Container</Type>
</Child>
<Child>
<Name>clide</Name>
<Type>Value</Type>
</Child>
</Children>
</Node>
</Answer>
You can see from this example that the children of a container node may have a mixture of node types.
An attempt to access a non-existent node will result in something like the following:
http://localhost:9999/ScriptHook/Get?Path=/thobs/196772622/edprops/forcefield/valxx <Answer> <Result>0</Result> <ErrorCode>4400001</ErrorCode> <ErrorDetails>No node exists at path '/thobs/196772622/edprops/forcefield/valxx'</ErrorDetails> </Answer>
The root of the ScriptHook hierarchy is the path "/", which is a container node providing the following main branches:
/acc allows you to make your avatar speak text, or perform an emote.
/client gives access to system messages and GUI windows. In addition, you can simulate mouse button clicks and key presses.
/mainMenu provides access to the main ThereClient menu system. It is only present when the main menu is on the screen, so cannot be used while in ActionMode?.
/pilotPobs presents access to different classes of pob owned by the avatar.
/thobs contains a sub-tree for the thob associated with each visible dob.
/acc ScriptHooks
The /acc ScriptHook sub-tree provides access to Avatar Centric Chat through a single method /acc/addChatText. You can invoke this with additional arguments to have your avatar "speak" the text. This functionality includes the ability to perform emotes. For example, performing a GET on the following URL makes your avatar jump for joy:
http://localhost:9999/ScriptHook/Invoke?Path=/acc/addChatText&Args=text%3D'''yay'
Note that the nested "=" character in the Args argument is encoded as %3D to prevent that part of the URL being parsed incorrectly. Similarly, if you want to put a space character in the text, you should encode it as either a "+" or a "%20". You can include a newline character (like hitting the carriage return key) by including one encoded as "%0A".
/client ScriptHooks/mainMenu ScriptHooks/pilotPobs ScriptHooks/thobs ScriptHooks