Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Replicator

Al Bravo
Retired
Join date: 29 Jun 2004
Posts: 373
01-26-2005 05:22
Is a replicator now possible? These asset server problems got me thinking. If I want to backup an object offline, I would need all the scripts, prim_params, textures by face, texture scaling/rotation by face and inventory data. What if I dropped a 'backup' script in each prim of an object that gathered all that and chatted it to a main backup script? The main script gathers all of it and formats/dumps it to chat, xml-rpc or email to be stored as text.

To replicate, you copy/paste the backup data to a notecard and feed it into a replicator, preload the replicator with necessary scripts, textures,sounds,landmarks,whatever is on the 'resources' list for that object. The replicator creates each prim from a set of preset prims that each contain a base 'replicate' script. That replicate script accepts information about prim_params, texture, placement, linking, and accepts inventory gives.

The only thing I notice right off is the lack of get/set permissions. So, that would have to be done by hand. Still pretty labor intensive I admit.
_____________________
Kris Ritter
paradoxical embolism
Join date: 31 Oct 2003
Posts: 6,627
01-26-2005 05:40
Ooh! Replicator! I want one of those!

*glances towards magic box that makes food from thin air*

"Coffee, black! Full English Breakfast for one!"

Not that kinda replicator, huh?

okies.

*leaves thread and goes to a breakfast bar*
Willow Zander
Having Blahgasms
Join date: 22 May 2004
Posts: 9,935
01-26-2005 05:42
Breakfast!!! Its nearly 2pm!!!!

BTW.. I am just trolling Kris here sowwie... I know nothing about scripting, cept for particles!
_____________________
*I'm not ready for the world outside...I keep pretending, but I just can't hide...*




<3 Giddeon's <3
Kris Ritter
paradoxical embolism
Join date: 31 Oct 2003
Posts: 6,627
01-26-2005 05:45
From: Willow Zander
Breakfast!!! Its nearly 2pm!!!!


I'm not a morning person :p

Btw, slightly ontopic but not particularly helpful, I'm sure someone posted a replicator script or something here recently. There's certainly been talk of it and they certainly exist. Beyond that, I dunno much about it. Sowwy.
Eggy Lippmann
Wiktator
Join date: 1 May 2003
Posts: 7,939
01-26-2005 06:11
Yeah, its possible, they've been around since forever. Well, since we got llGetPrimitiveParams, at least.
Al Bravo
Retired
Join date: 29 Jun 2004
Posts: 373
01-26-2005 06:14
Anybody selling? Including a palette of 'replicator' enabled prims to start new builds from.
_____________________
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
01-26-2005 07:18
Here's the simplest data feed, Al. I realize you're probably getting sick of me, but hell:

CODE
integer prim_constant = PRIM_TYPE_BOX; 
integer texture_constant = ALL_SIDES;
//Add constant here or retrieve it for data formatting

list parameters = []; //Generates list of parameters

touch_start(integer total_number)
{
if(prim_type)
parameters = llGetPrimitiveParams([PRIM_TYPE, prim_constant]);
//Special prim settings (cut, adv. cut, twist, top shear, etc.)

else
llSay(0,"No prim constant selected.");
//Error checker. Since I've not toyed with llGetPrimitiveParams enough to be positive on
//getting a prim's PRIM_TYPE from scratch, I'll leave this here for those that know how to
//do it properly. My guess is llGetPrimitiveParams([PRIM_TYPE]); may do it.

parameters += "break";

parameters += llGetPrimitiveParams([PRIM_TEXTURE, texture_constant]);
//Texture Settings on all faces as a whole (this one assumes all sides to be same texture)

parameters += "second break";

parameters += llGetPrimitiveParams([PRIM_SIZE]);
//Size of prim

//Now, all we need is llGetPos() and llGetRot()
parameters += llGetPos();
parameters += llGetRot();

//... which we can use later.
}

