Change font size
It is currently Sat Dec 15, 2018 1:03 pm

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 1   [ 3 posts ]
Author Message
 Post subject: BIG BUILD MOVER scripts
PostPosted: Sat Nov 08, 2008 12:37 pm 

Joined: Sat Nov 01, 2008 12:39 am
Posts: 7
The below is available boxed at Wright Plaza. The 4 scripts follow the instructions.

================================================================================
INSTRUCTIONS

If you have a complex build that is assembled from a rez box in SL, the scripts described here will allow you to store information about the components of the build on the components themselves. Then once the components of the build are transferred from SL to another grid, you can use the scripts described here in a rez box to reassemble the complex build on the new grid.

DISCLAIMERS

As of this writing (November 2008), not all content will transfer completely between SL and other grids. For example, the contents of objects (scripts, objects, animations, sounds, etc.) will not always transfer successfully, even when those contents are in the root prim of the linkset being transferred. Futhermore, contents of child prims of linksets will not be transferred at all. It is best therefore to "clean" any build you want to transfer by removing all contents from all prims in the linked sets you will be moving.

You must have full permissions on the rezz box you are using, as well as all of the build components, in order to move the build from SL to a new grid.

This export/import system is meant for experienced builders who have complex builds in SL that they want to move to new grids. You will need to be fairly comfortable with rezzers like Builders' Buddy in the LSL Library, or its clones (Rez Foo, Rez Faux, etc.). Please do not contact me for support in using this system. However, if you find bugs, please let me know.

NOTE: the scripts in the box have been set to "not running." Set the scripts to running before trying to use them.

INSTRUCTIONS

1) Get build ready for export. (use BUILD EXPORTER described below)

- take out your rezz box and rez your build.

- clean out the contents of the build components, if yous wish, since they won't transfer correctly anyhow. Clean out the contents of the rezz box.

- place the BIG BUILD EXPORTER COMPONENT script in the root prim of each of the components.

- place the BIG BUILD EXPORTER BASE script in the rezz box.

-LEFTCLICK the rezzbox



Your components are now ready to be exported. NOTE: you will see that the process has resulted in replacing the name and decription fields of the components with information about their positions and rotations in SL. DO NOT change that information!

-take each component of the build into your inventory individually (rightclick each linkset and choose "Take"). Make sure they are still "full perms" (rightclick inventory entry and pick "properties" and set them to full perms) and there has been a bug sometimes that results in resetting permissions when items are taken into inventory.

You can now delete the rezz box.

2) Save build components to hard drive. (use SECOND INVENTORY or similar utility)

3) Upload build components from hard drive to new grid. (use SECOND INVENTORY or similar utility)

4) Restore build on new grid.

You'll need to make copies of the importer scripts on the grid where you want to use them. Edit the scripts in SL, select all and copy the script. Paste into a text file if you can't have both SL and the other client running at the same time, or paste directly into a new script on the new grid. Save the script and rename it so that it matches the name in SL to avoid confusion. NOTE: copies of these scripts are also available in the Wright Plaza freebie garden on the OSgrid.

-Rez each component of the build individually on the new grid, and place the "BIG BUILD IMPORTER COMPONENT" script in the root prim. Take component back into inventory. Probably best to place the components in a new folder so you don't get them mixed up with the ones that don't have a script in them.

-Rez a cube to use as a rez box. Place the "BIG BUILD IMPORTER BASE" script within the rez box. Place the components containing the importer script inside the rez box with the importer base script.

-Leftclick the rez box and select BUILD to assemble the components. To move the build, leftclick rez box and select CLEAN then move the rez box and re-rezz the build. When you are done, leftclick rez box and pick DONE to remove the component scripts from the components.


=================================================================================
SL side exporter scripts (two scripts)


First script:
//start of code
//BIG BUILD EXPORTER BASE SCRIPT

//This script is made available for free use, and it must remain that way. Poppet McGimsie, November 2008.

//for SL side: Place this script in the rez box of the build to be exported from SL (clear out any scripts in the rez box first to avoid interference).

integer PRIMCHAN = 111;


