, , , .
, , llFrand, ( , ):
integer max;
integer random = llFrand((integer)(max/2)) + llFrand((integer)(max/2));
, CHANGED_INVENTORY, , . , , , ? , ? notecard? .
NOTECARD colors , script:
blue
red
green
yellow
black
SCRIPT :
string ncName;
key ncNumOfLinesReqId;
key ncReqId;
integer numOfLines;
init()
{
ncName = "colors";
}
default
{
changed(integer change)
{
if (change & (CHANGED_OWNER | CHANGED_INVENTORY))
{
llResetScript();
}
}
state_entry()
{
init();
ncNumOfLinesReqId = llGetNumberOfNotecardLines(ncName);
}
touch_start(integer num_detected)
{
if (!numOfLines)
{
llSay(PUBLIC_CHANNEL, "~!~ Unconfigured, check notecard ~!~");
}
else
{
ncReqId = llGetNotecardLine(ncName, (integer)llFrand(numOfLines));
}
}
dataserver(key reqId, string data)
{
if (reqId == ncNumOfLinesReqId)
{
numOfLines = (integer)data;
}
else if (reqId == ncReqId)
{
llSay(PUBLIC_CHANNEL, data);
}
}
}
:
, , . UUID , , ( ). , , UUID. , - .
- Second Life.