LlRemoteLoadScriptPin
De DigiWiki.
(Différences entre les versions)
Ligne 1 : | Ligne 1 : | ||
- | ===Exemple 1=== | + | ====Exemple 1==== |
====Script copier==== | ====Script copier==== | ||
<lsl> | <lsl> | ||
Ligne 30 : | Ligne 30 : | ||
} | } | ||
</lsl> | </lsl> | ||
- | ===Exemple 2=== | + | ====Exemple 2==== |
<lsl> | <lsl> | ||
- | // This example will be of two linked prims | + | // This example will be of two linked prims |
+ | |||
default | default | ||
{ | { | ||
Ligne 55 : | Ligne 56 : | ||
</lsl> | </lsl> | ||
+ | ====Exemple 3==== | ||
<lsl> | <lsl> | ||
// Simple pin configuration for allowing other scripts to update the internal script | // Simple pin configuration for allowing other scripts to update the internal script | ||
- | |||
// Use an arbitrary PIN | // Use an arbitrary PIN | ||
+ | |||
integer SCRIPT_PIN = 7589273495872; | integer SCRIPT_PIN = 7589273495872; | ||
Ligne 70 : | Ligne 72 : | ||
</lsl> | </lsl> | ||
- | |||
<lsl> | <lsl> | ||
// Simple update script to update the given script name to each of the child-prims in a linked set | // Simple update script to update the given script name to each of the child-prims in a linked set |
Version du 30 décembre 2014 à 02:00
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); } }
Exemple 3
// 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); } }
// 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(); } }