default {



touch_start (integer total_number)
{



llShout(PRIMCHAN, llDumpList2String([ llGetPos(), llGetRot() ], "|"));

}
}

//end of code


Second script:
//start of code
//BIG BUILD EXPORTER COMPONENT script
//This script is made available for free use, and it must remain that way. Poppet McGimsie, November 2008.

//for SL side: Place this script in the root prim of each component of a build, to ready it for export from SL using a utility like Second Inventory.

integer PRIMCHAN = 111;


default
{

state_entry()
{


llListen(PRIMCHAN, "", NULL_KEY, "");
}



listen(integer iChan, string sName, key kID, string sText)
{

list lParams = llParseString2List(sText, [ "|" ], []);
vector vBase = (vector)llList2String(lParams, 0);
rotation rBase = (rotation)llList2String(lParams, 1);

vector vOffset = (llGetPos() - vBase) / rBase;
llSay(0,(string)vOffset);
rotation rRotation = llGetRot() / rBase;
llSay(0,(string)rRotation);


llSetObjectName( (string) vOffset);
llSetObjectDesc ( (string) rRotation);


}


}


//end of code

=================================================================================
OSgrid side importer scripts (two scripts)

Script 1:

//start code

//BIG BUILD IMPORTER BASE script

//based on Builder's Buddy from http://www.lslwiki.com/lslwiki/wakka.ph ... ldersBuddy

//Free to use and must remain so.

//Place this script in the rez box with the components (after adding component script to them) to assemble the imported build.
//leftclick rez box and select BUILD to assemble the components
//to move the build, leftclick rez box and select CLEAN then move the rez box and re-rezz the build.
//when you are done, leftclick rez box and pick DONE to remove the compoenent scripts from the components.


integer PRIMCHAN = 111;

string optBuild = "Build";
string optClean = "Clean";
string optDone = "Done";
string descBuild = " : Spawn inv. items and position them\n";
string descClean = " : De-Rez all pieces\n";
string descDone = " : Remove all BB scripts and make the parts permanent.\n";
string title = "";

list optionlist;


default {

state_entry()
{
llListen(112,"","","");
optionlist = [optBuild, optClean, optDone];

title += optBuild + descBuild;

title += optClean + descClean;
title += optDone + descDone;
}

touch_start (integer total_number) {







llDialog(llDetectedKey(0), title, optionlist, 112);



}


listen(integer channel, string name, key id, string message) {


if ( message == optBuild ) {
vector vThisPos = llGetPos();
rotation rThisRot = llGetRot();
integer i;
integer iCount = llGetInventoryNumber(INVENTORY_OBJECT);

//Loop through backwards (safety precaution in case of inventory change)
llOwnerSay("Rezzing build pieces...");
for( i = iCount - 1; i >= 0; i-- )
{
llRezObject(llGetInventoryName(INVENTORY_OBJECT, i), vThisPos, ZERO_VECTOR, rThisRot, PRIMCHAN);

}

llSay(0,"Still building -- please wait 20 sec until I say I'm done....");
llSleep(20);
llSay(0,"Positioning");
llShout(PRIMCHAN, "MOVE");
llSay(0,"Done!");

}


if ( message == optClean ) {
llShout(PRIMCHAN, "CLEAN");
return;
}
if ( message == optDone ) {
llShout(PRIMCHAN, "DONE");
//llDie();
llOwnerSay("Removing mover scripts.");
return;
}
}



on_rez(integer iStart)
{
PRIMCHAN = iStart;
llShout(PRIMCHAN, "CLEAN");
//Reset ourselves
//llResetScript();
}
}
//end code

Script 2:

//start code

//BIG BUILD IMPORTER COMPONENT script
//based on Builders' Buddy from http://www.lslwiki.com/lslwiki/wakka.ph ... ldersBuddy
//very very stripped down from the original

//this script is free to use and must remain so


integer PRIMCHAN = 111;



vector vOffset;
rotation rRotation;

key owner;
key controller;

vector vBase;
rotation rBase;




