NoteCard Text On A prim

De DigiWiki.

Simple Rendering from NoteCard

// Notecard Text on a Prim by Pavcules Superior (March 2010)
 
string g_strURL;
string g_strNotecardName;   
string g_strNotecardText;
integer g_intNotecardLine = 0;        
key g_keyNotecardQueryID; 
key g_keyURLRequestID;
 
// Start reading the notecard text.
ReadNotecardData()
{
    llOwnerSay("Reading Notecard...please wait.");
    g_intNotecardLine = 0;    
    g_strNotecardText = "";    
    g_strNotecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
    g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);  
}
 
default
{
    state_entry()
    {
        ReadNotecardData();
        g_keyURLRequestID = llRequestURL();
    }
 
    changed(integer change)
    {
        // If the inventory is updated, read the notecard data again.        
        if(change & CHANGED_INVENTORY)
        {
              ReadNotecardData();
        }       
    }
 
    dataserver(key query_id, string data) 
    {
        if (query_id == g_keyNotecardQueryID) 
        {
            if (data != EOF)
            {    
                // Store the data.
                g_strNotecardText += data + "\n";                
                // Read next notecard line.
                ++g_intNotecardLine;
                g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
            }
 
            else
            {
                // We have reached the end of the notecard.
                llOwnerSay("Rendering Media image.");
                // Refresh the URL again by setting a random URL parameter value.
                llSetPrimMediaParams(0,[ PRIM_MEDIA_CURRENT_URL, g_strURL + "/?rand=" + (string)llGetTime() ]);
            }
        }
    }
 
    http_request(key id, string method, string body)
    {
        if (g_keyURLRequestID == id)
        {
            g_keyURLRequestID = "";
 
            if (method == URL_REQUEST_GRANTED)
            {
                g_strURL = body;
                // Set the URL.
                llSetPrimMediaParams(0,[ PRIM_MEDIA_CURRENT_URL, g_strURL]);
 
                llSay(0,"URL: " + body);
            }
 
            else if (method == URL_REQUEST_DENIED)
            {
                llSay(0, "Something went wrong, no url. " + body);
            }
        }
 
        else
        {
            // If the page is requested, show the notecard text.
            llHTTPResponse(id, 200, g_strNotecardText);
        }
    }   
}

Html Rendering from NoteCard

// Notecard Text on a Prim by Pavcules Superior (March 2010)
 
string g_strNotecardName;   
string g_strNotecardText;
integer g_intNotecardLine = 0;        
key g_keyNotecardQueryID; 
key g_keyURLRequestID;
 
// Start reading the notecard text.
ReadNotecardText()
{
    llOwnerSay("Reading Notecard...please wait.");
    g_intNotecardLine = 0;    
    g_strNotecardText = "";    
    g_strNotecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
    g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);   
}
 
default
{
    state_entry()
    {
        ReadNotecardText();
        g_keyURLRequestID = llRequestURL();
    }
 
    changed(integer change)
    {
        // If the inventory is updated, read the notecard data again.        
        if(change & CHANGED_INVENTORY)
        {
            ReadNotecardText();
        }       
    }
 
    dataserver(key query_id, string data) 
    {
        if (query_id == g_keyNotecardQueryID) 
        {
            if (data != EOF)
            {    
                // Store the text.
                g_strNotecardText += data;
                // Read next notecard line.
                ++g_intNotecardLine;
                g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
            }
 
            else
            {
                // We have reached the end of the notecard.
                llOwnerSay("Size: " + (string)llStringLength(g_strNotecardText));
                llOwnerSay("Rendering Media image...please wait.");
 
                // Refresh the URL again by setting a random URL parameter value.
                llSetPrimMediaParams(0,[ PRIM_MEDIA_CURRENT_URL, 
                      "data:text/html," + g_strNotecardText ]); 
            }
        }
    }   
}

La Notcard

<html>
<head>
</head>
<body
 style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 204);">
<title></title>
<table style="text-align: center; height: 1008px; width: 100%;"
 background="http://www.spiralgraphics.biz/packs/metal_robust/previews/Basketweave%20Plates.jpg">
  <tbody>
    <tr>
      <td><span style="font-weight: bold; font-size: 40pt;">
This is a demo webpage using the 'data:text/html'.<br>
      <br>
      <span style="color: rgb(0, 0, 153);">
Hi Slack....well at least 1024 characters
      </span><br style="color: rgb(0, 0, 153);">
      <span style="color: rgb(0, 0, 153);">
is better than 254!</span><br>
      <br>
      <span style="font-style: italic; color: rgb(0, 102, 0);">
So good enough for the majority of people! :-)<br>
      </span>
      </span> </td>
    </tr>
  </tbody>
</table>
</body>
</html>

Going beyond 1024 characters!

Après avoir fixé ce petit script trouvé sur le forum SL, je l'ai testé sur OpenSim, Aurora-Sim et Second Life (avec FireStorm et Angstrom). Actuellement il ne fonctionne que sur SL ...

