|
Little Ming
The Invisible Man
Join date: 31 Mar 2005
Posts: 84
|
06-30-2006 06:12
I'm currently working on a build where there's a lot of "symmetry" which requires me to use copy/paste a lot for the XYZ fields on prims for pos/rotation and sometimes size(though size rarely). Granted I can do the copy/paste manually, but when I have to apply it for 500+ objects over a 128x128 meter area... You can understand why it's a pain in the butt.
What I need is a 1 script that uses say to call out the prims settings, and a second script that listens for them and applies them. The first script should send a delete command that removes both scripts when finished.
As I'm still in the basics of learning scripting, this is beyond my abilities to code. Any help would be appreciated, thank you.
|
|
Danielle Bradley
Registered User
Join date: 26 May 2006
Posts: 21
|
06-30-2006 09:54
Put something like this in the "master object". integer CHAN = 123; // can use any channel, but please don't use 0 unnecessarily
default { touch_start(integer total_number) { string MyPos = (string)llGetPos(); string MyRot = (string)llGetRot(); string MySize = (string)llGetScale(); llShout(CHAN, "size = " + MySize); // llShout works for a 100m radius llShout(CHAN, "position = " + MyPos); llShout(CHAN, "rotation = " + MyRot); llShout(CHAN, "delete "); // the space after 'delete' is to make parsing easier for the listener llRemoveInventory(llGetScriptName()); } }
Put something like this in the "slave", with whatever offset(s) you need. And be sure you back up both scripts before they delete themselves.  integer CHAN = 123; vector PositionOffset = <0,0,3>; // make this whatever you want
default { state_entry() { llListen(CHAN, "", NULL_KEY, ""); } listen(integer number, string name, key id, string msg) { integer start = 0; integer end = llSubStringIndex(msg, " ") - 1; string ParsedCmd = llGetSubString(msg, start, end); start = llSubStringIndex(msg, "<"); // start will be -1 if not found, // but in that case, we don't care about about this substring end = -1; // here -1 means till the end of the string string ParsedData = llGetSubString(msg, start, end); if (ParsedCmd == "size") { llSetScale((vector)ParsedData); } else if (ParsedCmd == "rotation") { llSetRot((rotation)ParsedData); } else if (ParsedCmd == "position") { llSetPos((vector)ParsedData + PositionOffset); } else if (ParsedCmd == "delete") { llRemoveInventory(llGetScriptName()); } } // end listen handler
} // end state default
|
|
Little Ming
The Invisible Man
Join date: 31 Mar 2005
Posts: 84
|
06-30-2006 15:34
Awesome! Ty so much! Thanks for taking the time to comment the script too for me 
|