default
{
//////////////////////////////////////////////////////////////////////////////////////////
state_entry()
{


llListen(PRIMCHAN, "", NULL_KEY, "");
}

//////////////////////////////////////////////////////////////////////////////////////////
on_rez(integer iStart)
{



vBase = llGetPos();
rBase = llGetRot();



}

//////////////////////////////////////////////////////////////////////////////////////////
listen(integer iChan, string sName, key kID, string sCmd)
{




//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "MOVE" )
{



list posl = llParseString2List(llGetObjectName(), [], []);
list rotl = llParseString2List(llGetObjectDesc(), [], []);
llSay(0,(string)posl);
llSay(0,(string)rotl);
vOffset = (vector)llList2String(posl, 0);
rRotation = (rotation)llList2String(rotl, 0);



vector vDestPos = (vOffset * rBase) + vBase;
rotation rDestRot = rRotation * rBase;


integer i = 0;
vector vLastPos = ZERO_VECTOR;
while( (i < 5) && (llGetPos() != vDestPos) )
{
list lParams = [];

//If we're not there....
if( llGetPos() != vDestPos )
{
//We may be stuck on the ground...
//Did we move at all compared to last loop?
if( llGetPos() == vLastPos )
{
//Yep, stuck...move straight up 10m (attempt to dislodge)
lParams = [ PRIM_POSITION, llGetPos() + <0, 0, 10.0> ];
//llSetPos(llGetPos() + <0, 0, 10.0>);
} else {
//Record our spot for 'stuck' detection
vLastPos = llGetPos();
}
}


integer iHops = llAbs(llCeil(llVecDist(llGetPos(), vDestPos) / 10.0));
integer x;
for( x = 0; x < iHops; x++ ) {
lParams += [ PRIM_POSITION, vDestPos ];
}
llSetPrimitiveParams(lParams);

i++;
}


llSetRot(rDestRot);
return;
}


if( sCmd == "DONE" )
{
//We are done, remove script

llRemoveInventory(llGetScriptName());
return;
}


if( sCmd == "CLEAN" )
{


//Clean up
llDie();
return;
}



}



}



//end code


Top
 Profile  
 
 Post subject: Re: BIG BUILD MOVER scripts
PostPosted: Sat Feb 14, 2009 6:15 am 

Joined: Thu Jan 15, 2009 1:40 pm
Posts: 18
Hello,

I have a problem with rezz box scipts. I use the following one which works on sl but not on opensim tunk.
The problem occurs when I want to build the structure. The component script became deaf. And the move command
from control script never reach the component script :cry:

Does somebody experienced that, and is there a solution ?

Thanks.

Firts script


///////////////////////////////////////////////////////////////////////////////
// Builders' Buddy 1.6 (Base Prim)
// by Newfie Pendragon, March 2006
//
// This script is distributed with permission that it may be used in
// any way, or may be further modified/included in resale items.
// HOWEVER, if this script is used as part of a for-sale product,
// it is required that appropriate credit be given to Newfie for
// the script (or portions used in derivatives). That's a fair price
// in exchange for unlimited use of this script, dontcha think?
//
// SL Forum thread and new versions found here:
// http://forums.secondlife.com/showthread.php?t=96792
///////////////////////////////////////////////////////////////////////////////
//
// Script Purpose & Use
//
// Functions are dependent on the "component script"
//
// QUICK USE:
// - Drop this script in the Base.
// - Drop the "Component" Script in each building part.
// - Touch your Base, and choose RECORD
// - Take all building parts into inventory
// - Drag building parts from inventory into Base Prim
// - Touch your base and choose BUILD
//
// OTHER COMMANDS from the Touch menu
// - To reposition, move/rotate Base Prim choose POSITION
// - To lock into position (removes scripts) choose DONE
// - To delete building pieces: choose CLEAN
//
///////////////////////////////////////////////////////////////////////////////
//
// History
//
// v1.0 - 20060328 - Newfie Pendragon
// - Original Version
// v1.1 - 20060331 - Kalidor Lazarno
// - Added a Dialog Engine to the base script
// v1.5 - 20060612 - Androclese Antonelli
// - Added a random number generator to the dialog engine to elimintate
// problems with multiple BB boxes cross-talking
// - Added a timer to the listen command to put it asleep after 10sec.
// - Added a Menu Description
// - Added n "creator" flag so the owner could use the same object with full
// menu options and only a single flag change
// - Added an "ingroup" flag to enable/disable the same group use function
// - Non-Admin usage cleans the inventory items as they spawn
// v1.6 - 20060624 - Newfie Pendragon
// - Added active repositioning (building moves as the base piece moves)
// - Added "Reset" Option to unlink parts from base temporarily
// - Modified creator flag to automatically set based if owner is creator
// - Minor changes to improve code readability (for those learning LSL)