on_rez(integer total_number)
{
//Instead of a text dump, let's instead return to our old world position and/or type.
//I'll include the text dump option as well, commented out
list special = llList2List(parameters,0,llListFindList(parameters,(list)"break") - 1);
list texture = llList2List(parameters,llListFindList(parameters,(list)"break") + 1,llListFindList(parameters,(list)"second break") - 1);
list size = llList2List(parameters,llListFindList(parameters, llGetListLength(parameters) - 3, llGetListLength(parameters) - 3);
vector pos = llList2Vector(parameters, llGetListLength(parameters) - 2);
vector rot = llList2Rot(parameters, llGetListLength(parameters) - 1);

llSetPrimitiveParams([PRIM_TYPE, prim_constant, special, PRIM_TEXTURE, texture, PRIM_SIZE, size]);
// Sets our old parameters

if(pos.x < 256 && pos.y < 256 && pos.x > 0 && pos.y > 0)
while(pos != llGetPos())
llSetPos(pos);

llSetPos(pos); //Correction for the occasional loop error

llSetRot(rot); //Fortunately, no loop or correction needed here.

//Or, if you want a text dump, do this instead:
//integer listLength = llGetListLength(parameters);
//integer i;
//for(i = 0; i < listLength; i++)
//llWhisper(0,llList2String(parameters,i));
//llWhisper(0,(string)pos);
//llWhisper(0,(string)rot);

//Now, one last call. Let's remove our script.
llRemoveInventory(llGetScriptName());
}


That should do what you want in a single prim, but it's untested (wrote it all here), so feel free to mess with it a bit. Alternately, you can add llRemoteScriptPin calls or link calls to replicate complex shapes.
_____________________
---
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
01-26-2005 13:48
jeff, who's going to get sick of a scripter givign away scripts that should be worth 1000 of L :D Beside your geniusl.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
01-26-2005 13:59
Easy - get me talking about politics or religion sometime. :rolleyes:
_____________________
---
Donnie Donovan
Resident Slax0r
Join date: 4 Jun 2004
Posts: 120
01-26-2005 18:42
getting a syntax error on line 6, column 0.
_____________________
Donnie Donovan | [email]donniedonovan@gmail.com[/email]
Owner, .::The High Society::. Night Club & Poker Room
Owner, Laka Lounge and Resort


... elevate your mind to mine ...
If you don't like my fire then don't come around, cause I'm gonna burn one down.
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
01-27-2005 13:26
Here's my version :)

CODE

// This is a list of the constants
// that represent the properties of a prim,
// save texture properties. Texture properties
// are separate so that each side can be accounted
// for properly.
// If more prim constants are added to LSL, just add them to
// this list.
list PRIM_CONSTANTS = [
PRIM_MATERIAL,
PRIM_PHANTOM,
PRIM_PHYSICS,
// Position is commented out because
// it is more of a property of the environment
// the prim is in, not the primitive itself.
//PRIM_POSITION,
PRIM_ROTATION,
PRIM_SIZE,
PRIM_TEMP_ON_REZ,
PRIM_TYPE // Note: no comma.
];

// These constants are specific to each side
// of the primitive.
list PRIM_TEXTURE_CONSTANTS = [
PRIM_TEXTURE,
PRIM_COLOR,
PRIM_BUMP_SHINY // Note: no comma.
];

// To get past the 10 meter limitation of
// llSetPrimitiveParams and llSetPos
setPos(vector position) {
while (llVecDist(position, llGetPos()) > 0) {
llSetPos(position);
}
}

list save() {
// Store primitive data:
list primitiveData;
integer i;
integer numConstants = llGetListLength(PRIM_CONSTANTS);
for (i = 0; i < numConstants; i++) {
integer constant = llList2List(PRIM_CONSTANTS, i, i);
list data = llGetPrimitiveParams([constant]);
primitiveData += constant;
primitiveData += data;
}

// Store texture data:
integer numTextureConstants = llGetListLength(PRIM_TEXTURE_CONSTANTS);
// Number of sides of the prim:
integer numSides = llGetNumberOfSides();
for (i = 0; i < numTextureConstants; i++) {
integer constant = llList2List(PRIM_TEXTURE_CONSTANTS, i, i);
integer side;
for (side = 0; side < numSides; side++) {
list sideData = llGetPrimitiveParams([constant, side]);
primitiveData += constant;
primitiveData += side;
primitiveData += sideData;
}
}
}

restore(list data) {
// The data stored from the save() function is already in the same
// form as what is passed to llSetPrimitveParams.
llSetPrimitiveParams(data);

// Account for the 10 meter positioning limitation, if the
// data specifies the position.
integer positionIndex = llListFindList(data, [PRIM_POSITION]);
if (positionIndex != -1) {
vector position = llList2Vector(data, positionIndex + 1);
setPos(position);
}
}

list savedInfo;
default {
on_rez(integer param) {
restore(savedInfo);
}

touch_start(integer numTouchers) {
savedInfo = save();

// Printout:
integer i;
integer len = llGetListLength(savedInfo);
for (i = 0; i < len; i++) {
// Comment this line out to disable.
llSay(0, llList2String(savedInfo, i);
}
}
}
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm