Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

CleanUp while reading notecard

Zerlinda Boucher
Registered User
Join date: 11 Oct 2008
Posts: 23
01-02-2009 08:28
Hi,

i still search if there is a way to read a notecard where someone have placed a link or an object embedded or other things then simply a text.
There is a function to allow to read only the text and not strange embedded things?

ty
Zer
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
The wiki is your friend :)
01-02-2009 09:19
This is from :

Notecards are limited in several ways:

When read by script:
Only the first 255 bytes of each line are returned.
Cannot contain embedded assets.


In other words, no there isn't.
Zerlinda Boucher
Registered User
Join date: 11 Oct 2008
Posts: 23
01-02-2009 09:52
there is some way to detect a "bad" notecard before processing it to a dataserver?

ty for the link and answer

Zer
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
01-02-2009 14:01
Well, I don't know how accurate it is but I tried something and it looks like one way to check is something like this:

CODE


key num_lines;
key lines;
integer line;

default
{
state_entry()
{
// a empty notecard does not trigger a dataserver event
// a timer wil detect that
llSetTimerEvent(10.0);

// a notecard with embedded item(s) returns an string with nothing
// allthough it is not empty
// casting this string to an integer makes 0
num_lines = llGetNumberOfNotecardLines("note");
}

dataserver(key query, string data)
{
llSetTimerEvent(0.0);
if (query == num_lines){
if ((integer)data == 0) llOwnerSay("Notecard has embedded item(s).");
else lines = llGetNotecardLine("note",line);
} else if (query == lines) {
if (data != EOF){
llOwnerSay(data);
++line;
lines = llGetNotecardLine("note",line);
}
}
}

timer()
{
llSetTimerEvent(0.0);
llOwnerSay("Empty notecard");
}

changed(integer change)
{
if (change & CHANGED_INVENTORY) llResetScript();
}
}



It seems to work.