///////////////////////////////////////////////////////////////////////////////
// User Variables
///////////////////////////////////////////////////////////////////////////////

// Set to TRUE to allow group members to use the dialog menu
// Set to FALSE to disallow group members from using the dialog menu
integer ingroup = TRUE;

//Name each option-these names will be your button names.
string optRecord = "Record";
string optReset = "Reset";
string optBuild = "Build";
string optPos = "Position";
string optClean = "Clean";
string optDone = "Done";

//Menu option descriptions
string descRecord = " : Record the position of all parts\n";
string descReset = " : Forgets the position of all parts\n";
string descBuild = " : Spawn inv. items and position them\n";
string descPos = " : Reposition the parts to a new location\n";
string descClean = " : De-Rez all pieces\n";
string descDone = " : Remove all BB scripts and make the parts permanent.\n";

//How often (in seconds) to check for change in position when moving
float fMovingRate = 0.25;

//How long to sit still before exiting active mode
float fStoppedTime = 30.0;

//Minimum amount of time (in seconds) between movement updates
float fShoutRate = 0.25;

// Channel used by Base Prim to talk to Component Prims
// This channel must be the same one in the component script
// A negative channel is used because it elimited accidental activations
// by an Avatar talking on obscure channels
integer PRIMCHAN = -19730611;

///////////////////////////////////////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE.... NO.. NOT EVEN THEN
///////////////////////////////////////////////////////////////////////////////
integer MENU_CHANNEL;
integer MENU_HANDLE;
key agent;
key objectowner;
integer group;
string title = "";
list optionlist = [];
integer bMoving;
vector vLastPos;
rotation rLastRot;
integer iListenTimeout = 0;

//To avoid flooding the sim with a high rate of movements
//(and the resulting mass updates it will bring), we used
// a short throttle to limit ourselves
announce_moved()
{
llShout(PRIMCHAN, "MOVE " + llDumpList2String([ llGetPos(), llGetRot() ], "|"));
llResetTime(); //Reset our throttle
vLastPos = llGetPos();
rLastRot = llGetRot();
return;
}


