Fileref:sloodle webintercom.lsl
This LSL script controls the Sloodle WebIntercom object in-world, allowing it to act as a link between in-world text-chat and a Moodle chatroom.
- Note to developers: this LSL script is in serious need of being cleaned-up! There are several unused variables, and much of the script does not follow the Sloodle conventions (such as variable-naming).
Contents |
Constants
- string MOODLE_NAME = the prefix applied to chat messages sent from in-world
- string linker_script = relative address of the WebIntercom linker script relative to the Moodle root
- list menu1 = list of menu buttons for asking if the user wants to start the WebIntercom
- list menu2 = list of menu buttons for asking if the user wants to stop the WebIntercom
- list menu_other = list of menu buttons for asking if the user wants their chat to be recorded
- integer CHANNEL = the chat channel ID used for dialog menus
Variables
General variables
- string sloodleserverroot = the URL to the root of the Moodle site
- string pwd = the Prim Password for the Moodle site
- integer sloodle_courseid = integer ID of the course which the chatroom is in
- string CHAT_ID = the integer ID (as a string) of the chatroom course module instance
- string SoundFile = the name of the sound file to play when a chatroom 'beep' is received
- list chatroomids = list of ID's available chatrooms for selection
- list chatroomnames = list of names of available chatroom for selection
- list unique_names = a list of names of avatars whose chat is being recorded
- list keys = list of keys of avatars whose chat is being recorded
- integer listenID = integer ID of the latest listen command
- integer part = (purpose unknown - used as a number in link messages)
- integer active = (unused)
- string text = the text of the current chat message
- string COL_START = (unused)
- string COL_END = (unused)
- string CODE_END = (unused)
- integer total_len = (unused)
- key httprequest = UUID of the latest HTTP request
- integer message_id = the database ID number of the chat message most recently received from the chatroom
SLurl maker variables (used to generate a SLurl in place of any "/slurl" chat message)
- vector Where = exact position within the sim
- string Name = name of the sim
- string SLURL = the text of the final SLURL
- integer X = rounded-down X-component of the SLURL
- integer Y = rounded-down Y-component of the SLURL
- integer Z = rounded-down Z-component of the SLURL
- string RevisedMessage = (unused)
- integer location = (unused)
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
- sloodle_init() = checks if the script has all necessary configuration information, and begins waiting for configuration if not
States
default
- Destination states: sloodle_wait_for_configuration, select_chatroom, logging
This state first checks to see if the object is configured. If not, then it moves immediately to the "sloodle_wait_for_configuration" state. If it is configured, then it waits for an agent to touch it. On touch, if a chatroom has not yet been selected, then it moves to the "select_chatroom" state. Otherwise, it uses a dialog to ask if the user wants to start recording. If the response is affirmative, it moves to the logging state.
- Note: currently, most interactions can only be done by the owner
logging
- Destination states: default
This is the main operational state of the device. If rezzed in this state, it automatically reverts to the default state. It will listen for chat messages in-world and send them to Moodle, and retrieve chat messages from Moodle and say them in-world. If a user touches the device, it asks if they want to be recorded. If so, it adds them to its list. If the owner touches the device, they are asked if they want to stop recording. If so, it goes back to the default state.
select_chatroom
- Destination states: sloodle_wait_for_configuration, default
This state is used to retrieve a list of chatrooms available in the course, and to present that list to the owner. When the owner selects a chatroom, the script goes back to the default state. However, if the script is not fully configured upon entering this state, it automatically goes to the "sloodle_wait_for_configuration" state.
sloodle_wait_for_configuration
- Destination states: default
When in this standard Sloodle state, the script is waiting for link messages containing configuration commands. They are immediately relayed to the sloodle_handle_command function for processing. Link messages should come from other scripts, such as the sloodle_setup_notecard or sloodle_slave_object scripts.
| This page is part of the SLOODLE documentation | |||
|---|---|---|---|
| Docs: Users | Administrators | Developers | |||
| Wiki Frontpage Sloodle.org | |||