Fileref:mod/glossary/sloodle metagloss.lsl
This LSL script controls the Sloodle MetaGloss object in-world, allowing it search glossaries on a Moodle site. When active, it listens for commands from any avatar on chat channel 0, where the command starts "/def " followed by a search term.
Contents |
Constants
- integer USER_CHAT_CHANNEL = the chat channel on which to listen to user chat commands
- integer SLOODLE_CHANNEL_OBJECT_DIALOG = the channel on which object configuration commands will be received
- integer SLOODLE_CHANNEL_AVATAR_SETTING = the channel which will be used for user dialog boxes
- float HTTP_TIMEOUT = the time to wait for HTTP response before giving up
- float INACTIVITY_TIMEOUT = how long the device should stay active after the most recent request
- string glossarylinker = relative address of the glossary linker script from the root of the Moodle site
Variables
- string sloodleserverroot = the URL to the root of the Moodle site
- string pwd = the Prim Password for the Moodle site
- integer sloodlecourseid = integer ID of the course which the chatroom is in
- integer sloodlemoduleid = course module instance ID of the glossary the user has selected (note: not really used... see selectedglossaryid instead)
- key httplistrequest = UUID of the HTTP request for a list of glossaries
- key httpdefrequest = UUID of the HTTP request for a glossary search
- list glossaryids = list of available glossary ID's
- list glossarynames = list of available glossary names (corresponds to glossaryids)
- integer selectedglossaryid = the ID of the currently selected glossary
- string selectedglossaryname = the name of the currently selected glossary
- string lookupconcept = the term currently being searched for
- key selectoruuid = the UUID of the avatar selecting a glossary
Functions
This script defines the following functions:
- sloodle_debug(string msg) = this standard function outputs debug text via link message
- sloodle_handle_command(string msg) = this customized standard function handles incoming configuration commands, and appropriately sets-up the object
- request_glossary_list_update() = requests an updated list of glossaries
- handle_glossary_list_response(string body) = handles the body of an HTTP response to a glossary list request
- show_glossary_meny(key uuid) = shows a list of currently available glossaries to the identified users, and starts listening for their response
- request_definition(string concept) = requests a glossary search for the specified concept
- handle_definition_response(string body) = handles the body of an HTTP response to a request for a glossary search
States
- Note: all states will reset the script on rez
default
- Destination states: active, update_glossary_list
This is the uninitialised state, in which the object is awaiting full configuration. On entering this state, all values are immediately reset. It listens for and handles configuration commands, until configuration is complete. If a module ID was specified, then it should go immediately to the active state (although the reliability of this behaviour is uncertain). Otherwise, it moves to the "update_glossary_list" state to fetch a list of available glossaries.
- Note: this state is functionally similar to the "sloodle_wait_for_configuration" library state
update_glossary_list
- Destination states: select_glossary
In this state, the script requests a list of available glossaries, and handles the response. When the list is complete, it moves to the "select_glossary" state.
select_glossary
- Destination states: update_glossary_list, active
In this state, the script allows a user to select a glossary from the list. If requested, it will present the menu immediately upon entry to the state. Otherwise, it will wait for a touch. It can then be requested to either refresh the list of glossaries, or move to the "active" state.
active
- Destination states: lookup, select_glossary, inactive
This is the main functional state of the script. When requested, it can lookup a term (state "lookup"), or change the selected glossary (state "select_glossary"). If inactive for a period of time, it will move to the "inactive" state.
inactive
- Destination states: active
This is effectively the 'power-saving' state of the script, in which it is not listening for commands. However, if it is touched, then it immediately switches back to the "active" state.
lookup
- Destination states: active
In this state, the script makes an HTTP request to lookup a specific term in the Moodle glossary, outputs the definition, and returns to the active state.
| This page is part of the SLOODLE documentation | |||
|---|---|---|---|
| Docs: Users | Administrators | Developers | |||
| Wiki Frontpage Sloodle.org | |||