|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
02-28-2007 15:05
This is a request for a working example of the subject functions. I have read the available entries in this forum and been unable to understand them. I have read the entries in the various wikis and they are even worse. I have the requirement to load a newer version of a script to 121 child prims in an object which is under development. There will ultimately be a need to update the script as the development progresses. Thanks for any help.
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
02-28-2007 16:40
I dropped you an example in-world, it's a little tree thing I made ages ago that rezes a branch when clicked then loads a script into it to do the same again. Check inside the object_rez on the "grow script" in the trunk and the script inside the branch in it's inventory.
|
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
03-01-2007 01:46
Many thanks for the Tree object. I will have to study it and adapt it of course, especially as my objects are already rezzed and linked. That fact should make it a little easier. Thanks again.
|
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
03-01-2007 07:26
A further thought after examination. Where did the PIN code 2901 come from and does it have to be embedded in the child prim or in your case the Branch object?
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-01-2007 12:10
It's just a number I picked and it has to be set in the branch in the example (since it's the prim the running script is to be loaded into). The idea is that you set the PIN in the prim you want to load a script into, then a script in another prim can load a running script using that PIN - it prevents objects loading scripts into prims they're not allowed to.
|
|
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
|
03-01-2007 12:27
AJ, this tree sounds clever and interesting. I'd be most appreciative if you could provide me with a copy as well. 
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-01-2007 15:49
While I had it out I repurposed the tree thing into an object that sends out a harmless lightning-bolt type thing using the same technique. Since it's a simpler example I sent you that instead. If anyone else wants to see it I've left it free to copy on my land (it's the 5m tall white oval called "Snake dispenser"  , go here or see my picks. Or IM me and I'll drop you a copy when I'm online. What the script demonstrates is recursive rezzing (the same thing used by grey goo attacks - I'd be warning everyone to be really careful if the grey goo fence wasn't in place). What happens is the dispenser rezzes a segment, which set it's remote script loading PIN when the script in it was compiled, then passes that segment a copy of itself (the segment) and remote loads the script which then pauses for a second (to avoid being wrongly picked up by the fence) before repeating the rez and give that the dispenser just performed. The segments are set to temp on rez so disappear after roughly a minute giving a moving "snake" (moving roughly the same way as the snake in the old Snake games) of about 60 segments length. It continues until it hits the edge of the world or a no-script or no-build parcel. Although it's totally harmless (temporary, little server load, phantom) this will annoy role-players, and probably some other people too, so please think about where you're playing with it.
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-01-2007 16:00
Main script (this goes in the dispenser and must be called "Snake script"  : default { state_entry() { // Pick random rotation within bounds float x_rot = llFrand(180) - 90; float y_rot = llFrand(180) - 90; vector eul = <x_rot, y_rot, 0>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul) * llGetRot(); // Wait so not picked up by grey goo fence llSleep(1); // Rez next segment llRezObject("Snake body", llGetPos() + llRot2Up( llGetRot() )*2, ZERO_VECTOR, quat, 1); } touch(integer num_detected) { // Pick random rotation within bounds float x_rot = llFrand(180) - 90; float y_rot = llFrand(180) - 90; vector eul = <x_rot, y_rot, 0>; eul *= DEG_TO_RAD; rotation quat = llEuler2Rot(eul) * llGetRot(); // Rez next segment llRezObject("Snake body", llGetPos() + llRot2Up( llGetRot() )*2, ZERO_VECTOR, quat, 1); } object_rez(key id) { // Give a copy of the snake segment to rezzes segment llGiveInventory(id, "Snake body"); // Load script into new segment llRemoteLoadScriptPin(id, "Snake script", 2901, TRUE, 0); } } Segment script (this must be compiles inside an object called "Snake body" and that object then placed inside the dispenser, the script may have any name): default { state_entry() { // Set pin for loading scripts llSetRemoteScriptAccessPin(2901); } } Note that the "segments" are 4 meters tall and dimpled halfway up from the bottom to allow easy placement.
|