removed useless _ folders
This commit is contained in:
3
Script Updater/Script Updater.sol
Normal file
3
Script Updater/Script Updater.sol
Normal file
@@ -0,0 +1,3 @@
|
||||
<Solution name="Script Updater">
|
||||
<Project name="Script Updater" path="Script Updater\Script Updater.prj" active="true"/>
|
||||
</Solution>
|
||||
@@ -0,0 +1,27 @@
|
||||
// :CATEGORY:Updater
|
||||
// :NAME:Script Updater
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2014-01-30 12:17:13
|
||||
// :EDITED:2014-01-31 15:40:15
|
||||
// :ID:1017
|
||||
// :NUM:1579
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Test script for the updater - announces Rev 1. Click the server prim and this should change to Rev 2
|
||||
// :CODE:
|
||||
integer Rev = 1;
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay(0, "Hello, Avatar, my rev is " + (string) Rev);
|
||||
}
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llSay(0, "Hello, Avatar, my rev is " + (string) Rev);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// :CATEGORY:Updater
|
||||
// :NAME:Script Updater
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:Update, updater
|
||||
// :CREATED:2014-01-30 12:16:43
|
||||
// :EDITED:2014-02-14 12:33:24
|
||||
// :ID:1017
|
||||
// :NUM:1578
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life, OpenSim
|
||||
// :DESCRIPTION:
|
||||
// Remote prim updater for scripts. This registers the prim to accept scripts from a server in the same region.
|
||||
// :CODE:
|
||||
|
||||
// when anything changes in the prims inventory, this sends the name and UUID to a central server.
|
||||
// It enabled remote script loading from that central prim, estate-wide
|
||||
// As a result, if you add any new scripts, they auto-get inserted into the database
|
||||
// tunable
|
||||
|
||||
integer debug = FALSE; // chat a message
|
||||
integer UNIQ = 1246; // the private channel unique to the owner of this prim
|
||||
|
||||
// Not tuneable
|
||||
integer CHECKIN = 86400; // 86400 seconds = 1 day
|
||||
integer comChannel ; // placeholder for llRegionSay
|
||||
DEBUG (string msg) { if (debug) llOwnerSay(llGetScriptName() + ":" + msg);}
|
||||
integer pin; // a random pin for security
|
||||
|
||||
update() {
|
||||
|
||||
integer j = llGetInventoryNumber(INVENTORY_SCRIPT);
|
||||
integer i;
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
string name = llGetInventoryName(INVENTORY_SCRIPT,i);
|
||||
DEBUG("Sending " + name);
|
||||
llRegionSay(comChannel,name + "^" + (string) pin);
|
||||
}
|
||||
llOwnerSay("Script Updater ready");
|
||||
llSetTimerEvent(CHECKIN); // Hourly check ins
|
||||
}
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
pin = llCeil(llFrand(123456) + 654321);
|
||||
comChannel = (((integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF ) + UNIQ; // 1234 is the private channel for this owner
|
||||
llSetRemoteScriptAccessPin(pin);
|
||||
update();
|
||||
|
||||
}
|
||||
// in case we rez, our UUID changed, so we check in
|
||||
on_rez(integer p) {
|
||||
llResetScript(); }
|
||||
|
||||
// a new script may have been added
|
||||
changed ( integer what)
|
||||
{
|
||||
if (what & CHANGED_INVENTORY ) {
|
||||
update();
|
||||
}
|
||||
if (what & CHANGED_REGION_START ) {
|
||||
llResetScript();
|
||||
}
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
14
Script Updater/Script Updater/Script Updater.prj
Normal file
14
Script Updater/Script Updater/Script Updater.prj
Normal file
@@ -0,0 +1,14 @@
|
||||
<Project name="Script Updater" guid="78720377-50c0-4ed4-9862-65b41d18c013">
|
||||
<Object name="ObjectNeedingUpdate" guid="957cda1e-7a95-417d-a7ef-22ce48c8d733">
|
||||
<Script name="UpdaterClient.lsl" guid="99a1a83a-d6c8-4efc-a88b-46800bd004d3">
|
||||
</Script>
|
||||
<Script name="AScript.lsl" guid="3d4d7cee-2f4d-4f83-b542-13fb46c54380">
|
||||
</Script>
|
||||
</Object>
|
||||
<Object name="ScriptUpdater" guid="f1b43231-c9fb-4c8b-a820-accdd7a0daa3" active="true">
|
||||
<Script name="AScript.lsl" guid="809390f4-fde8-45c9-bb7b-046468b51267">
|
||||
</Script>
|
||||
<Script name="UpdaterServer.lsl" guid="e2cdbf7a-4a7f-4a78-b53e-32fe50ffa0e0">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
27
Script Updater/Script Updater/ScriptUpdater/AScript.lsl
Normal file
27
Script Updater/Script Updater/ScriptUpdater/AScript.lsl
Normal file
@@ -0,0 +1,27 @@
|
||||
// :CATEGORY:Updater
|
||||
// :NAME:Script Updater
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:
|
||||
// :CREATED:2014-01-30 12:17:30
|
||||
// :EDITED:2014-01-31 15:40:15
|
||||
// :ID:1017
|
||||
// :NUM:1580
|
||||
// :REV:1
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Test script for the updater - rev two will go into the remote prim and announce itself when this works
|
||||
// :CODE:
|
||||
integer Rev = 2;
|
||||
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay(0, "Hello, Avatar, my rev is " + (string) Rev);
|
||||
}
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llSay(0, "Hello, Avatar, my rev is " + (string) Rev);
|
||||
}
|
||||
}
|
||||
173
Script Updater/Script Updater/ScriptUpdater/UpdaterServer.lsl
Normal file
173
Script Updater/Script Updater/ScriptUpdater/UpdaterServer.lsl
Normal file
@@ -0,0 +1,173 @@
|
||||
// :CATEGORY:Updater
|
||||
// :NAME:Script Updater
|
||||
// :AUTHOR:Ferd Frederix
|
||||
// :KEYWORDS:Update, updater
|
||||
// :CREATED:2014-01-30 12:17:30
|
||||
// :EDITED:2014-02-14 12:33:24
|
||||
// :ID:1017
|
||||
// :NUM:1581
|
||||
// :REV:1.1
|
||||
// :WORLD:Second Life, OpenSim
|
||||
// :DESCRIPTION:
|
||||
// Central prim updater for scripts. Just drop a (non running) script in here and click the prim. Scripts are sent to the registered clients
|
||||
// :CODE:
|
||||
|
||||
// Rev 1.1 on 2-13-2014 fixes timeout bugs, adds
|
||||
//
|
||||
|
||||
|
||||
integer debug = TRUE; // chat a message
|
||||
|
||||
// tunables
|
||||
integer TITLE = TRUE; // show how many scripts can be updated in hover text
|
||||
integer UNIQ = 1246; // the private channel unique to the owner of this prim - MUST MATCH in client and server
|
||||
integer CHECKIN = 172860; // 86400 seconds = 1 day X 2 + 60. This is twice the client setting plus one minute to allow for a dropped packet and slop in LSLEditor
|
||||
|
||||
// globals
|
||||
integer comChannel ; // we listen on this channel. It is unioque to this owner and a subchannel
|
||||
integer MINUTE = 60; // seconds in a minute, seems inefficient, but debug is a lot faster this way!
|
||||
|
||||
DEBUG (string msg) { if (debug) llSay(0,llGetScriptName() + ":" + msg);}
|
||||
|
||||
// The list is a PIN to update, a timestamp, thre name of the script, the UUID of the prim it was found in
|
||||
// This is a small searchable database whose primary key (uniq) is name + UUID
|
||||
integer STRIDE = 4; // size of this list:
|
||||
list lScripts; // +0 (integer) PIN - remote prims random PIN
|
||||
// +1 (integer) time stamp last heard from
|
||||
// +2 (string) name of script
|
||||
// +3 (key) UUID
|
||||
|
||||
update()
|
||||
{
|
||||
integer toDo = llGetInventoryNumber(INVENTORY_SCRIPT); // how many scripts checked in?
|
||||
integer PrimToDo = llGetListLength(lScripts);
|
||||
|
||||
llOwnerSay((string) (toDo -1) + " scripts in inventory to send");
|
||||
// DEBUG(llDumpList2String(lScripts,","));
|
||||
|
||||
integer index;
|
||||
|
||||
// scan all scripts in our inventory, could be more than one needs updating.
|
||||
for (index = 0; index < toDo; index++)
|
||||
{
|
||||
string name = llGetInventoryName(INVENTORY_SCRIPT,index);
|
||||
|
||||
|
||||
// check to see if the name of the script we just found in our inventory matches ourself. if so, skip it
|
||||
|
||||
if (name != llGetScriptName()) {
|
||||
DEBUG( "Processing script " + name);
|
||||
integer countAllScripts = llGetListLength(lScripts);
|
||||
|
||||
integer indexer;
|
||||
integer counter;
|
||||
// Scan over all scripts
|
||||
for (indexer = 0; indexer < countAllScripts; indexer += STRIDE)
|
||||
{
|
||||
// check to see if the name of the script we just found in our inventory matches any item in the list
|
||||
if (llList2String(lScripts,indexer + 2) == name) {
|
||||
|
||||
key targetUUID = llList2Key(lScripts,indexer + 3); // yup, the name matches, lets fetch the UUID
|
||||
integer pin = llList2Integer(lScripts,indexer ); // get the pin
|
||||
DEBUG("Sending " + name + " PIN:" + (string) pin + " UUID:" + (string) targetUUID);
|
||||
llRemoteLoadScriptPin(targetUUID,name,pin, TRUE,0); // and send it set to run
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
DEBUG("Updated " + (string) counter + " scripts named " + name);
|
||||
}
|
||||
}
|
||||
llOwnerSay("Done!");
|
||||
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
if (! TITLE) {
|
||||
llSetText("",<1,1,1>,1.0);
|
||||
}
|
||||
|
||||
// make a private chat channel
|
||||
comChannel = (((integer)("0x"+llGetSubString((string)llGetOwner(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF ) + UNIQ; // UNIQ is the private channel for this owner
|
||||
llListen(comChannel,"","","");
|
||||
llOwnerSay("Put non-running scripts into inventory and touch this to send them to remote prims.");
|
||||
llSetTimerEvent(CHECKIN);
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string msg)
|
||||
{
|
||||
list params = llParseString2List(msg,["^"],[]);
|
||||
string message = llList2String(params,0);
|
||||
integer pin = (integer) llList2String(params,1);
|
||||
|
||||
integer index;
|
||||
integer len = llGetListLength(lScripts);
|
||||
integer found = FALSE;
|
||||
|
||||
// CRU of CRUD process
|
||||
// try to find a script in that prim previously recorded. If found update
|
||||
for ( index = 0; index < len; index += STRIDE) {
|
||||
// primary key is composite of UUID of prim and script name
|
||||
if (llList2String(lScripts,index+2) == message && llList2Key(lScripts,index+3) == id) {
|
||||
// found a prim and script that has already checked in.
|
||||
DEBUG("Located script " + llList2String(lScripts,index+2));
|
||||
lScripts = llListReplaceList([pin,llGetUnixTime(),message,pin],lScripts,index,index+3);
|
||||
found = TRUE;
|
||||
index = len; // skip to end
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
|
||||
DEBUG("Adding script " + message);
|
||||
lScripts += pin; // the remote prim pin
|
||||
lScripts += llGetUnixTime(); // time stamp it
|
||||
lScripts += message; // remote prim name
|
||||
lScripts += id; // remote prim UUID
|
||||
}
|
||||
}
|
||||
|
||||
touch_start( integer what)
|
||||
{
|
||||
if (llDetectedKey(0) == llGetOwner()) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
// D of CRUD process
|
||||
// scan for missing checked-in prims and clean up the list
|
||||
timer()
|
||||
{
|
||||
integer len = llGetListLength(lScripts);
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
// look for late checkins, which means a script was stopped or a prim removed.
|
||||
// Every day or two plus a minute for message delays is good to prevent RAM from filling up,
|
||||
/// and still allows allows one missed message
|
||||
|
||||
integer timeago = llGetUnixTime() - llList2Integer(lScripts,len-STRIDE);
|
||||
DEBUG("Timeago " + (string) timeago);
|
||||
|
||||
if ( timeago > (CHECKIN*2 + MINUTE))
|
||||
{
|
||||
DEBUG("Have not heard from script named " + llList2String(lScripts,len-2) + ": Script named " + llKey2Name(llList2Key(lScripts,len-1)) );
|
||||
lScripts = llDeleteSubList(lScripts,len-STRIDE,len);
|
||||
len = llGetListLength(lScripts);
|
||||
} else
|
||||
len -= 3;
|
||||
}
|
||||
|
||||
len = llGetListLength(lScripts);
|
||||
if (TITLE) {
|
||||
llSetText((string) (len/3) + " scripts",<1,1,1>,1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user