// Notecard Text on a Prim by Pavcules Superior (March 2010)
 
string g_strURL;  
string g_strNotecardName;   
string g_strNotecardText;
integer g_intNotecardLine = 0;        
key g_keyNotecardQueryID; 
key g_keyURLRequestID;
 
// Start reading the notecard text.
ReadNotecardText()
{
    llOwnerSay("Reading Notecard...please wait.");
    g_intNotecardLine = 0;    
    g_strNotecardText = "";    
    g_strNotecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
    g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);   
} 
 
show(string html)
{
    // llOwnerSay(html + "\nSize: " + (string)llStringLength(html) );
    llSetPrimMediaParams(0,                   // Side to display the media on.
            [PRIM_MEDIA_AUTO_PLAY,TRUE,       // Show this page immediately
             PRIM_MEDIA_CURRENT_URL,html,     // The url if they hit 'home'
             PRIM_MEDIA_HOME_URL,html,        // The url currently showing
             PRIM_MEDIA_HEIGHT_PIXELS,1024,   // Height/width of media texture will be
             PRIM_MEDIA_WIDTH_PIXELS,1024]);  // rounded up to nearest power of 2.
}
 
// This creates a data: url that will render the output of the http-in url given.
string build_url(string url)
{
    return "data:text/html, 
<html>
<head>
 
<script type=\"text/javascript\"> 
function makeRequest()
{
    // " + (string)llGetUnixTime() + "    
    var oScript = document.createElement('script');
    oScript.src = '" + url + "?part=0&sid='+Math.random();
    document.body.appendChild(oScript);  
 
    var oScript= document.createElement('script');
    oScript.src = '" + url + "?part=1&sid='+Math.random();
    document.body.appendChild(oScript);     
}
 
function callback(num, sText) 
{
    document.getElementById('d' + num).innerHTML = sText;  
}
 
</script>
</head>
<body onload=\"makeRequest();\">
<div><div id=\"d0\" style=\"display:inline;\"></div><div id=\"d1\" style=\"display:inline;\"></div></div>
</body>
</html>";
}
 
string strReplace(string str, string search, string replace) {
    return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace);
}
 
default
{
    state_entry()
    {
        ReadNotecardText();
        llRequestURL();
    }
 
    changed(integer change)
    {
        // If the inventory is updated, read the notecard data again.        
        if(change & CHANGED_INVENTORY)
        {
            ReadNotecardText();
        }       
    }
 
    dataserver(key query_id, string data) 
    {
        if (query_id == g_keyNotecardQueryID) 
        {
            if (data != EOF)
            {    
                // Store the text.
                g_strNotecardText += data;
 
                // Read next notecard line.
                ++g_intNotecardLine;
                g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
            }
 
            else
            {
                // We have reached the end of the notecard.
                llOwnerSay("Size: " + (string)llStringLength(g_strNotecardText));
                show(build_url(g_strURL));
            }
        }
    } 
 
    http_request(key id, string method, string body)
    {
        if (method == URL_REQUEST_GRANTED)
        {
            // g_strURL = body + "/";
            g_strURL = body;
            llOwnerSay(g_strURL);
            // show(build_url(url));
        }
 
        else if (method == "GET")
        {
 
            string strParams = llGetHTTPHeader(id, "x-query-string");
            llOwnerSay("url: " + strParams);          
            list lstParams = llParseStringKeepNulls(strParams, ["&"], []);
            list lstParamID = llParseStringKeepNulls(llList2String(lstParams,0), ["="], []);
            integer intPartNumber = llList2Integer(lstParamID,1);
            integer intSize = 1900;
            integer intStart = 0;
            integer intFinish = intSize -1;
 
            if(llList2String(lstParamID,0) == "part")
            {
                intStart = intSize * intPartNumber;
                intFinish = intStart + intSize - 1;
            }
 
            llOwnerSay("Getting Notecard Contents:");
            g_strNotecardText = strReplace(g_strNotecardText,"\"","'");
 
            string strCallback = "callback(" + (string)intPartNumber + ",\"" +
                llGetSubString(g_strNotecardText,intStart,intFinish) + 
                "\");";           
            llHTTPResponse(id,200,strCallback );
        }
    }
}

La Notcard

<strong>
Second Life (SL) is a virtual world developed by Linden Lab that launched on June 23, 2003 and is accessible via the Internet. A free client program called the Second Life Viewer enables its users, called Residents, to interact with each other through
avatars. Residents can explore, meet other residents, socialize, participate in individual and group activities, and create and trade virtual property and services with one another, or travel throughout the world (which residents refer to as "the grid").
Second Life is for people aged 18 and over, while Teen Second Life is for people aged 13 to 17.
Built into the software is a three-dimensional modeling tool based around simple geometric shapes that allows a resident to build virtual objects. This can be used in combination with the Linden Scripting Language which can be used to add functionality 
to objects. More complex three-dimensional sculpted prims (colloquially known as sculpties), textures for clothing or other objects, and animations and gestures can be created using external software. The Second Life Terms of Service ensure that users 
retain copyright for any content they create, and the server and client provide simple digital rights management functions.
</strong>

