Easy moving, rotating, rezzing and picking up of HUGE builds
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
03-06-2006 04:11
I made this script so I could pick up my 232m tall tree and rez it back anywhere in a snap. It works great: you put it in each linkset root prim of your build, then you just need to touch any of them to "collapse" the whole build. Then just drag-select the mashup of objects, right-click and Take. When rezzing it back, just touch any of its linksets again, and it'll take back shape by "expanding"  while it's collapsed, you can easily select all the objects and move / rotate it, those modifications are taken into account when it expands back. If you mess up, you can shout /13579 kill to delete the build. When the build is in place shout /13579 freeze to remove the collapse script from each object and save on lag. // Collapse-Expand Distributed system // Makes it easy to work with LARGE builds (over 64m in size, up to sim size) // // Author: Jesrad Seraph // Feel free to modify and redistribute as long as you allow free modification and redistribution
vector orig; vector from; string collmsg; integer handle; integer collapsed; integer channel = 13579;
default { state_entry() { orig = ZERO_VECTOR; from = ZERO_VECTOR; collapsed = FALSE; handle = llListen(channel, "", "", ""); }
touch_start(integer total_number) { if (llDetectedKey(0) != llGetOwner()) return; if ((from != ZERO_VECTOR) && !collapsed) { llOwnerSay("Already collapsing"); return; } if (collapsed) { llOwnerSay("Expanding..."); llListenRemove(handle); llShout(channel, "expand"); from = llGetPos(); vector dest = from + (orig * llGetRot()); do { llSetPos(dest); } while (llVecDist(llGetPos(), dest) > 0.002); handle = llListen(channel, "", "", ""); from = ZERO_VECTOR; orig = ZERO_VECTOR; collapsed = FALSE; return; } llOwnerSay("Collapsing all at " + (string)llGetPos() + "\n" + (string)( (llGetCenterOfMass() * <0,0,1>) - llGround(ZERO_VECTOR) ) + " m over the ground"); llListenRemove(handle); collmsg = "retract" + (string)llGetPos(); llShout(channel, collmsg); orig = ZERO_VECTOR; from = llGetPos(); llSleep(5.0); collapsed = TRUE; handle = llListen(channel, "", "", ""); } listen(integer ch, string n, key id, string msg) { if ( (id != llGetOwner()) && (llGetOwnerKey(id) != llGetOwner()) ) return; if (llGetSubString(msg, 0, 6) == "retract") { if (collapsed) return; llListenRemove(handle); from = (vector)llDeleteSubString(msg, 0, 6); if (from == ZERO_VECTOR) return; collmsg = msg; orig = (llGetPos() - from) / llGetRot(); llSetTimerEvent(2.0); } else if (msg == "freeze") { llShout(channel, "freeze"); llRemoveInventory(llGetScriptName()); } else if (msg == "kill") { llShout(channel, "kill"); llSleep(0.5); llDie(); } else if (msg == "expand") { if (collapsed) { from = llGetPos(); vector dest = from + (orig * llGetRot()); do { llSetPos(dest); } while (llVecDist(llGetPos(), dest) > 0.002); llListenRemove(handle); handle = llListen(channel, "", "", ""); from = ZERO_VECTOR; orig = ZERO_VECTOR; collapsed = FALSE; } } } timer() { llSetTimerEvent(0.0); collapsed = TRUE; llShout(channel, collmsg); do { llSetPos(from); } while (llVecDist(llGetPos(), from) > 0.002); llSleep(4.0); handle = llListen(channel, "", "", ""); } }
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
Starchaser Webb
Artist / Builder
Join date: 23 Feb 2006
Posts: 30
|
03-06-2006 04:38
Wow! That's cool! I'll have to try that with the 60 meter tall tree that I made. I had to make the foliage and the lower trunk and branches into seperate linksets because it was so tall, and had limited the height there because any more semed unwieldy to adjust.
Thank you!
|
Teddy Wishbringer
Snuggly Bear Cub
Join date: 28 Nov 2004
Posts: 208
|
03-06-2006 07:13
Yeah, like WOW! Thanks.. I've been loathing moving, just because my 50x60M workshop at 700M took forever to build the way I wanted it and I couldn't justify paying that much for the other similar product. I'll be anxious to try this out tonight.
Kudos to you for making it public!
|
nimrod Yaffle
Cavemen are people too...
Join date: 15 Nov 2004
Posts: 3,146
|
03-06-2006 09:54
Is this like the script that HD designs uses in their houses? I'm easily amused and I rezed my house, tore it apart, then made the script put it back together all day. Going to try this out when I get home, thanks a ton!
_____________________
"People can cry much easier than they can change." -James Baldwin
|
Adman Drake
Registered User
Join date: 9 Feb 2006
Posts: 96
|
03-06-2006 14:38
For a newbie scripter, can you explain how this works?
When the root prim has a "listen" block, does that apply to each individual child prim as well?
It appears that when you touch the object for it to retract, it removes the "listen" handle, and then does a shout, saying where to retract to. Who is listening for this shout? The child prims? In that case, do they need scripts? (Obviously not...)
Thanks for any info you can provide. Looks like a great script! I'll have to play around with it some more.
Adman
|
Plastic Spoonhammer
Registered User
Join date: 9 Feb 2006
Posts: 20
|
03-06-2006 22:04
You're the man, Joseph =) Sweet contribution! And might I add that the non-vehicle movement script you posted a while ago has been the inspiration for a similar-but-different project of mine that's still in the works. I'll likely post it when it's working and polished up.
-P. Spoonhammer
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
03-06-2006 22:14
From: Adman Drake For a newbie scripter, can you explain how this works?
When the root prim has a "listen" block, does that apply to each individual child prim as well? Nope, "listen" events only apply to scripts that actively listen by calling llListen. The script I posted only goes into the root prim of each object that makes up the build, hence only root prims of each object can listen. From: Adman Drake It appears that when you touch the object for it to retract, it removes the "listen" handle, and then does a shout, saying where to retract to. Who is listening for this shout? The child prims? In that case, do they need scripts? (Obviously not...) All the other objects are listening for it.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
03-06-2006 22:16
I don't know about anyone else, but I have been hitting a frustrating SL bug since yesterday where I cannot Take a build, I only end up with a few of the objects and the remaining objects don't show the "Take" option anymore until I re-select them  [Edit]Who's Joseph ? 
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
Plastic Spoonhammer
Registered User
Join date: 9 Feb 2006
Posts: 20
|
03-06-2006 22:43
From: Jesrad Seraph [Edit]Who's Joseph ?  Only thing I can think of is that my sleep-deprived brain decided to merge Jesrad and Seraph to get Jesaph, and then morphed that into Joseph. 8 hours of fiddling with xml configs for Maven2/Continuum + 3 hours of tedious JUnit test coding + 3 hours of LSL hacking hasn't been kind to me today =P
|
Adman Drake
Registered User
Join date: 9 Feb 2006
Posts: 96
|
03-07-2006 10:10
From: Jesrad Seraph Nope, "listen" events only apply to scripts that actively listen by calling llListen. The script I posted only goes into the root prim of each object that makes up the build, hence only root prims of each object can listen.
Ok... So your script goes in the root prim of each object, where multiple objects make up "a build". Then, when you do the "collapse" operation, every root prim of the build collapses down, but the children of each root do NOT collapse down. So you get big chunks... Makes sense! Thanks for the explanation. I've never done any multi-object building, so it didn't quite jive at first... Adman
|
Laukosargas Svarog
Angel ?
Join date: 18 Aug 2004
Posts: 1,304
|
03-07-2006 10:59
Nice one. I've been using a similar script to move my huge builds around, I created it to transfer Orwood Hall, bridge and castle from Orwood to Bora Bora. It works a treat. But I've run across problems when prim centres are underground. llSetPos seems to fail when a prim centre intersects or falls below the ground plane. Currently I work around this by creating a seperate rezzer for rocks and other ground prims and have it rez them above gound so I can drag them down to bury them by hand.
if prim centres go underground the llSetPos loop never completes, it might be an idea to check the position is changing between calls to llSetPos ?
_____________________
Geometry is music frozen...
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
03-07-2006 11:45
From: someone if prim centres go underground the llSetPos loop never completes, it might be an idea to check the position is changing between calls to llSetPos ? I ran into that problem with a house pack/unpack script I wrote for someone. You can get stuck under other conditions too. Trying to go above 768m (or whatever the limit is), trying to go off the edge of a sim where there isn't an adjoining sim... those were two that I remember I hit in my testing. Trying to go underground will get you stuck in an infinite loop. Trying to go off-world... I don't remember what happened, maybe the object got returned. Which is also not good. So yes, I agree, you need some safety checks in a script like this.
|