///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
default {
///////////////////////////////////////////////////////////////////////////////
changed(integer change) {
if(change & CHANGED_OWNER)
llResetScript();
}

///////////////////////////////////////////////////////////////////////////////
state_entry () {
//Use which menu?
if ( llGetCreator() == llGetOwner() ) {
//Display all options
optionlist = [optPos, optClean, optDone, optRecord, optReset, optBuild];
title = optRecord + descRecord;
title += optReset + descReset;
title += optBuild + descBuild;
title += optPos + descPos;
title += optClean + descClean;
title += optDone + descDone;

} else {
//Display limited options
optionlist = [optBuild, optPos, optDone];
title = optBuild + descBuild;
title += optPos + descPos;
title += optDone + descDone;
}

//Record our position
vLastPos = llGetPos();
rLastRot = llGetRot();

}

///////////////////////////////////////////////////////////////////////////////
touch_start (integer total_number) {
group = llDetectedGroup(0); // Is the Agent in the objowners group?
agent = llDetectedKey(0); // Agent's key
objectowner = llGetOwner(); // objowners key
// is the Agent = the owner OR is the agent in the owners group
if ( (objectowner == agent) || ( group && ingroup ) ) {
iListenTimeout = llGetUnixTime() + 10;
MENU_CHANNEL = llFloor(llFrand(-99999.0 - -100));
MENU_HANDLE = llListen(MENU_CHANNEL,"","","");
llDialog(agent, title, optionlist, MENU_CHANNEL);
llSetTimerEvent(fShoutRate);
}
}

///////////////////////////////////////////////////////////////////////////////
listen(integer channel, string name, key id, string message) {
if ( message == optRecord ) {
llOwnerSay("Recording positions...");
list lpos = llGetPrimitiveParams([PRIM_POSITION, PRIM_ROTATION]);

//llShout(PRIMCHAN, "RECORD " + llDumpList2String([ llGetPos(), llGetRot() ], "|"));
llShout(PRIMCHAN, "RECORD " + llDumpList2String(lpos, "|"));
return;
}
if( message == optReset ) {
llOwnerSay("Forgetting positions...");
llShout(PRIMCHAN, "RESET");
return;
}
if ( message == optBuild ) {
vector vThisPos = llGetPos();
rotation rThisRot = llGetRot();
integer i;
integer iCount = llGetInventoryNumber(INVENTORY_OBJECT);

//Loop through backwards (safety precaution in case of inventory change)
llOwnerSay("Rezzing build pieces...");
for( i = iCount - 1; i >= 0; i-- )
{
llRezObject(llGetInventoryName(INVENTORY_OBJECT, i), vThisPos, ZERO_VECTOR, rThisRot, PRIMCHAN);
if ( llGetCreator() != llGetOwner() )
llRemoveInventory(llGetInventoryName(INVENTORY_OBJECT, i));
}

llOwnerSay("Building and Positioning");
list lpos = llGetPrimitiveParams([PRIM_POSITION, PRIM_ROTATION]);
llShout(PRIMCHAN, "MOVE " + llDumpList2String(lpos, "|"));
return;
}
if ( message == optPos ) {
llOwnerSay("Positioning");
//vector vThisPos = llGetPos();
//rotation rThisRot = llGetRot();
list lpos = llGetPrimitiveParams([PRIM_POSITION, PRIM_ROTATION]);
//llShout(PRIMCHAN, "MOVE " + llDumpList2String([ vThisPos, rThisRot ], "|"));
llShout(PRIMCHAN, "MOVE " + llDumpList2String(lpos, "|"));
return;
}
if ( message == optClean ) {
llShout(PRIMCHAN, "CLEAN");
return;
}
if ( message == optDone ) {
llShout(PRIMCHAN, "DONE");
//llDie();
llOwnerSay("Removing mover scripts.");
return;
}
}

///////////////////////////////////////////////////////////////////////////////
moving_start()
{
if( !bMoving )
{
bMoving = TRUE;
llSetTimerEvent(0.0); //Resets the timer if already running
llSetTimerEvent(fMovingRate);
announce_moved();
}
}

///////////////////////////////////////////////////////////////////////////////
timer() {
//Were we moving?
if( bMoving )
{
//Did we change position/rotation?
if( (llGetRot() != rLastRot) || (llGetPos() != vLastPos) )
{
if( llGetTime() > fShoutRate ) {
announce_moved();
}
}
} else {
//Have we been sitting long enough to consider ourselves stopped?
if( llGetTime() > fStoppedTime )
bMoving = FALSE;
}

//Open listener?
if( iListenTimeout != 0 )
{
//Past our close timeout?
if( iListenTimeout <= llGetUnixTime() )
{
iListenTimeout = 0;
llListenRemove(MENU_HANDLE);
}
}

//Stop the timer?
if( (iListenTimeout == 0) && ( !bMoving ) )
{
llOwnerSay("Stopping Timer");
llSetTimerEvent(0.0);
}
}

///////////////////////////////////////////////////////////////////////////////
on_rez(integer iStart)
{
//Reset ourselves
llResetScript();
}
}


-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



Second script:

///////////////////////////////////////////////////////////////////////////////
// Builders' Buddy 1.7 (Component Pieces)
//
// by Newfie Pendragon, March 2006
//
// This script is distributed with permission that it may be used in
// any way, or may be further modified/included in resale items.
// HOWEVER, if this script is used as part of a for-sale product,
// it is required that appropriate credit be given to Newfie for
// the script (or portions used in derivatives). That's a fair price
// in exchange for unlimited use of this script, dontcha think?
//
// SL Forum thread and new versions found here:
// http://forums.secondlife.com/showthread.php?t=96792
///////////////////////////////////////////////////////////////////////////////

