Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llgetnotecardline + llEmail

Natsely Amaterasu
Registered User
Join date: 30 Sep 2008
Posts: 19
11-15-2008 19:35
Ok I'm making something that asks for an email if it doesn't have one and then sends them the info to their email, for whatever they want sent. I originally had it so that It was just in the script, I want to change it to have it in a notecard so that I'm sure the script won't be changed. How can I get this to work. I have no idea how the dataserver function is suppose to look like and what is supposed to be put in the notecard. I have tried to do some debuging by using llSay to see what is in llGetNotecardLine and all I get are wierd numbers instead of the email that I put in the notecard. Help please.
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
11-15-2008 19:45
the return of llGetNotecardLine is a UUID for the Data Request you made. You should save this in a variable.

The reason it does this is because the Sim needs to Query the Asset Server for the Notecard's contents.

-

Then the dataserver event holds the UUID of the Data Request the Responce is for, and the Data of the responce.

In the dataserver, you should compare the two UUID's, if they match, do whatever with the Contents of the Data.

-

For a really generalized example, assuming its a single-line card with nothing but the email addey on it:

key Request;
string Email;

state_entry()
{
Request = llGetNotecardLine(note, 0);
}

dataserver(key ID, string Data);
{
if(ID == Request)
{
Email = Data
//Do Whatever with the responce.
}
}
Jenn Yoshikawa
Registered User
Join date: 14 Nov 2007
Posts: 91
Skidz Partz - DataServer - API
11-16-2008 11:37
string notecard_name = "configuration"; // name of notecard goes here

// internals
integer DEBUG = FALSE;
integer line;
key queryhandle; // to separate Dataserver requests
key notecarduuid;

init()
{
queryhandle = llGetNotecardLine(notecard_name, line = 0);// request line
notecarduuid = llGetInventoryKey(notecard_name);
}

// Config data loaded from notecard, with some sane defaults
integer channel = 1000;
string email_address = "revolution.perenti@skidzpartz.com";
default
{
changed(integer change)
{
// We want to reload channel notecard if it changed
if (change & CHANGED_INVENTORY)
if(notecarduuid != llGetInventoryKey(notecard_name))
init();
}

state_entry()
{
init();
}

dataserver(key query_id, string data)
{
if (query_id == queryhandle)
{
if (data != EOF)
{ // not at the end of the notecard
// yay! Parsing time

// pesky whitespace
data = llStringTrim(data, STRING_TRIM_HEAD);

// is it a comment?
if (llGetSubString (data, 0, 0) != "#";)
{
integer s = llSubStringIndex(data, "=";);
if(~s)//does it have an "=" in it?
{
string token = llToLower(llStringTrim(llDeleteSubString(data, s, -1), STRING_TRIM));
data = llStringTrim(llDeleteSubString(data, 0, s), STRING_TRIM);

//Insert your token parsers here.
if (token == "email_address";)
email_address = data;
else if (token == "channel";)
channel = (integer)data;
}
}

queryhandle = llGetNotecardLine(notecard_name, ++line);
if(DEBUG) llOwnerSay("Notecard Data: " + data);
}
else
{
if(DEBUG) llOwnerSay("Done Reading Notecard";);
state configuration ;
}
}
}
}

state configuration
{

state_entry()
{

}
}Skidz Partz - DataServer - API
Natsely Amaterasu
Registered User
Join date: 30 Sep 2008
Posts: 19
11-16-2008 13:56
For Faust's reply, how could I make that touch_start oriented. I have this but it doesn't work.

key Request;
string Email;
default
{
state_entry()
{
Request = llGetNotecardLine("email",0);
}
dataserver(key ID, string Data)
{
if ( ID == Request )
{
Email = Data;
}
}
touch_start(integer total_number)
{
llEmail(Email, "Recorder", "hi";);
}
}
Jenn Yoshikawa
Registered User
Join date: 14 Nov 2007
Posts: 91
11-17-2008 06:53
From: Natsely Amaterasu
For Faust's reply, how could I make that touch_start oriented. I have this but it doesn't work.

key Request;
string Email;
default
{
state_entry()
{
Request = llGetNotecardLine("email",0);
}
dataserver(key ID, string Data)
{
if ( ID == Request )
{
Email = Data;
}
}
touch_start(integer total_number)
{
llEmail((string)Email,"Recorder","Hi";);
}
}


Use a string on your e mail. If not it will fail doing some thing like this.
Recorder,Hi
with a string you will get this
Email,Recorder,Hi
A good way to check things is to owner say them to see what is going on. I use it to see what parts of the commands fail.

key Request;
string Email;
default
{
state_entry()
{
Request = llGetNotecardLine("email",0);
}
dataserver(key ID, string Data)
{
if ( ID == Request )
{
Email = Data;
}
}
touch_start(integer total_number)
{
llEmail((string)Email,"Recorder","Hi";);
}
}