Difference between revisions of "User:Fred Gandt/Scripts/Continued 4"

From Second Life Wiki
Jump to navigation Jump to search
m (→‎Create The Object: Changed link to Torley vid to internal.)
Line 46: Line 46:
*'''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)'''
*'''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>// V1 //
<lsl>// V2 //


default
default
Line 56: Line 56:
                               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>,
                               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>,
                               17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0,
                               17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0,
                               18, 0, <1.0, 0.65, 0.1>, 1.0,
                               18, -1, <1.0, 0.65, 0.1>, 1.0,
                               20, -1, 1,
                               20, -1, 1,
                               25, 0, 0.05]);
                               25, -1, 0.05]);
         llRemoveInventory(llGetScriptName());
         llRemoveInventory(llGetScriptName());
     }
     }

Revision as of 02:55, 24 April 2010

FG jpg.jpg

My Contributions

If unsure about how to use these scripts

I have implemented a V# system to make it more obvious if a script is updated. The V# forms part of the title of each script.

If you have any comments about the content of this page please post them HERE

All my scripts are written for compilation as MONO

More Pages

Free Scripts (content constantly updating)

More Free Scripts (content constantly updating)

Even More Free Scripts (content constantly updating)

Even More More Free Scripts (content constantly updating)

Even More More More Free Scripts (this page)

Legal Stuff

The legal stuff about contributing to this wiki (worth reading).

Tuition

Tuition scripts, notes, videos and screenshots etc. (hardly any content yet)

Free Scripts

Text Scroller (3 Scripts) ( V1 )

A simple text display unit that scrolls text from right to left (like those LED signs) in a continuous loop. Touch to start and stop the scrolling. It is not very sophisticated.

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>// V2 //

default {

   state_entry()
   {
       llSetPrimitiveParams([7, <0.5, 0.01, 0.25>,
                             8, <0.0, 0.0, 0.0, 1.0>,
                             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>,
                             17, -1, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0,
                             18, -1, <1.0, 0.65, 0.1>, 1.0,
                             20, -1, 1,
                             25, -1, 0.05]);
       llRemoveInventory(llGetScriptName());
   }

}</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. 1000 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

  • Check "Edit Linked parts" and select one prim at a time, dropping this script in each.
  • DO NOT CREATE A FRESH SCRIPT IN EACH PRIM. DROP THE SAME SCRIPT FROM YOUR INVENTORY INTO EACH PRIM.

<lsl>// V1 //

string font = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890(){}[]<>|\\/.,;:'!?\"£$%^&*_+-=~#@ ";

vector GetOffset(string s) {

   if(s == "")
       s = " ";
   integer i = llSubStringIndex(font, s);
   if(i == -1)
       i = 94;
   return <(-0.45 + ((i % 10) * 0.1)), (0.45 - (llRound(i / 10) * 0.1)), 0.0>;

}

integer me;

integer my_ss_5;

integer my_ss_6;

default {

   state_entry()
   {
       me = llGetLinkNumber();
       my_ss_6 = ((me - 1) * 2);
       my_ss_5 = (my_ss_6 + 1);
   }
   link_message(integer sender, integer num, string msg, key id)
   {
       llSetLinkPrimitiveParamsFast(me, [17, 5, id, <0.1, 0.1, 0.0>, GetOffset(llGetSubString(msg, my_ss_5, my_ss_5)), 0.0,
                                         17, 6, id, <0.1, 0.1, 0.0>, GetOffset(llGetSubString(msg, my_ss_6, my_ss_6)), 0.0]);
   }

}</lsl>

Control Script

One possible way amongst many to feed the text to the script is by notecard. That is the way I set this script. As such, you need a notecard in the root containing the text you wish to display. One notecard will be read. If you add more notecards (without altering the script) it will read the first it finds alphabetically.

  • Add your text notecard to the root.
  • Drop this script into the root.

<lsl>// V1 //

integer count;

integer length;

string text = " "; // This creates a gap between beginning and end of text.

integer NCC;

string NC;

integer on;

default {

   state_entry()
   {
       NC = llGetInventoryName(INVENTORY_NOTECARD, 0);
       llGetNotecardLine(NC, NCC);
   }
   dataserver(key q, string data)
   {
       if(data != EOF)
       {
           text += (data + " ");
           llGetNotecardLine(NC, (++NCC));
       }
       else
       {
           length = llStringLength(text);
           llMessageLinked(-1, 0, llGetSubString("Touch start scroll.", count, (count + 19)), "b6349d2d-56bf-4c18-4859-7db0771990a5");
       }
   }
   timer()
   {
       if(count == length)
       count = 0;
       llMessageLinked(-1, 0, llGetSubString(text, count, (count + 19)), "b6349d2d-56bf-4c18-4859-7db0771990a5");
       ++count;
   }
   touch_end(integer nd)
   {
       if(on)
       llSetTimerEvent(0.0);
       else
       llSetTimerEvent(0.15);
       on = (!on);
   }
   changed(integer change)
   {
       if(change & CHANGED_INVENTORY)
       llResetScript();
   }

}</lsl>

It should set the text to read "Touch Start Scroll.". If you get something else, you haven't followed these instructions.

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.

More Scripts...

Free Scripts (content constantly updating)

More Free Scripts (content constantly updating)

Even More Free Scripts (content constantly updating)

Even More More Free Scripts (content constantly updating)

Even More More More Free Scripts (this page)

If you have any comments about the content of this page please post them HERE