// INSTRUCTIONS
// This is the *Component Piece* half of the Builders' Buddy system.
// Drop it into each 'piece' of the building. Drop the Base Prim Script
// into the prim that will be the container/box that will be used to
// store the building once completed. It can be in each individual
// prim, but if you link as much as possible (and put the script in the link
// set), it'll be much more neighbourly and less strain on the sim.
//
// QUICK USE:
// - Drop this script in the Base.
// - Drop the "Component" Script in each building part.
// - Touch your Base, and choose RECORD
// - Take all building parts into inventory
// - Drag building parts from inventory into Base Prim
// - Touch your base and choose BUILD
//
// OTHER COMMANDS
// - To reposition, move/rotate Base Prim Type: /12345 MOVE
// - To lock into position (removes scripts) Type: /12345 DONE
// - To delete building pieces: /12345 CLEAN
///////////////////////////////////////////////////////////////////////////////
// History
//
// v1.0 - 20060328 - Newfie Pendragon - Original Version
// v1.5 - 20060612 - Androclese Antonelli
// - (See base script for details)
// v1.6 - 20060624 - Newfie Pendragon
// - Added active repositioning (pieces move as the base piece moves)
// - Pieces use WarpPos technique to instantanetly move large distances
// - Pieces no longer move until the the "Record" option has been used
// at least once
// - Pieces will not move if base is not same owner as the pieces
// - Pieces no longer 'bounce' when hitting the ground
// v1.7 - 20060821 - Correction for non-zero rotation (thanks Ed44 Gupta!)
///////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////
// Configurable Settings
float fTimerInterval = 0.25; //Time in seconds between movement 'ticks'
integer PRIMCHAN = -19730611; //Channel used by Base Prim to talk to Component Prims;
// This must match in both scripts

//////////////////////////////////////////////////////////////////////////////////////////
// Runtime Variables (Dont need to change below here unless making a derivative)
vector vOffset;
rotation rRotation;
integer bNeedMove;
vector vDestPos;
rotation rDestRot;
integer bRecorded = FALSE;


////////////////////////////////////////////////////////////////////////////////
string first_word(string In_String, string Token)
{
//This routine searches for the first word in a string,
// and returns it. If no word boundary found, returns
// the whole string.
if(Token == "") Token = " ";
integer pos = llSubStringIndex(In_String, Token);

//Found it?
if( pos >= 1 )
return llGetSubString(In_String, 0, pos - 1);
else
return In_String;
}

////////////////////////////////////////////////////////////////////////////////
string other_words(string In_String, string Token)
{
//This routine searches for the other-than-first words in a string,
// and returns it. If no word boundary found, returns
// the an empty string.
if( Token == "" ) Token = " ";

integer pos = llSubStringIndex(In_String, Token);

//Found it?
if( pos >= 1 )
return llGetSubString(In_String, pos + 1, llStringLength(In_String));
else
return "";
}

////////////////////////////////////////////////////////////////////////////////
do_move()
{
integer i = 0;
vector vLastPos = ZERO_VECTOR;
while( (i < 5) && (llGetPos() != vDestPos) )
{
list lParams = [];

//If we're not there....
if( llGetPos() != vDestPos )
{
//We may be stuck on the ground...
//Did we move at all compared to last loop?
if( llGetPos() == vLastPos )
{
//Yep, stuck...move straight up 10m (attempt to dislodge)
lParams = [ PRIM_POSITION, llGetPos() + <0, 0, 10.0> ];
//llSetPos(llGetPos() + <0, 0, 10.0>);
} else {
//Record our spot for 'stuck' detection
vLastPos = llGetPos();
}
}

//Try to move to destination
//Upgraded to attempt to use the llSetPrimitiveParams fast-move hack
//(Newfie, June 2006)
integer iHops = llAbs(llCeil(llVecDist(llGetPos(), vDestPos) / 10.0));
integer x;
for( x = 0; x < iHops; x++ ) {
lParams += [ PRIM_POSITION, vDestPos ];
}
llSetPrimitiveParams(lParams);
//llSleep(0.1);
i++;
}

//Set rotation
llSetRot(rDestRot);
}


