Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Announcer (whispers or say for everyone)

Flavio Richez
Registered User
Join date: 9 Dec 2006
Posts: 25
01-13-2007 18:34
Hello, ppl. I need a very basic script... Is there something where I can use a notepad "settings" with : "time interval" and "advices" ?

So, in a time interval it will select one of the advices and say it to all of the ppl in the region?

Dont know if its able to do this.

Exemple of notecard "setings":

time interval: 5
// number in minutes that the announcer will say the advice

advice: Hello people, dont forget to tip our dancer.
advice: Do you need money? Dont waste more time and join our lottery.
advice ...
advice ...
...

Is it possible?

Thanks
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
01-13-2007 23:51
From: Flavio Richez
Hello, ppl. I need a very basic script... Is there something where I can use a notepad "settings" with : "time interval" and "advices" ?

So, in a time interval it will select one of the advices and say it to all of the ppl in the region?

Dont know if its able to do this.

Exemple of notecard "setings":

time interval: 5
// number in minutes that the announcer will say the advice

advice: Hello people, dont forget to tip our dancer.
advice: Do you need money? Dont waste more time and join our lottery.
advice ...
advice ...
...

Is it possible?

Thanks


Yes. :)

CODE


string notecardName = "settings"; // Noetcard being read
integer lineCounter; // line number being read
key dataRequestID; // data Server ID
integer timerInterval = 10; // In Seconds


default
{
state_entry()
{
lineCounter = 0;
// Check that its a valid Notecard name, just incase its been deleted somehow
integer itemtype = llGetInventoryType(notecardName);
if(INVENTORY_NOTECARD == itemtype)
{
llOwnerSay("Reading notecard " + notecardName);
llSetObjectName(notecardName);
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
llSetTimerEvent(timerInterval);
}
else
{
// No note card?
llOwnerSay("I'm sorry but I cannot find " + notecardName);
}
}

dataserver(key queryid, string data)
{
//Check to make sure this is the request we are making.
//Remember that when data comes back from the dataserver,
//it goes to *all* scripts in your prim.
//So you have to make sure this is the data you want, and
//not data coming from some other script.
if (dataRequestID == queryid)
{
//If we haven't reached the end of the file
//Process the incoming data,
if (data != EOF)
{
//InformUser("Line #" + (string)lineCounter + ": " + data);
// Add a specified station to the list?
if(llGetSubString(data, 0,0) != ";")
{
list ldata = llParseString2List(data, [":"], [""]);
string command = llList2String(ldata,0);
string value = llList2String(ldata,1);
//llOwnerSay("Read " + command + " : " + value);
if("time interval" == command)
{
timerInterval = (integer)value * 60;
llSetTimerEvent(timerInterval);
}
else if("advice" == command)
{
llWhisper(0,value);
}
}
}
else
{
lineCounter = 0;
}
}
}

timer()
{
// request the next line #
lineCounter += 1;
dataRequestID = llGetNotecardLine(notecardName, lineCounter);
}

// Allow auto reset in the notecard changes
changed(integer change)
{
if(change & CHANGED_INVENTORY)llResetScript();
}
}