LSL Protocol/DataBot
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
DataBot
DataBot is an attachment which allows you to specify information about your avatar, beyond what is normally available. This information can be read by other devices, allowing them to interact accordingly with you. An example would be, if you specify gender, a lucky chair or other game device could be programmed to give a prize appropriate to that gender.
All information in DataBot is under your control. You can set it to whatever you desire, or leave it unset. You can have multiple sets of data, for different avatars, different occasions or just different moods. It's entirely up to you. All information is contained on notecards. The initial, default card is simply named Default. If you create additional cards, you can name them whatever you wish.
To update the information in DataBot, detach it from yourself if you're wearing it, then drag it to the ground and Edit it. You can then modify the Default card, or add your own cards.
As DataBot continues to grow and develop, the types of information it can convey, and the values of those types, will grow. Currently, it has four types: Gender, Age, Language and Body Type. These types, and the values for them, are described below. All codes are case-insensitive.
Gender
This currently has four values:
- F - Female
- M - (Male)
- N - Neuter
- U - Unspecified
These codes can be combined, if desired; simply put a space between each code. For example: [:Gender:] F M
Age
This the age you consider your avatar to be. This is not necessarily the same as the age conveyed by the "Born" date in your profile; it can be whatever you wish. If you want your avatar to be 23, then put that. One nice thing about SL is that you never have to lie about your age -- whatever you put here is the truth!
Language
This is the language you prefer to communicate in. Valid codes are specified in ISO document 639-1. These codes can be found at http://www.wikipedia.org/wiki/List_of_ISO_639-1_codes Be sure to use the 639-1 codes, and not the 639-2 or 639-3.
Body type
This is the general body type of your avatar. Currently there are three values:
- HU - Human or humanoid
- FU - Furry
- OT - Other
As users provide input, the gender and body codes, in particular, will expand, and other data types may be added. Also bear in mind that these are just the codes that are supposed to be recognized by all DataBot-enabled devices; you can set them to literally any value you wish; it is up to the device to decide whether it can understand the value you've entered, and act accordingly. Additionally, custom data types can be added, and if your DataBot communicates with a device that asks for the information, it will send it. Bear in mind, however, that as the standard data types grow, they may come to include any custom types you've added.
You can also enter comments on your data cards, as notes to yourself. Any line beginning with an asterisk (*) will be ignored, as are blank lines.
By default, DataBot listens on chat channel 7 for commands from its owner. All DataBot commands begin with "dbt"
/7dbt use [Card Name]
This lets you switch to a different data set. The initial, default card is simply named Default. You can have as many different sets of data as you wish.
/7dbt listen [Channel Number]
Tells DataBot to start listening for commands on a different channel. The channel can be any number greater than 0, up to 2,147,483,647. Commands to switch to an invalid channel will be ignored.
/7dbt off
Turns DataBot off -- it will not respond to queries from other devices, but will still listen for owner commands.
/7dbt on
Turns DataBot on.
/7dbt help
Gives a card with this information.
DataBot Protocol
When a DataBot starts up, or when the user switches data cards, it will broadcast "dbt Hello World!" on channel -1, with llRegionSay().
A device wishing to communicate with a DataBot sends its queries on channel -1. The format is:
dbt [key] [command] [args]
All DataBot communications, to and from, begin with the literal string "dbt". This is followed by a key. For communications to the DataBot, this is the key of the DataBot's owner; in responses from the DataBot, this will be the key of the object the data is being sent to.
Currently there are two commands DataBot recognizes on a data channel:
query [item] channel [number]
Query
The query command requests data. The [item] argument can be the name of a specific item, such as Gender, or the word "all", which will return all data items the DataBot has. The response is formatted as
[item]:|:[value](:|:[item]:|:[value])
which can easily be parsed into a list. If a specific item is requested and is not found, the return will be [item]:|:NOTFOUND
Examples:
dbt 34ffd167-9c28-4fb0-8f19-8b86294abf95 query Age dbt 0ee61413-9879-1105-bb59-66be81455ad8 Age:|:23
dbt 34ffd167-9c28-4fb0-8f19-8b86294abf95 query all dbt 0ee61413-9879-1105-bb59-66be81455ad8 Gender:|:F:|:Age:|:23:|:Language:|:EN:|:Body:|:HU
dbt 34ffd167-9c28-4fb0-8f19-8b86294abf95 query YourNumberBaby dbt 0ee61413-9879-1105-bb59-66be81455ad8 YourNumberBaby:|:NOTFOUND
Bear in mind that item names are case-sensitive.
Channel
Initial communication is on channel -1, as described above. However, in a busy environment, a device may wish to negotiate a different channel, to avoid triggering the listen() event in every DataBot in the vicinity, simply for the sake of reducing lag. Negotiated channels must be less than -1. When the DataBot has switched, it will say
dbt [key] ready.
on the new channel. If there is no communication on a negotiated channel for 30 seconds, it will be closed. Additionally, all channels are closed if the user resets the DataBot or loads a different data card.
Example:
dbt 34ffd167-9c28-4fb0-8f19-8b86294abf95 channel -32768 dbt 0ee61413-9879-1105-bb59-66be81455ad8 ready.
The user commands for DataBot are listed in the main documentation. However, there is another command that will display all open data channels.
/7dbt channels
The dump consists of the key of the object which requested the channel, the handle returned by llListen(), the channel number, and the timestamp of the last communication on the channel.
Customizing
The data items and values described in the user documentation are, as it says, simply the standard ones that should be recognized by any DataBot-enabled device, but the system is not limited to these items or these values. If you are creating a device that will be used in a specialized environment, feel free to add items and/or values as desired. Bear in mind that, as DataBot grows, the standardized items and values may end up overriding your customization. What this means is, if you have an idea for something that makes sense as part of the standard, don't keep it to yourself!
Future
For the immediate future, I would like to flesh out (no pun intended) the body-type values and gender values, to ensure they meet the needs of most, if not all, residents. I'd also like to add any items which make sense to have as standard. I've also considered the possibility of allowing devices to store information in DataBot, much like browser cookies, but haven't decided if this would be practical, useful, etc.
Feedback on any of these issues and any others, is most welcome!
Siann Beck 02:14, 2 July 2010 (UTC)