Changes

Jump to navigation Jump to search
→‎Script - HelperMessages: - updated the script to detect the region name automatically
== Ignore List ==
Any avi on the ignore list will not be counted at all, and will not be recorded. It will be as though they never visited.
 
== Helpers List ==
Any avi on the helper's list will be sent an IM notification the first time someone visits the region each day.
==== Licence ====
</syntaxhighlight>
==== Script - Visitor Counter ====* [https://github.com/manwapastorelliFire-And-Ice-Grid/OpenSimLSLLSL-And-OSSL-Script-Library/blobtree/mastermain/VisitorCounter(advanced).lsl VisitorCounterAdvanced Advanced Visitor Counter GitHub]
<syntaxhighlight lang="lsl" line>
list todaysVisitors; //list contains names and grid uri as CSV (uniquire visits in the day)
}//close timer
}//close state default
</syntaxhighlight>
 
==== Script - Display Board ====
* [https://github.com/Fire-And-Ice-Grid/LSL-And-OSSL-Script-Library/tree/main/VisitorCounterAdvanced 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>
 
==== Script - HelperMessages ====
* [https://github.com/Fire-And-Ice-Grid/LSL-And-OSSL-Script-Library/tree/main/VisitorCounterAdvanced Advanced Visitor Counter GitHub]
<syntaxhighlight lang="lsl" line>
list Helpers = [];
 
ProcessInstructionLine(string instruction, string data)
{
if (llToLower(instruction) == "helper")
{
Helpers += data;
}
}
 
string CleanUpString(string inputString)
 
{
 
string cleanString = llStringTrim( llToLower(inputString), STRING_TRIM );
 
return cleanString;
 
}
 
 
ReadConfigCards(string notecardName)
 
{ //Reads the named config card if it exists
 
if (llGetInventoryType(notecardName) == INVENTORY_NOTECARD)
 
{ //only come here if the name notecard actually exists, otherwise give the user an error
 
integer notecardLength = osGetNumberOfNotecardLines(notecardName); //gets the length of the notecard
 
integer index; //defines the index for the next line
 
for (index = 0; index < notecardLength; ++index)
 
{ //loops through the notecard line by line
 
string currentLine = osGetNotecardLine(notecardName,index); //contents of the current line exactly as it is in the notecard
 
string firstChar = llGetSubString(currentLine, 0,0); //gets the first character of this line
 
integer equalsIndex = llSubStringIndex(currentLine, "="); //gets the position of hte equals sign on this line if it exists
 
if (currentLine != "" && firstChar != "#" && equalsIndex != -1 )
 
{ //only come here if the line has content, it does not start with # and it contains an equal sign
 
string instruction = llGetSubString (currentLine, 0, equalsIndex-1); //everything before the equals sign
 
string data = llGetSubString(currentLine, equalsIndex+1, -1); //everything after the equals sign
 
instruction = CleanUpString (instruction); //sends the instruvtion to the cleanup method to remove white space and turn to lower case
 
data = CleanUpString (data); //sends the data to the cleanup method to remove white space and turn to lower case
 
ProcessInstructionLine(instruction, data); //sends the instruction and the data to the Process instruction method
 
}//close if the line is valid
 
else
 
{
 
if ( (currentLine != "") && (firstChar != "#") && (equalsIndex == -1))
 
{
 
llOwnerSay("Line number: " + (string)index + " is malformed. It is not blank, and does not begin with a #, yet it contains no equals sign.");
 
}
 
}
 
}
 
}//close if the notecard exists
 
else
 
{ //the named notecard does not exist, send an error to the user.
 
llOwnerSay ("The notecard called " + notecardName + " is missing, please address this");
 
}//close error the notecard does not exist
 
}//close read config card.
 
MessageHelpers(string aviUUID)
{
integer index;
for (index = 0; index < llGetListLength(Helpers); index++)
{
string pre = "hop://fireandicegrid.net:8002/app/agent/";
string tail = "/about";
string message = pre + aviUUID + tail + " has entered " + llGetRegionName() + " for the first time today";
llInstantMessage(llList2Key(Helpers, index), message);
}
}
 
default
 
{
changed(integer change)
{
if (change & CHANGED_INVENTORY) //note that it's & and not &&... it's bitwise!
{
llResetScript();
}
}
state_entry()
 
{ //main entry point of the script, this runs when the script starts
 
ReadConfigCards("Helpers"); //calls the read config card method passing the name of the card defined in the global variables above
 
}//close state entry
 
link_message(integer Sender, integer Number, string String, key Key) // This script is in the object too.
{
if (Number == 93827334)
{
MessageHelpers(String);
}
}
}//close default
</syntaxhighlight>
Admin = cbd17d01-4a7e-437a-ac57-0c8313508aae
</syntaxhighlight>
 
==== Ignore Notecard Sample ====

Navigation menu