Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dataserver being an idiot to me ;.;

Yonke Ming
Fat Laughing Hyena
Join date: 18 Jun 2005
Posts: 16
08-31-2005 07:13
Well basically, I have a notecard and the script is not reading from them. I want it to get the lines but for some reason, dataserver event is not being accessed.

CODE

key owner;
key request;
integer mode = TRUE;
integer lines;
list names;
string note = "Admin";
default
{
on_rez(integer start_param)
{
llResetScript();

}

state_entry()
{
llListen(0,"",owner,"");
owner =llGetOwner();
llSetText("Reading Admin List. Please wait.",<1,1,1>,1);
llSleep(1.0);

llGetNumberOfNotecardLines(note);




llSetText("Message to the Forest Rangers:\n Not set",<1,1,1>,1);


}

listen(integer channel, string name, key id, string message)
{
if (llGetSubString(message,0,3) == "!set")
{
string substring = llGetSubString(message,5,254);
llSetText("Message to the Forest Rangers:\n"+substring+"",<1,1,1>,1);

}
else if (llGetSubString(message,0,4) == "!toff")
{
llSay(0,"The text will NOT be shown when the board is off.");
mode = FALSE;
}
else if (llGetSubString(message,0,3) == "!ton")
{
llSay(0,"The Text will be shown when the board is off.");
mode = TRUE;
}
else if (llGetSubString(message,0,5) == "!admin")
{
string test = llList2CSV(names);
llSay(0, "Admin:"+test+".");
}


}

touch_start(integer num_detected)
{
key avatar = llDetectedKey(0);



if (avatar == owner)
{
if (mode == FALSE)
{
llSetText(" ",<1,1,1>,1);
state off;
}
else
{
state off;
}
}

}
}

state off
{
touch_start(integer num_detected)
{
key avatar = llDetectedKey(0);
if (avatar == owner);
{
llSetText(""+llKey2Name(owner)+"'s Status is:\nNot Set.",<1,1,1>,1);
state default;
}



}

on_rez(integer start_param)
{
llResetScript();

}

dataserver(key query_id, string data)
{
if (request == query_id)
{
//Searches for the admin names here from the notecard.
llSay(0, ""+data+" admin members found! Itnitializing...");


}

}


}
_____________________
I like Hyenas...

...Especially the soft, fat, squishy, and silly ones!
FireEyes Fauna
Registered User
Join date: 26 Apr 2004
Posts: 138
08-31-2005 07:47
From what I can see...

It looks like you only have a dataserver event in the "state off" state. However, you're calling it from the state_entry event in the "default" state. So according to the script, there is no dataserver event when it's called. :)

Also, as a suggestion, since you're only listening to the owner...instead of using the llSay command, the llOwnerSay command might be cleaner? Unless the output text must be seen by other people present.

Also, you're setting the listen up to only listen to the key of owner. However, the owner variable isn't set until the next line. May need to flip those lines around.

And when you put the dataserver event into default, the if statement will never be executed. On your line where you tell it to get the # of lines, set that equal to request. Then it will work.

And
CODE
string substring = llGetSubString(message,5,254);
may work better as
CODE
string substring = llGetSubString(message,5,-1);
or
CODE
string substring = llDelSubString(message,0,4);


Edit: Hmm, seems someone else wrote that as I was editting again *lol*
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
08-31-2005 07:55
Also, change
CODE
           string substring = llGetSubString(message,5,254);
To:
CODE
            string substring = llGetSubString(message,5,-1);
Or else you're in for a nasty surprise.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.