Fileref:blog/lsl/sloodle blog hud.lsl
This script defines the in-world functionality of the Sloodle Blog HUD (part of the Sloodle Toolbar).
Contents |
Constants
- CHAT_TIMEOUT = time to wait for the user to chat some text (in seconds)
- CONFIRM_TIMEOUT = time to wait for the user to confirm their blog post (in seconds)
- HTTP_TIMEOUT = time to wait for an HTTP response from Moodle (in seconds)
- DATASERVER_TIMEOUT = time to wait for a response from the Second Life dataserver (in seconds)
- USER_CHAT_CHANNEL = channel on which to receive chat from the user
- SLOODLE_CHANNEL_OBJECT_DIALOG = channel on which to communicate with other Sloodle objects/scripts
- SLOODLE_CHANNEL_OBJECT_LOAD_URL = channel on which to communicate with the URL loading script
- REG_SCRIPT = relative path from the Moodle root to the user registration linker script
- BLOG_SCRIPT = relative path from the Moodle root to the blog linker script
Variables
- sloodleserverroot = WWW root of the Moodle installation
- sloodlepwd = prim password of the
- blogsubject = subject line of the blog entry
- blogbody = body text of the blog entry
- httpblogrequest = UUID of the HTTP request to make a blog entry
- httpregrequest = UUID of the HTTP request to check/make user registration
- confirmationmode = TRUE if we are waiting for the user to confirm their entry, or FALSE otherwise
- updatepending = TRUE if the script should reset and update its configuration at the next opportunity, or FALSE otherwise (note: possibly deprecated!)
Functions
sloodle_debug(string msg)
This standard functions transmits string msg on the debug linker channel to other scripts in the same link. String will be received and outputted by a debug script if present.
sloodle_handle_command(string str)
This customized standard function parses the command string str, and checks for any relevant commands. Executes appropriate actions and/or stores given data where necessary. This will generally be called as a result of a link message received from a notecard setup script. When configuration has been completed by this function, it returns TRUE. Otherwise, FALSE.
resetScript()
Resets the text display and the entire script (including all variables).
resetDisplay()
Clears all text from the surface of the HUD object.
resetSettings()
Resets the basic configuration settings back to empty (server root and prim password).
resetWorkingValues()
Resets the working values related to general blog functionality back to default values. This is always performed after a blog entry has been made, so that no values linger accidentally to the next entry.
States
All states will reset and return to the default state if a significant change occurs, such as an inventory change, or the item being attached to an avatar.
default
Destination states: error, authenticating
When in this state, the script is uninitialised, and waiting for configuration. At startup, if the object is not attached as a HUD item, then it moves to the error state. If a linkmessage is received on the object dialog channel, then the link string is given to the "sloodle_handle_command()" function. If configuration is complete, then it moves to the authenticating state.
error
Destination states: default
Being in this state means that an error has occurred. The script will reset (returning to the default state) if the object is touched, if the inventory changes, or if the object becomes attached to an avatar.
authenticating
Destination states: error, ready, confirm, default
In this state, the object is checking the user's registration status. If they are registered, then it normally continues straight on to the ready state (unless we are awaiting confirmation for an existing post, in which case it moves to the confirm state). If the user is not registered, then it will provide a URL to the registration page. Thereafter, it will once again either move to ready or confirm states, as appropriate. If an error occurs during registration, then it moves to the error state.
ready
Destination states: default, get_subject
In this state, the HUD is ready for the user to start a blog entry. If the "start" button is touched, then the script moves to the get_subject state.
get_subject
Destination states: default, ready, get_body, confirm
In this state, the script is expecting the subject line of the blog entry to be provided. If a timeout occurs, or if the user cancels, then the script returns to the ready state. When the subject is provided, then it will normally proceed to the get_body state, unless it is in confirmation mode, in which case it returns to the confirm state.
get_body
Destination states: default, ready, confirm
This state expects the body of the blog entry to be provided. If a timeout occurs, or if the user cancels, then the script returns to the ready state. When the body is provided it will proceed to the confirm state.
confirm
Destination states: default, ready, send
This state activates confirmation mode, so that various other operations (such as authentication) can be quickly carried out before returning to confirm the entry. If a timeout occurs, or if the user cancels, then it returns to the ready state. If the user touches the save button to confirm, then it proceeds to the send state. In theory, it could also return directly to the get_subject or get_body states to edit the entry, but this functionality is not yet provided.
send
Destination states: default, ready, authenticating, confirm
This state attempts to send the user's blog entry to Moodle. If successful, it returns to the ready state. If it fails because the user is not registered, then it jumps back to the authenticating state to register the user. If it fails for any other reason, then it returns to the confirm state, allowing the user to try again or to cancel.
| This page is part of the SLOODLE documentation | |||
|---|---|---|---|
| Docs: Users | Administrators | Developers | |||
| Wiki Frontpage Sloodle.org | |||