Fileref:lsl/sloodle slave object.lsl
From SLIS Second Life Wiki
This script will listen for Sloodle commands being chatted on the Sloodle command channel (see Sloodle channels), and disseminate them to other scripts in the same prim.
Note that it is designed to be used with the Sloodle Set, and contains security measures to ensure that other objects cannot intefere. As such, this script can only be used in similar situations, whereby an object rezzes whatever over this script is in. Notably, it uses a 'trust' code, passed in via the starting parameter when the object is rezzed. Upon being rezzed, it will listen for chat from any object on the control channel. However, it will only listen if the message is to set the key of the controller object, and if the correct 'trust' code is provided.
From then on, the object will listen to all messages from that object.
Contents |
Future Work
- Currently, the script only pays attentions to certain standard commands. It should handle and pass on any Sloodle command.
- The script does not need to store any configuration data - it only needs to pass it on to other scripts.
- Separate states ought to be used to distinguish between the different conditions of the script: one state for awaiting controller confirmation, one for listening and handling commands, and another indicating that the object cannot have a controller as it had no starting parameter.
- Make the security measures more flexible, possibly to prevent the need for using the starting parameter.
Data
The script stores the following items of data:
Constants
- integer command_channel = the communications channel which is used for command control
Variables
- string sloodleserverroot = the URL of the Moodle site
- string opwd = the Prim Password of the Moodle site
- integer opwdcode = the 'trust' code passed in as the starting parameter
- integer sloodle_courseid = the ID of the Moodle course to connect to
- key controller_object = the UUID of the object which has control authority
Functions
This script uses the following functions:
- sloodle_debug(string msg) = standard Sloodle function - outputs a debug string
- sloodle_tell_other_scripts_in_prim(string msg) = sends the given string as a link message to all other scripts in the same prim
States
Currently, all functionality takes place in a single state.
default
This state cannot transition to any other states. Events are handled as follows:
- on_rez = store the starting parameter and listen for commands
- listen = confirm the controller object if necessary, or else handle and disseminate configuration commands
| This page is part of the Sloodle documentation | |||
|---|---|---|---|
| SloodleDocs Home | User Documentation | Administrator Documentation | Developer Documentation | Sloodle Wiki Home | |||
