Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Avatare im Besucherboard ausklammern
#4
Schau im nachfolgenden Skript nach myIgnoreList.

PHP-Code:
// Artemis Tesla 2010-12-12
// Script for showing visitors log on a board
// Put script on a prim and reset
// Requires osGetAgents to be enabled in Opensim\bin\config-include\osslEnable.ini :
// Allow_osGetAgents = ${XEngine|osslParcelOG}ESTATE_MANAGER,ESTATE_OWNER
// or put line in opensim.ini [xengine] section if not using osslEnable.ini file
// Jeff Hall - September 2017
// Manni 2020

// Color Name:
//     "AliceBlue", "AntiqueWhite", "Aqua", "Aquamarine", "Azure", "Beige", "Bisque",
//     "Black", "BlanchedAlmond", "Blue", "BlueViolet", "Brown", "BurlyWood",
//     "CadetBlue", "Chartreuse", "Chocolate", "Coral", "CornflowerBlue", "Cornsilk",
//     "Crimson", "Cyan", "DarkBlue", "DarkCyan", "DarkGoldenrod", "DarkGrey",
//     "DarkGreen", "DarkKhaki", "DarkMagenta", "DarkOliveGreen", "DarkOrange",
//     "DarkOrchid", "DarkRed", "DarkSalmon", "DarkSeaGreen", "DarkSlateBlue",
//     "DarkSlateGrey", "DarkTurquoise", "DarkViolet", "DeepPink", "DeepSkyBlue",
//     "DimGrey", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia",
//     "Gainsboro", "GhostWhite", "Gold", "Goldenrod", "Grey", "Green", "GreenYellow",
//     "Honeydew", "HotPink", "IndianRed", "Indigo", "Ivory", "Khaki", "Lavender",
//     "LavenderBlush", "LawnGreen", "LemonChiffon", "LightBlue", "LightCoral",
//     "LightCyan", "LightGoldenrodYellow", "LightGreen", "LightGrey", "LightPink",
//     "LightSalmon", "LightSeaGreen", "LightSkyBlue", "LightSlateGrey",
//     "LightSteelBlue", "LightYellow", "Lime", "LimeGreen", "Linen", "Magenta",
//     "Maroon", "MediumAquamarine", "MediumBlue", "MediumOrchid", "MediumPurple",
//     "MediumSeaGreen", "MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise",
//     "MediumVioletRed", "MidnightBlue", "MintCream", "MistyRose", "Moccasin",
//     "NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "Orange", "OrangeRed",
//     "Orchid", "PaleGoldenrod", "PaleGreen", "PaleTurquoise", "PaleVioletRed",
//     "PapayaWhip", "PeachPuff", "Peru", "Pink", "Plum", "PowderBlue", "Purple",
//     "Red", "RosyBrown", "RoyalBlue", "SaddleBrown", "Salmon", "SandyBrown",
//     "SeaGreen", "Seashell", "Sienna", "Silver", "SkyBlue", "SlateBlue", "SlateGrey",
//     "Snow", "SpringGreen", "SteelBlue", "Tan", "Teal", "Thistle", "Tomato",
//     "Turquoise", "Violet", "Wheat", "White", "WhiteSmoke", "Yellow", "YellowGreen"


list gDetected = [];
list 
gVisitors = [];
list 
myIgnoreList = [];
list 
myCleanedList = [];

string gTime = "";

// User Setup - Font - Text - Color - Time
integer Pixel_width = 512;
integer Pixel_height = 512;
string FontName = "Arial";
integer TextSize = 9;
string TextBaseColor = "White";
string TimeBaseColor = "White";
string NameBaseColor = "White";
string NameBackroundColor = "Black";
integer refreshtimeevent = 10;

// Colorbox
string Colorbox1 = "Black"; integer Colorboxwidth1 = 100; integer Colorboxheight1 = 512;
string Colorbox2 = "DarkGrey"; integer Colorboxwidth2 = 100; integer Colorboxheight2 = 512;
string Colorbox3 = "LightGrey"; integer Colorboxwidth3 = 100; integer Colorboxheight3 = 512;
string Colorbox4 = "Grey"; integer Colorboxwidth4 = 120; integer Colorboxheight4 = 512;

// Setup End

list ListXnotY(list lx, list ly)
{
    
// return elements in X list that are not in Y list
    
list lz;
    
integer i = llGetListLength(lx);
    while(
i--)
    if ( !~
llListFindList(ly,llList2List(lx,i,i)) ) // * see Note
            
lz += llList2List(lx,i,i);
    return 
lz;
}

display()
{
    
string draw = "";
    
string body = "width:" + Pixel_width + ",height:" + Pixel_height + ",bgcolour:" + NameBackroundColor;

    
// horizontal
    
draw = osSetPenColor( draw, "Black" );           // Set the pen color to red
    
draw = osMovePen( draw, 0, 0 );               // Upper left corner at <28,78>
    
draw = osDrawFilledRectangle( draw, 510, 28 ); // 200 pixels by 100 pixels
    // erste flaeche
    
draw = osSetPenColor( draw, "DarkGrey" );           // Set the pen color to red
    
draw = osMovePen( draw, 0, 28 );               // Upper left corner at <28,78>
    
draw = osDrawFilledRectangle( draw, 90, 479 ); // 200 pixels by 100 pixels
    // zweite flaeche
    
draw = osMovePen( draw, 85, 28 );
    
draw = osSetPenColor( draw, "LightGrey" );           // Set the pen color to blue
    
draw = osDrawFilledRectangle( draw, 100, 479 ); // 200 pixels by 100 pixels
    // dritte flaeche
    
draw = osMovePen( draw, 180, 28 );
    
draw = osSetPenColor( draw, "Grey" );           // Set the pen color to blue
    
draw = osDrawFilledRectangle( draw, 330, 479 ); // 200 pixels by 100 pixels
    // vierte flaeche
    //draw = osMovePen( draw, 295, 28 );
    //draw = osSetPenColor( draw, "Maroon" );           // Set the pen color to blue
    //draw = osDrawFilledRectangle( draw, 220, 479 ); // 200 pixels by 100 pixels

    // ende grafiken

    
osSetDynamicTextureData( "", "vector", draw, body, 0);
    
string log =  osGetGridName() + " Visitors";

    
integer visitors = llGetListLength(gVisitors) / 3;

    while(
visitors--)
    {
        
log = log + "\n" + llList2String(gVisitors, visitors * 3 + 2) + " - " +
                           
llList2String(gVisitors, visitors * 3 + 1) + " - " +
                           
llList2String(gVisitors, visitors * 3);
    }

    
draw = osSetFontSize(draw, TextSize);
    
draw = osSetFontName(draw, FontName);
    
draw = osSetPenSize(draw, 1 );
    
draw = osMovePen(draw, 10, 13);
    
draw = osSetPenColor(draw, TextBaseColor);
    
draw = osDrawText(draw, log);

   
//osSetDynamicTextureDataBlendFace("", "vector", draw, body, FALSE, 2, 0, 255, 4); // Single Side
   
osSetDynamicTextureData( "", "vector", draw, body, 0 ); // all side
}


string time()
{ 
//0123 4 56 7 89 0 12 3 45
    //YYYY - MM - DD T hh : mm:ss.ff..fZ
    
string now = llGetTimestamp();
    return 
llGetSubString(now,0,9) + " " +
           
llGetSubString(now,11,15);
}


string duration(string timeIn, string timeOut)
{
    
integer came = ((integer)llGetSubString(timeIn,11,12) * 60) + (integer)llGetSubString(timeIn,14,15);
    
integer went = ((integer)llGetSubString(timeOut,11,12) * 60) + (integer)llGetSubString(timeOut,14,15);

    if (
came == went) if(llGetSubString(timeIn,8,9) != llGetSubString(timeOut,8,9)) went = went + 1440;

    if (
came > went) went = went + 1440;
    
went = went - came;

    return 
llGetSubString("00" + (string)((went - (went % 60)) / 60), -2, -1) + ":" +
           
llGetSubString("00" + (string)(went % 60), -2, -1);
}


detectVisitorInOut(list avatars)
{
    
integer avatar = llGetListLength(avatars);
    
string name = "";

    while(
avatar--)
    {
        
name = llList2String(avatars, avatar);
        if (
llSubStringIndex((string)gDetected, name) == -1) gVisitors = gVisitors + [name, "00:00", gTime];

        
//if (llGetListLength(gVisitors) >= 63) gVisitors = llDeleteSubList(gVisitors, 0, 2);
        
if (llGetListLength(gVisitors) >= 126) gVisitors = llDeleteSubList(gVisitors, 0, 2);
    }

    
avatar = llGetListLength(gDetected);
    
name = "";

    while(
avatar--)
    {
        
name = llList2String(gDetected, avatar);
        if (
llSubStringIndex((string)avatars, name) == -1)
        {
            
integer position = llListFindList(gVisitors, [name, "00:00"]) + 1;
            
string time = duration(llList2String(gVisitors, position + 1), gTime);
            
gVisitors = llListReplaceList(gVisitors, [time], position, position);
        }
    }
}


visitorOut()
{
    
integer avatar = llGetListLength(gDetected);
    
string name = "";

    while(
avatar--)
    {
        
name = llList2String(gDetected, avatar);
        
integer position = llListFindList(gVisitors, [name, "00:00"]) + 1;
        
string time = duration(llList2String(gVisitors, position + 1), gTime);
        
gVisitors = llListReplaceList(gVisitors, [time], position, position);
    }
}


default
{
    
state_entry() { llSetTimerEvent(refreshtimeevent); }

    
timer()
    {

       list 
avatarList = osGetAgents();

       list 
myIgnoreList = ["first npc","second npc"];

       list 
myCleanedList = ListXnotY(avatarList, myIgnoreList);

        if ((string)
myCleanedList != (string)gDetected)
        {
            
gTime = time();

            if (
myCleanedList != []) detectVisitorInOut(myCleanedList);
            else 
visitorOut();

            
gDetected = myCleanedList ;
            
display();
        }
    }
} 
Ein Metaversum sind viele kleine Räume, die nahtlos aneinander passen,
sowie direkt sichtbar und begehbar sind, als wäre es aus einem Guss.



Zitieren


Nachrichten in diesem Thema
RE: Avatare im Besucherboard ausklammern - von Manfred Aabye - 15.03.2022, 15:59

Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  OpenSim Besucherboard Kubwa 3 4.867 13.01.2021, 09:10
Letzter Beitrag: Xenos Yifu

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste