Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Recorder acting weird

Zeta Eizenstark
Registered User
Join date: 20 Aug 2008
Posts: 79
11-23-2008 15:02
First of all props go to Patch Lamington for creating 99% of the script.

I have moded the script to have it email the log and to read the email from a notecard. The problem I've been have is that it takes a while to register email. It take two starts to show me the email. So pretty much it goes like this. I click on the recorder it says "start" to make two prims to start spining and a cube to light up to tell people that a recording is in process and "loggin in", it doesn't tell me the email address. Then i click on it again and it says "stop" and "loggin off". When I click on it again it says "start" take like 3-5 secs then is says my email and "loggin in". When I click on it again it says "stop" and "loggin off" and replays chat. Then like 7-10 secs later it tells me my email again. I don't why but it must be where I put the dataserver function. Thanks for any help

list names;
list speech;
list colours=["002EB8","FF6633","006600","660066","660033","663300","1A9900","FF14B1","001A99","#B88A00"];
list unique_names;
string email_address = " ";//<---------Email
list chat = [];
string chat1;
key request;
default
{
state_entry()
{
request = llGetNotecardLine("Type your email here", 0);
llSetText("Recorder, \nremember to tell everyone that you are going to record first",<0,0,0>,1.0);
integer i;
integer c;
for (i=0;i<llGetListLength(names);i++)
{
c = llListFindList(unique_names,llList2List(names,i,i) );
while (c >= llGetListLength(colours)) // dont crash if I run out of colours
c -= llGetListLength(colours);
llSetObjectName("" + llList2String(names,i) );
llOwnerSay( llList2String(speech,i) + "
" );
chat += (llList2String(names,i) + ":" + llList2String(speech,i));
}
names = [];
speech = [];
unique_names = [];
llSetObjectName("Recorder";);
llEmail(email_address, "Recorder", "Here is the chat recorded\n" + llList2CSV(chat));
chat=[];
}
on_rez(integer i)
{
llResetScript();
}
dataserver(key ID, string Data)
{
if( ID == request)
{
email_address = Data;
llSay(0, email_address);
}
}
touch_start(integer total_number)
{
{
llSay(0, "logging on!.";);
llSay(-53, "start";);
state logging_chat;
}
}
}

state logging_chat
{
state_entry()
{
llListen(0,"",NULL_KEY,"";);
}

on_rez(integer i)
{
llOwnerSay("Logging still on! Touch to get playback";);
}

touch_start(integer total_number)
{
//if (llDetectedKey(0) == llGetOwner() )
{
llSay(0, "chat logging now off - replaying log!.";);
llSay(-53, "stop";);
//llRemoveInventory("Type your email here";);
state default;
}
}

listen(integer channel, string name, key id, string message)
{
if(llListFindList(unique_names,[name]) == -1)
{
unique_names += name;
}
names += name;
speech += message;
}

}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-23-2008 16:56
sounds the dataserver event is taking too long to respond the first time around, and you aren't actually waiting for it to finish as far as the script is concerned so it gets dumped on the state change (no handler in the second state).

you'll want to force the dataserver event to finish (or timeout w/ a message) before enabling the device to change states. the easiest way to do this is to move the dataserver call/event to it's own state, and only move to the next "ready" state if it is successful (or times out)

as for the second say of the email after shutting down the listen state, that's easy, you go back to the default state, and do everything in it's state entry, including that dataserver request that's in there.

EDIT:
PS, please use php tags, makes reading scripts on the forums much easier, and if you don't see the proper formatting of those tags check my sig below for the fix ;)
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -