LlRemoteLoadScriptPin

De DigiWiki.

(Différences entre les versions)
Ligne 1 : Ligne 1 :
 +
===Exemple 1===
====Script copier====
====Script copier====
<lsl>
<lsl>
-
//Copy a script to the second prim
+
// Copy a script to the second prim
-
integer PIN=1341134;
+
-
default {
+
integer PIN = 1341134;
-
     state_entry() {
+
 
-
         llRemoteLoadScriptPin( llGetLinkKey(2), "some script", PIN, TRUE, 0xBEEEEEEF );
+
default
 +
{
 +
     state_entry()
 +
    {
 +
         llRemoteLoadScriptPin( llGetLinkKey(2), "some script", PIN, TRUE, 0xBEEEEEEF);
     }
     }
}
}
Ligne 13 : Ligne 17 :
Simple script used for setting the pin for a prim, so you can later send scripts to it with llRemoteLoadScriptPin.
Simple script used for setting the pin for a prim, so you can later send scripts to it with llRemoteLoadScriptPin.
<lsl>
<lsl>
-
//Child Prim PIN setter
+
// Child Prim PIN setter
-
integer PIN=1341134;
+
-
default {
+
integer PIN = 1341134;
-
     state_entry() {
+
 
-
         llOwnerSay(llGetObjectName()+" : "+(string)llGetKey()+" is ready to accept a describer script using the agreed upon PIN.");
+
default
 +
{
 +
     state_entry()
 +
    {
 +
         llOwnerSay(llGetObjectName() + " : " + (string)llGetKey() + " is ready to accept a describer script using the agreed upon PIN.");
         llSetRemoteScriptAccessPin(PIN);
         llSetRemoteScriptAccessPin(PIN);
     }
     }
}
}
</lsl>
</lsl>
 +
===Exemple 2===
<lsl>
<lsl>
// This example will be of two linked prims  
// This example will be of two linked prims  
Ligne 43 : Ligne 51 :
     {
     {
         llSetRemoteScriptAccessPin(165);
         llSetRemoteScriptAccessPin(165);
 +
    }
 +
}
 +
</lsl>
 +
 +
<lsl>
 +
// Simple pin configuration for allowing other scripts to update the internal script
 +
 +
// Use an arbitrary PIN
 +
integer SCRIPT_PIN = 7589273495872;
 +
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        llSetRemoteScriptAccessPin(SCRIPT_PIN);
 +
    }
 +
}
 +
</lsl>
 +
 +
===Exemple 3===
 +
<lsl>
 +
// Simple update script to update the given script name to each of the child-prims in a linked set
 +
 +
integer SCRIPT_PIN = 7589273495872;
 +
string SCRIPT_TO_UPDATE = "updated_script";
 +
   
 +
UpdatePrims()
 +
{
 +
    integer num_prims = llGetNumberOfPrims();
 +
   
 +
    integer i;
 +
    for (i = 2; i <= num_prims; i++)
 +
    {
 +
        key prim_key = llGetLinkKey (i);
 +
        llOwnerSay("Updating prim #" + (string)(i));
 +
        llRemoteLoadScriptPin (prim_key, SCRIPT_TO_UPDATE, SCRIPT_PIN, TRUE, 0);
 +
    }
 +
    llOwnerSay("Updated " + (string)(num_prims - 1) + " prims");
 +
}
 +
 +
default
 +
{
 +
    state_entry()
 +
    {
 +
        llListen (9, "", llGetOwner(), "update");
 +
    }
 +
   
 +
    listen(integer channel, string name, key id, string message)
 +
    {
 +
        UpdatePrims();
     }
     }
}
}
</lsl>
</lsl>

Version du 30 décembre 2014 à 01:59

Sommaire

Exemple 1

Script copier

// Copy a script to the second prim
 
integer PIN = 1341134;
 
default
{
    state_entry()
    {
        llRemoteLoadScriptPin( llGetLinkKey(2), "some script", PIN, TRUE, 0xBEEEEEEF);
    }
}

Pin setter

Simple script used for setting the pin for a prim, so you can later send scripts to it with llRemoteLoadScriptPin.

// Child Prim PIN setter
 
integer PIN = 1341134;
 
default
{
    state_entry()
    {
        llOwnerSay(llGetObjectName() + " : " + (string)llGetKey() + " is ready to accept a describer script using the agreed upon PIN.");
        llSetRemoteScriptAccessPin(PIN);
    }
}

Exemple 2

// This example will be of two linked prims 
default
{
    touch_start(integer total_number)
    {
        llGiveInventory(llGetLinkKey(2), "foo"); 
        llRemoteLoadScriptPin(llGetLinkKey(2), "foo", 165, TRUE, 0);
    }
}
 
// What this is does is send the script "foo" and the  'pin' 165 to prim 2 and set the script running when touched.
// The receiver script ~/HAS/~ to be in the other prim before you touch it otherwise it will say illegal transfer
 
// The receiver script will have 
default
{
    state_entry()
    {
        llSetRemoteScriptAccessPin(165);
    }
}
// Simple pin configuration for allowing other scripts to update the internal script 
 
// Use an arbitrary PIN
integer SCRIPT_PIN = 7589273495872;
 
default
{
    state_entry()
    {
        llSetRemoteScriptAccessPin(SCRIPT_PIN); 
    }
}

Exemple 3

// Simple update script to update the given script name to each of the child-prims in a linked set 
 
integer SCRIPT_PIN = 7589273495872; 
string SCRIPT_TO_UPDATE = "updated_script";
 
UpdatePrims()
{
    integer num_prims = llGetNumberOfPrims(); 
 
    integer i; 
    for (i = 2; i <= num_prims; i++)
    {
        key prim_key = llGetLinkKey (i); 
        llOwnerSay("Updating prim #" + (string)(i)); 
        llRemoteLoadScriptPin (prim_key, SCRIPT_TO_UPDATE, SCRIPT_PIN, TRUE, 0);
    }
    llOwnerSay("Updated " + (string)(num_prims - 1) + " prims"); 
}
 
default
{
    state_entry()
    {
        llListen (9, "", llGetOwner(), "update");
    }
 
    listen(integer channel, string name, key id, string message)
    {
        UpdatePrims(); 
    }
}
Outils personnels
donate
Google Ads