Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

need help with a script thatreads from a nc

Arminius Alviso
Registered User
Join date: 5 Sep 2006
Posts: 4
11-11-2008 12:30
i want a hovertext above my prim the problem is i want the script to get the text from a nc but well i am not good with that would be nice to get some advice or help

thanks
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
11-11-2008 13:10
Look here; there are several examples. Most are a bit more complicated than you need for your single config item, but I find that if I have one config item, I'll usually think of another one later, so it's best to set up your notecard format so you can add features.

http://wiki.secondlife.com/wiki/LSL_Library

After taking a look at those, we'll be happy to help you with any questions! Happy hunting. :)
Tala Nagy
Registered User
Join date: 22 Mar 2007
Posts: 9
11-11-2008 13:30
From: Arminius Alviso
i want a hovertext above my prim the problem is i want the script to get the text from a nc but well i am not good with that would be nice to get some advice or help

thanks


Hi Arminius, try this:

CODE

string sNotecard;
integer iLine = 0;
key kID;

default
{
changed(integer c)
{
// reset script if inventory has been changed
if(c&CHANGED_INVENTORY) llResetScript();
}
state_entry()
{
//check if a notecard exists
if(llGetInventoryNumber(INVENTORY_NOTECARD)==0)
{
llSay(0, "No notecard found!");
return;
}
//get the name of the first notecard
sNotecard = llGetInventoryName(INVENTORY_NOTECARD, 0);
iLine = 0;
//request first line. This calls the dataserver event:
kID = llGetNotecardLine(sNotecard, iLine);
}
dataserver(key query_id, string data)
{
//check if what we got is what we want
if (query_id == kID)
{
//end of file?
if (data != EOF)
{
//put your routines here, e.g.
llSetText(data, <1.,1.,1.>,1.);
//if you expect only one line, you can stop here,
//no need to request the next line
//we include it here though for completeness
}
else // request next line
{
++iLine;
kID = llGetNotecardLine(sNotecard, iLine);
}
}
}
}


Bye,
Tala
Arminius Alviso
Registered User
Join date: 5 Sep 2006
Posts: 4
11-11-2008 13:58
thank you Tala sl is small i must say to meet you here ;-)
Michelle Thurston
Registered User
Join date: 14 Jul 2006
Posts: 208
11-11-2008 14:36
That's a lot of work for something so simple. If you're displaying a relatively short message, store it in the object description then go llSetText(llGetObjectDesc(), <1, 1, 1>, 1.0);