<br><br>

1999, Philip Rosedale (known as Philip Linden inworld) formed Linden Lab. His initial focus was on the development of hardware that would enable computer users to be fully immersed in a virtual world experience. In its earliest form, the company 
struggled to produce a commercial version of the hardware, known as "The Rig", which was realized in prototype form as a clunky steel contraption with several computer monitors that users could wear on their shoulders. That vision soon morphed into 
the software application Linden World, in which users could participate in task-based games and socialization in a three-dimensional online environment. 

<br><br>

<em>
That effort would eventually transform into the better known, user-centered Second Life. 
Although he was familiar with the metaverse of Neal Stephenson's novel Snow Crash, Rosedale has said that his vision of virtual worlds predates that book, and that he conducted some early virtual world experiments during his college years at the 
University of California San Diego, where he studied physics.
On December 11, 2007, Cory Ondrejka, who helped program Second Life, was forced to resign as chief technology officer .
In January 2008, residents (including bots used to simulate traffic for better search rankings) spent a total of 28,274,505 hours "inworld", and, on average, 38,000 residents were logged in at any particular moment. The maximum concurrency (number of 
avatars inworld) recorded is 88,200 in the 1st qtr. 2009 
On March 14, 2008, Rosedale announced plans to step down from his position as Linden Lab CEO and to become chairman of Linden Lab's board of directors. Rosedale announced Mark Kingdon as the new CEO effective May 15, 2008.
In 2008, Second Life was honored at the 59th Annual Technology & Engineering Emmy Awards for advancing the development of online sites with user-generated content. Rosedale accepted the award.
In January 2010, 18 million accounts were registered, although there are no reliable figures for actual long term consistent usage.
</em>

Svg Rendering from NoteCard

// Notecard Text on a Prim by Pavcules Superior (March 2010)
 
string g_strNotecardName;   
string g_strNotecardText;
integer g_intNotecardLine = 0;        
key g_keyNotecardQueryID; 
key g_keyURLRequestID;
 
// Start reading the notecard text.
ReadNotecardText()
{
    llOwnerSay("Reading Notecard...please wait.");
    g_intNotecardLine = 0;    
    g_strNotecardText = "";    
    g_strNotecardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
    g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);   
 
}
 
default
{
    state_entry()
    {
        ReadNotecardText();
        g_keyURLRequestID = llRequestURL();
    }
 
    changed(integer change)
    {
        // If the inventory is updated, read the notecard data again.        
        if(change & CHANGED_INVENTORY)
        {
              ReadNotecardText();
        }       
    }
 
    dataserver(key query_id, string data) 
    {
        if (query_id == g_keyNotecardQueryID) 
        {
            if (data != EOF)
            {    
                // Store the text.
                g_strNotecardText += data;
                // Read next notecard line.
                ++g_intNotecardLine;
                g_keyNotecardQueryID = llGetNotecardLine(g_strNotecardName, g_intNotecardLine);
            }
 
            else
            {
                // We have reached the end of the notecard.
                llOwnerSay("Size: " + (string)llStringLength(g_strNotecardText));
                llOwnerSay("Rendering Media image...please wait.");
 
                // Refresh the URL again by setting a random URL parameter value.
                llSetPrimMediaParams(0,
                   [PRIM_MEDIA_AUTO_PLAY,TRUE,
                    PRIM_MEDIA_CURRENT_URL,"data:image/svg+xml," + g_strNotecardText,
                    PRIM_MEDIA_HEIGHT_PIXELS,1024,
                    PRIM_MEDIA_WIDTH_PIXELS,1024]);   
            }
        }
    }   
}

La Notcard

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
 <polyline points="0,0 0,500 500,250" style="stroke: #000000; stroke-width: 1; fill:#339933;" />
 <circle cx="150" cy="750" r="100" style="stroke: #000000; stroke-width: 10; fill: #aaaaaa;" />
 <ellipse cx="600" cy="600" rx="150" ry="250" style="stroke: #000000; stroke-width: 2; fill: #ffaaaa;" />
 <rect x="800" y="50" width="100" height="600" rx="2" ry="2" style="stroke: #000000; stroke-width: 1; fill: #000088;" />
 <text x="20" y="200" style="stroke: #000000;fill: #66ee66;font-family:Arial;font-size: 150px;">
 Hello There</text>
 <text x="200" y="400" style="stroke: #000000;fill: #ff0000;font-family:Arial;font-size: 125px;" transform="translate(250) rotate(45 50 50)">
 A demo of SVG</text>
 </svg>
Outils personnels
  • Cette page a été consultée 2 783 fois.
donate
Google Ads