Fileref:sloodle object selector.lsl

From SLIS Second Life Wiki
Jump to: navigation, search

Folder.gif (parent)

This LSL script provides the functionality for the Sloodle Object Selector, which provides an in-world interface to the object distribution tools.


Contents

Constants

  • integer SLOODLE_OBJECT_DIALOG_CHANNEL = channel used for inter-script communication in-world (see Sloodle channels)
  • integer SLOODLE_CHANNEL_AVATAR_SETTING = channel used for avatar dialogs (see Sloodle channels)
  • integer SLOODLE_CHANNEL_AVATAR_IGNORE = channel used for avatar dialogs which are ignored (see Sloodle channels
  • float TIMEOUT_HTTP = how long to wait for HTTP responses (in seconds)
  • float TIMEOUT_USER_DIALOG = how to wait for a user to respond to a dialog box (in seconds)
  • string linkerscript = address of the object distribution linker script, relative to the server root


Variables

  • string sloodleserverroot = WWW root of the Moodle installation
  • string sloodlepwd = Prim Password of the Moodle site
  • key ch = the UUID of the remote data channel opened by the distributor
  • key currentuseruuid = UUID of the avatar currently using the object
  • string currentusername = name of the avatar currently using the object
  • key httpqueryrequest = UUID of the HTTP request querying for an object list
  • key httpsendobjectrequest = UUID of the HTTP request for an object to be sent
  • list availableobjects = contains a list of objects available for distribution
  • integer selectedobjectnum = identifies which object in list 'availableobjects' has been selected


Functions

  • sloodle_debug(string msg) = this standard Sloodle function outputs debug information
  • sloodle_handle_command(string str) = this standard Sloodle function handles a Sloodle configuration command
  • handle_query_response(string body) = handles the body of an HTTP response to a query of available objects
  • show_object_menu() = shows a menu of available objects to the current user
  • handle_send_response(string body) = handles the body of an HTTP response to a request for an object to be sent


States

default

Destination states: ready
In this state, the script is uninitialised, and waiting for Sloodle configuration commands via link message. It will automatically move on to the 'ready' state when all data has arrived.

ready

Destination states: getobjects
In this state, the object is ready for user interaction. When touched, it will store the user's UUID, and move to the 'getobjects' state.

getobjects

Destination states: ready, selectobject
In this state, the script queries Moodle for a list of available distribution objects. If the HTTP request times-out, it returns to the 'ready' state. Otherwise, it moves on to the 'selectobject' state.

selectobject

Destination states: ready, sendobject
In this state, a menu is shown to the user, showing which items are available to be distributed. If the menu times-out, then it returns to the ready state. Otherwise, if the user selects something, then it stores the name of the selected object, and moves on to the 'sendobject' state.

sendobject

Destination states: ready
In this state, the user has already selected an object, so an HTTP request is being made to get that object distributed. If the HTTP request times-out, then it returns to the 'ready' state. If the HTTP request is successful, then the event is reported, and the script returns to the 'ready' state.


Known Issues

  • Only supports 1 user at a time
  • Will only display the first 12 objects for distribution


This page is part of the SLOODLE documentation
Docs: Users | Administrators | Developers
Wiki Frontpage Sloodle.org
Personal tools