Difference between revisions of "PfText"

From Second Life Wiki
Jump to navigation Jump to search
Line 11: Line 11:
pfText uses llSetLinkPrimitiveParams. By making a herd of parallel scripts, you would fill a sheet faster than with one of them. bt;dt
pfText uses llSetLinkPrimitiveParams. By making a herd of parallel scripts, you would fill a sheet faster than with one of them. bt;dt
=License=
=License=
I wrote this mostly on my own. A few of the float constants are ripped from the older xyText scripts, but I had to change 1 of them. Therefore the Scripts are Copyright 2007- Torrid Luna <torrid@primforge.com> AND
All content submitted to Second Life Wiki is contributed to Linden Lab under the Second Life Wiki Contribution Agreement (see Project:Contribution Agreement for details). Linden Lab will make your contribution available under the Creative Commons Creative Commons Attribution-Share Alike 3.0 license (see Project:Copyrights for details). If you don't want your writing to be edited mercilessly and redistributed at will, then don't submit it here.
The Scripts and any derivative work are licensed as follow:
 
'''Some rights reserved''': You may use and remix/improve this work as you like, but:
Make a visible mark on the project and script, that your work is based on me, [https://wiki.secondlife.com/wiki/User:Torrid_Luna Torrid Luna], or [http://primforge.com/ Primforge.com].
My sister is a lawyer in RL, and she's leading a Karate school in Berlin, Kreuzberg, Germany, Terra. You have been warned.^^




Line 25: Line 20:
// pfText  
// pfText  
// Copyright 2007- Torrid Luna <torrid@primforge.com>
// Copyright 2007- Torrid Luna <torrid@primforge.com>
// Some rights reserved: You may use and remix/improve this work as you like, but:
// Copyright 2007- 2009 Torrid Luna <torrid@primforge.com> http://primforge.com/
// Make a visible mark on the project and script, that your work is based on me, Torrid Luna, and/or Primforge.com.
// https://wiki.secondlife.com/wiki/Project:Copyrights#Contributing_to_the_Wiki
// My sister is a lawyer in RL, and she's leading a Karate school in Berlin, Kreuzberg, Germany, Terra. You have been warned.^^


string showable;
string showable;
Line 80: Line 74:
<lsl>
<lsl>
// pfText example
// pfText example
// Copyright 2007- Torrid Luna <torrid@primforge.com>
// Copyright 2007- 2009 Torrid Luna <torrid@primforge.com> http://primforge.com/
// Some rights reserved: You may use and remix/improve this work as you like, but:
// https://wiki.secondlife.com/wiki/Project:Copyrights#Contributing_to_the_Wiki
// Make a visible mark on the project and script, that your work is based on me, Torrid Luna, and/or Primforge.com.
// My sister is a lawyer in RL, and she's leading a Karate school in Berlin, Kreuzberg, Germany, Terra. You have been warned.^^


default{
default{

Revision as of 08:43, 9 March 2009

I admire the work being put into xyText, but life is short, and so should be Source Code. That's why I made my own version.

Features

pfText might or might not be the most powerful version of Text Systems in SL, but it's by far the shortest (1/10 of a typical xytext), and thereby easiest version. It's also easy to add custom and multi language characters.

You can easily add your own favourite characters, like diactitics and other funny stuff. Just make textures, 10x10 characters. You'll probably need at least 2 textures. Write down the printable chars one by one in the showable var. Put the texture's UUIDs into the chartextures list. That's about it.

Installation

Drop the 2 scripts into the root of a linkset of 5 Face prims, as described in xyText et. al.. Say something in chat.

Improving

pfText uses llSetLinkPrimitiveParams. By making a herd of parallel scripts, you would fill a sheet faster than with one of them. bt;dt

License

All content submitted to Second Life Wiki is contributed to Linden Lab under the Second Life Wiki Contribution Agreement (see Project:Contribution Agreement for details). Linden Lab will make your contribution available under the Creative Commons Creative Commons Attribution-Share Alike 3.0 license (see Project:Copyrights for details). If you don't want your writing to be edited mercilessly and redistributed at will, then don't submit it here.


Scripts

pfText Script

<lsl> // pfText // Copyright 2007- Torrid Luna <torrid@primforge.com> // Copyright 2007- 2009 Torrid Luna <torrid@primforge.com> http://primforge.com/ // https://wiki.secondlife.com/wiki/Project:Copyrights#Contributing_to_the_Wiki

string showable; list chartextures; list faces = [1,6,4,7,3];

list offsets = [<0.12, 0.1, 0>, <0.037, 0, 0>, <0.05, 0.1, 0>, <0,0,0>, <-0.74, 0.1, 0>, <0.244, 0, 0>, <0.05, 0.1, 0>, <0,0,0>, <0.12, 0.1, 0>, <-0.037, 0, 0>];


default{

   state_entry(){
       showable = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ";
       showable += "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~·";
       showable += "\n\n\n\n";
       showable +="ÄäÖöÜüßſÅåĄąÆæƏəĆćÇÐðđĘęĦħIJijŁłŃńÑñŊŋÓóÕõ";
       showable +="ŒœØø\n\nȘșŦțȚțÞþŨũŸÿÝý";
       
       chartextures = ["f8638022-4e35-d9de-053b-072b3cdd31ce", "d68b35a5-8f3d-b19c-6455-fd1d2bc9521b"];


   }
   link_message(integer sender, integer num, string str, key id){
       integer i;
       list alletters;
       for(i=0;i<5;i++){
           string thischar = llGetSubString(str, i,i);
           integer charindex = llSubStringIndex(showable, thischar);
           
           integer row = charindex / 10;
           integer col = charindex % 10;
           
           vector offset = <-0.45 + 0.1 * col, 0.45 - 0.1 * row, 0.0>;
           
           key texture = llList2Key(chartextures, charindex / 100);
           integer face = llList2Integer(faces, i);
           
           vector offset1 = llList2Vector(offsets, i*2);
           vector offset2 = llList2Vector(offsets, i*2 +1);
           
           // llSetPrimitiveParams([PRIM_TEXTURE, face, texture, offset1, offset + offset2, PI]);
           alletters += [PRIM_TEXTURE, face, texture, offset1, offset + offset2, PI];
       }
       llSetLinkPrimitiveParams(num+1, alletters);
   }

} </lsl>


pfText chat Example

<lsl> // pfText example // Copyright 2007- 2009 Torrid Luna <torrid@primforge.com> http://primforge.com/ // https://wiki.secondlife.com/wiki/Project:Copyrights#Contributing_to_the_Wiki

default{

   state_entry(){
       llListen(0, "", llGetOwner(), "");
   }
   listen(integer c, string name, key k, string msg){
       // meant for up to 5 prims. Know what you do. 
       msg = llGetSubString(msg + "                      ", 0, 24);
       // llOwnerSay("stringlength: " + (string)llStringLength(msg));
       integer length = (llStringLength(msg) - 1)/ 5 +1;
       integer i;
       for(i=0;i<length;i++){
           string sub = llGetSubString(msg, i*5, ((i+1)*5 - 1));
           llMessageLinked(LINK_THIS, i, sub, NULL_KEY);
       }
   }

} </lsl>

pfText primFormer

<lsl> default{

   state_entry(){
       llSetScale(<0.036, 1.2, 0.36>);
       list params = [PRIM_TYPE, PRIM_TYPE_PRISM, 3, <0.2, 0.8, 0.0>, 0.68, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>];
       llSetPrimitiveParams(params);
       llSetRot(llEuler2Rot(<PI, 0, PI>));
   }

} </lsl>