Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

XY Text Light

Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
01-04-2007 00:12
Hello, for those who dont know me i LOVE to play with XY systems (numbers text sprites ect)... this comes from the fact that i cannot make heads or tails out of the current XY text scripts on the wiki, but yet it is such a simple concept

I started this project about 1 week before the Scripting Trade Show, but due to sim delays and my time i was never able to attend, i had planned on talking about how to homebrew XY offset scripts, and since i had this quickie already written i thought i would unleash it to the world

this version uses the 5 faced prim, and only displays 1 charater per face, in the near future i will be releasing a single texture 2 charater per face version, but that is another thread

this version is MUCH smaller than normal XY text, and IMO just abit faster

i release this system as openware for anyone to use and and learn from, if you use the scripts in their original form please include a footnote to me in your projects credits :)

lets get started

5 FACE PRIM SETUP

this is the 5 face prim setup script from the wiki, edited for this system. Two things you need to do manually

1 the center face needs to be flipped on its Horizontal axis
2 if you want fullbright i didnt add it into the setup script

CODE

////////////////////////////////////////////
// XyText Prim Setup
// Written by Gearsawe Stonecutter
// Modded For XY Text Light by Osgeld Barmy
////////////////////////////////////////////

string FACE_TEXTURE = "44891a22-1aba-c86f-2314-67a04ca24f48";
string TRANSPARENT = "701917a8-d614-471f-13dd-5f4644e36e3c";

default
{
state_entry()
{
llSetPrimitiveParams([

PRIM_TYPE, PRIM_TYPE_PRISM, PRIM_HOLE_DEFAULT, <0.199, 0.8, 0.0>, 0.68,
ZERO_VECTOR, <1.0, 1.0, 0.0>, ZERO_VECTOR,

// display a default face texture
PRIM_TEXTURE, 3, FACE_TEXTURE, <0.280, 0.090, 0.0>, <-0.357, 0.453, 0.0>, 0.0,
PRIM_TEXTURE, 7, FACE_TEXTURE, <0.110, 0.090, 0.0>, <-0.444, 0.453, 0.0>, 0.0,
PRIM_TEXTURE, 4, FACE_TEXTURE, <1.600, 0.090, 0.0>, <-0.970, 0.453, 0.0>, 0.0,
PRIM_TEXTURE, 6, FACE_TEXTURE, <0.110, 0.090, 0.0>, <-0.445, 0.453, 0.0>, 0.0,
PRIM_TEXTURE, 1, FACE_TEXTURE, <0.280, 0.090, 0.0>, <-0.524, 0.453, 0.0>, 0.0,

// show transparent textures for the other sides
PRIM_TEXTURE, 0, TRANSPARENT, <0.1, 0.1, 0>, ZERO_VECTOR, 0.0,
PRIM_TEXTURE, 2, TRANSPARENT, <0.1, 0.1, 0>, ZERO_VECTOR, 0.0,
PRIM_TEXTURE, 5, TRANSPARENT, <0.1, 0.1, 0>, ZERO_VECTOR, 0.0,

PRIM_SIZE, <0.03, 2.89, 0.5>
]);

// Remove ourselves from inventory.
llRemoveInventory(llGetScriptName());
}
}


NOTECARD
i used a notecard to avoid scripting issues with charaters such as " and \
this notecard needs to be named text rom please note the space at the end of the line, this needs to be in place for the script to see " " (spaces) in text, also this needs to be saved on line 0 of the notecard

CODE

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


CONTROL SCRIPT
this is the heart of this system, and needs to be placed in the parent prim of the object
display prims are accessed via link numbers from lowest to highest (get your link orders correct heh)
CODE

//<---------------------------------------------------------------------------------------------->//
//<---------- XY Text Light Control Script ----------------------------------------------------->//
//<------------- 2007 CFDT / Osgeld Barmy ------------------------------------------------------->//
//<---------------------------------------------------------------------------------------------->//

integer line_length = 15; // Length of 1 display line
integer cell_count = 60; // Total amount of faces in display
integer display = 2; // LinkNumber of first display prim
string glyph_index;

default
{
state_entry() {glyph_index = llGetNotecardLine("text rom",0);}

dataserver(key id, string data)
{
if (id == glyph_index)
{
glyph_index = data;
//llOwnerSay((string)llGetFreeMemory()); //DEBUG
state online;
}
}
}

state online
{
link_message(integer sender_num, integer num, string message, key id)
{
integer x;
integer space;
integer cell = display;
integer total = llStringLength(message);

do
{
if (x < cell_count && x > (total - 1)) llMessageLinked(cell,space,"4|10",NULL_KEY);
else
{
float pos = (float) llSubStringIndex(glyph_index,llGetSubString(message,x,x)) / 9;
integer dec = llSubStringIndex((string)pos,".");
//
string data = (
llGetSubString((string)pos,(dec + 1),(dec + 1))
+ "|" +
llGetSubString((string)pos,0,(dec - 1))
);
//
llMessageLinked(cell,space,data,NULL_KEY);
}

if (space == 4) {space = 0; ++cell;}
else {++space;}

++x;
}

while (x < cell_count);
}
}


DISPLAY SCRIPT
this script needs to be placed in each display prim
CODE

//<---------------------------------------------------------------------------------------------->//
//<---------- XY Text Light Display Script ----------------------------------------------------->//
//<------------- 2007 CFDT / Osgeld Barmy ------------------------------------------------------->//
//<---------------------------------------------------------------------------------------------->//

float ho = 0.111;
float vo = 0.090;
float vc = 0.453;

default
{
link_message(integer na, integer space, string data, key id)
{
integer h;
integer v;

integer break = llSubStringIndex(data,"|");
h = (integer)llGetSubString(data,0,(break - 1));
v = (integer)llGetSubString(data,(break + 1), -1);

if (space == 0) llOffsetTexture(-0.357 + (h*ho), vc - (v*vo), 3);
else if (space == 1) llOffsetTexture(-0.444 + (h*ho), vc - (v*vo), 7);
else if (space == 2) llOffsetTexture(-0.970 + (h*ho), vc - (v*vo), 4);
else if (space == 3) llOffsetTexture(-0.445 + (h*ho), vc - (v*vo), 6);
else if (space == 4) llOffsetTexture(-0.524 + (h*ho), vc - (v*vo), 1);
}
}


TEXTURE UUID's
both are 24 bit 256x256 textures

44891a22-1aba-c86f-2314-67a04ca24f48 = Black BG White Font
9494a435-00d3-cf03-aea7-b882e44fba58 = White BG Black Font

Here is everything above in txt format, since the forums loves to bugger up lsl formating
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
01-06-2007 09:27
/54/16/158923/1.html
_____________________
i've got nothing. ;)
Robert Neurocam
Registered User
Join date: 14 Sep 2005
Posts: 10
xy text light
03-22-2007 14:20
i got the scripts, i got them in sl and in the proper prims etc. trial on just one display right now, but i can not find or figure out where and how to enter text to be displayed can you help me. can either reply to this ot im me in world under Robert Neurocam. ty for your time.