Text Scroller

From Second Life Wiki
Revision as of 05:16, 24 April 2010 by Fred Gandt (talk | contribs) (Adding this script to the LSL Library since I think it is quite a good demo.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Text Scroller ( V1 )

Updated: 24 April 2010 by The Creator Fred Gandt

A simple text display object that scrolls text (applied as a texture) from right to left (like those LED signs) in a continuous loop.

  • Touch start/stop.

Create The Object

  • Create a fresh new prim and drop this script onto/into it. The prim will form the shape needed plus change the texturing etc. (you can do what you like to the texturing afterwards)

<lsl>default {

   state_entry()
   {
       llSetPrimitiveParams([7, <0.5, 0.01, 0.25>, // Set the size
                             8, <0.0, 0.0, 0.0, 1.0>, // Set to ZERO_ROTATION
                             9, 0, 0, <0.375, 0.875, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, // Shape the prim
                             17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0, // Apply the blank texture
                             18, -1, <1.0, 0.65, 0.1>, 1.0, // Color the prim (kinda orange)
                             20, -1, 1, // Make fullbright
                             25, -1, 0.05]); // Slight glow
       llRemoveInventory(llGetScriptName()); // Remove the script when done
   }

}</lsl>

  • When the script has worked its magic, Snap the prim to the grid with a grid size of .5 meters.
  • Shift-Drag-Copy the prim, snapping each to the grid positively along the X axis until you have 10 prims in a continuous strip.
  • You can actually make the object as long or short as you like. 1 prim will work. 100 prims will work (although large linksets have been a problem for link_messages in the past). Just follow the same basic build plan.
  • Select each of the prims from the end that has the greatest X axis position, one at a time (negatively along the X axis) until ALL are selected.

Text Scroller How It Should Look jpg.jpg

  • Link the set.

Display Script

Control Script

The Charsheet Texture

  • I am a scriptor, not a texturizerer. I created a very simple Charsheet (Character Sheet) to get you going but, it isn't very good *grins*. You will probably want to replace it.
  • The texture MUST be 10 characters by 10 characters (you may have empty spaces so, 56 chars is fine so long as the grid is the full 100 spaces).
  • Unlike the texture I have supplied...ALL the chars should be perfectly evenly spaced and not spreading into the neighboring spaces.
  • This is the texture supplied. You don't need to copy this. The script already has the UUID in it.

Charsheet Mono Black on White jpg.jpg

  • The display scripts contain a string that is in the exact same order the chars are read from top left to bottom right (row by row, not column by column).
  • HAVING THE SAME ORDER OF CHARS IN THE TEXTURE AND STRING IS VITAL.
  • The order you choose is entirely up to you as long as the strings in ALL the display scripts match the order of chars in the texture.
  • Don't forget to include a blank grid space on your 10 x 10 texture for a space "character". There also needs to be an empty space (in the correct place) in the scripts.
  • In the display script strings there are two characters that must be treated unusually. The \ and the " must have a \ placed before them.
    • Example "ABCabc123.,:\"\\/| " Note the included space and the way the \ and " have a \ before them.

Functions Used

  1. llSetPrimitiveParams - Set shapes, colors, textures and other parameters of the prim the script is in.
  2. llRemoveInventory - Remove the named inventory from the prim contents.
  3. llGetScriptName - Returns the name of the script that calls the function.
  4. llSubStringIndex - Searches a string for a test and returns the index (or -1 if not found)
  5. llRound - Returns a classically rounded (up or down; whichever is closest) float as an integer.
  6. llGetLinkNumber - Establish the link number of the prim the script is in.
  7. llGetSubString - Returns the part of the source string specified.
  8. llSetLinkPrimitiveParamsFast - Set parameters in any prim in a link-set without enforced delay.
  9. llGetInventoryName - Returns the name of the specified inventory type at index.
  10. llStringLength - Establish how many characters make up the source string.
  11. llGetNotecardLine - Requests the string data on line of named notecard and (if successful) dataserver returns the result.
  12. llMessageLinked - Send a message to defined links (or self) which are picked up by link_message
  13. llSetTimerEvent - Establish a repeating time frame that on each pass will trigger timer
  14. llResetScript - Wipe the memory and start from the word "default".

Events Used

  1. state_entry - Triggered when entering the state this event is in.
  2. link_message - Triggered if llMessageLinked sends a message to the link containing this event.
  3. dataserver - Triggered with responses to requests for data made by various functions.
  4. timer - Triggered if a set time has elapsed then again after that time elapses again ad infinitum until the set time is zero.
  5. touch_end - Triggered by an agent left clicking the object containing the script.
  6. changed - Triggered by various changes that the script can sense.