Changes

Jump to navigation Jump to search
no edit summary
}//close timer
}//close state default
</syntaxhighlight>
 
==== Script - Display Board ====
* [https://github.com/manwapastorelli/OpenSimLSL/blob/master/VisitorCounter(advanced).lsl Advanced Visitor Counter GitHub]
<syntaxhighlight lang="lsl" line>
integer displayComsChannel = -6827416;
integer displayComsChannelListen;
list todaysVisitors =[];
integer debug = FALSE;
 
SetUpListeners()
{//sets the coms channel and the random menu channel then turns the listeners on.
displayComsChannelListen = llListen(displayComsChannel, "", NULL_KEY, "");
llListenControl (displayComsChannelListen, TRUE);
}//close set up listeners
 
ApplyDynamicTexture(float rotationRAD, string text)
{ //sets the shape of the box and textures it rotating the arrow to the specified position
string sDynamicID = ""; // not implemented yet
string sContentType = "vector"; // vector = text/lines,etc. image = texture only
string sData = ""; // Storage for our drawing commands
string sExtraParams = "width:1024,height:512"; // optional parameters in the following format: [param]:[value],[param]:[value]
integer iTimer = 0; // timer is not implemented yet, leave @ 0
integer iAlpha = 100; // 0 = 100% Alpha, 255 = 100% Solid
// draw a rectangle
sData = osSetPenSize(sData, 3); // Set the pen width to 3 pixels
sData = osSetPenColor(sData, "Black"); // Set the pen color to red
sData = osMovePen(sData, 0, 0); // Upper left corner at <28,78>
sData = osDrawFilledRectangle(sData, 1024, 512); // 200 pixels by 100 pixels
// setup text to go in the drawn box
sData = osMovePen(sData, 30, 10); // place pen @ X,Y coordinates
sData = osSetFontName(sData, "Arial"); // Set the Fontname to use
sData = osSetFontSize(sData, 20); // Set the Font Size in pixels
sData = osSetPenColor(sData, "White"); // Set the pen color to Green
sData = osDrawText(sData, text); // The text to write
//do the draw multiple times so its actually black and not grey
osSetDynamicTextureDataBlend( sDynamicID, sContentType, sData, sExtraParams, iTimer, iAlpha ); // Now draw it out
osSetDynamicTextureDataBlend( sDynamicID, sContentType, sData, sExtraParams, iTimer, iAlpha ); // Now draw it out
osSetDynamicTextureDataBlend( sDynamicID, sContentType, sData, sExtraParams, iTimer, iAlpha ); // Now draw it out
}//close apply shape texture
 
SetBaseImage()
{
llSetLinkPrimitiveParamsFast(LINK_ROOT, [ PRIM_TEXTURE, ALL_SIDES, "802934bf-fcfb-4540-b7fa-b17585880d2b", <1,1,1>, <1,1,1>, 0 ]); //set the image
}
 
ProcessListenMessage(string message)
{
if (debug)
{
llOwnerSay("Debug:ProcessListenMessage:Entered");
}
if (message == "Reset")
{
if(debug)
{
llOwnerSay("Debug:ProcessListenMessage:Reset");
}
llResetScript();
}
else
{
if (debug)
{
llOwnerSay("Debug:ProcessListenMessage:UUID:" + message);
}
UpdateDisplay(message);
}
}
 
UpdateDisplay(string message)
{
string name = llKey2Name((key)message);
if(!(~llListFindList(todaysVisitors, (list)name)))
{
todaysVisitors += name;
UpdateDisplayText();
}
}
 
UpdateDisplayText()
{
string displayString = GenDisplayString();
SetBaseImage();
ApplyDynamicTexture(0, displayString);
}
 
string GenDisplayString ()
{
if (debug)
{
llOwnerSay("Debug:GenDisplayString:Entered");
}
string title = "Recent Visitors\n";
string display = title;
integer nameIndex = llGetListLength(todaysVisitors)-1;
for (nameIndex; nameIndex >= 0; nameIndex--)
{
display += llList2String(todaysVisitors, nameIndex);
display += "\n";
}
if (debug)
{
llOwnerSay("Debug:GenDisplayString:DisplayString: " + display);
}
return display;
}
 
default
{
state_entry()
{
SetUpListeners();
UpdateDisplayText();
}
 
listen(integer channel, string name, key id, string message)
{//listens on the set channels, then depending on the heard channel sends the message for processing.
if(debug)
{
llOwnerSay("Debug:Listen:Message: message");
}
if (llGetOwner() == llGetOwnerKey(id) && channel == displayComsChannel)
{
if (debug)
{
llOwnerSay("Debug:Listen:IsOwner And Correct Channel");
}
ProcessListenMessage(message);
} //close if sending object is owned by the same person
}//close listen
}
</syntaxhighlight>
Admin = cbd17d01-4a7e-437a-ac57-0c8313508aae
</syntaxhighlight>
 
 

Navigation menu