//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
default
{
//////////////////////////////////////////////////////////////////////////////////////////
state_entry()
{
//Open up the listener
llListen(PRIMCHAN, "", NULL_KEY, "");
}

//////////////////////////////////////////////////////////////////////////////////////////
on_rez(integer iStart)
{
//Set the channel to what's specified
if( iStart != 0 )
{
PRIMCHAN = iStart;
state reset_listeners;
}
}

//////////////////////////////////////////////////////////////////////////////////////////
listen(integer iChan, string sName, key kID, string sText)
{
llOwnerSay(sName+" "+sText);
string sCmd = llToUpper(first_word(sText, " "));

if( sCmd == "RECORD" )
{
sText = other_words(sText, " ");
list lParams = llParseString2List(sText, [ "|" ], []);
vector vBase = (vector)llList2String(lParams, 0);
rotation rBase = (rotation)llList2String(lParams, 1);

vOffset = (llGetPos() - vBase) / rBase;
rRotation = llGetRot() / rBase;
bRecorded = TRUE;
llSetObjectDesc((string) vOffset+"|"+(string) rRotation);
llOwnerSay("Recorded position offset "+(string) vOffset+" rotation "+(string) rRotation);
return;
}

//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "MOVE" )
{
//Don't move if we've not yet recorded a position
if( !bRecorded ) return;

//Also ignore commands from bases with a different owner than us
//(Anti-hacking measure)
if( llGetOwner() != llGetOwnerKey(kID) ) return;


//Calculate our destination position
sText = other_words(sText, " ");
list lParams = llParseString2List(sText, [ "|" ], []);
vector vBase = (vector)llList2String(lParams, 0);
rotation rBase = (rotation)llList2String(lParams, 1);
// Decode vOffset and rRotation
list lpos=llParseString2List(llGetObjectDesc(),["|"],[]);
vOffset=(vector) llList2String(lpos,0);
rRotation=(rotation) llList2String(lpos,1);
llOwnerSay("position offset "+(string) vOffset+" rotation "+(string) rRotation);
//Calculate our destination position
vDestPos = (vOffset * rBase) + vBase;
rDestRot = rRotation * rBase;

//Turn on our timer to perform the move?
if( !bNeedMove )
{
llSetTimerEvent(fTimerInterval);
bNeedMove = TRUE;
}
return;
}

//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "DONE" )
{
//We are done, remove script
llRemoveInventory(llGetScriptName());
return;
}

//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "CLEAN" )
{
//Clean up
llDie();
return;
}

//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "RESET" )
{
llResetScript();
llSetObjectDesc("");
}
}

//////////////////////////////////////////////////////////////////////////////////////////
timer()
{
//Turn ourselves off
llSetTimerEvent(0.0);

//Do we need to move?
if( bNeedMove )
{
//Perform the move and clean up
do_move();
bNeedMove = FALSE;
}
return;
}
}

//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
state reset_listeners
{
//////////////////////////////////////////////////////////////////////////////////////////
state_entry()
{
state default;
}
}


Top
 Profile  
 
 Post subject: Re: BIG BUILD MOVER scripts
PostPosted: Thu Oct 01, 2009 11:55 pm 
Furious Typer
User avatar

Joined: Tue Aug 18, 2009 1:24 pm
Posts: 64
Location: Netherlands
here's a scrip that maybe works for builders....

http://www.osgrid.org/elgg/pg/pages/view/57132/

_________________
۩____________________________________________________________________۩
Website: http://verwijs.wordpress.com
Website: http://verwijs-pc.nl (dutch)
Twitter: http://www.twitter.com/OpenSimFan/
Osgrid Profile: http://www.osgrid.org/elgg/pg/profile/Christopher.MetalFan


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 3 posts ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net