Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Giant Building Tools now Open Source

sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
01-14-2007 01:12
You can pick up completely open source versions of my giant building objects in Chessport. All contributions/suggestions welcome and I'll incorporate into the main build if appropriate and of course credit you.


The giant sphere builder; block pyramid builder and room builder scripts are posted below.
I've also posted the instructions for users of the builders which may help you understand how it all works.

There are other things required like textures and so on, you should be able to work these out from the script, or you can visit SLX or Chessport and get the complete objects for L$1. Or IM me and I'll drop you the complete objects for free.

I am working on some diagrams to help explain how these work, please visit Chessport to see these (under the giant pyramid at the telehub)


I have not yet rationalised the code to use only one 'block' so please make sure you use the correct block code for each.


WHY AM I OPEN SOURCING:
1. To improve your scripting skills.
If you read the script and see what it does and then, importantly, make changes and see their effects then you will learn something.
Second life with more scripters is more interesting for everyone.

2. To improve my scripting skills.
You may make suggestions; correct my mistakes; make improvements and so on.
Every time this happens I'll learn a load of stuff, for which I am grateful in advance.

3. To create better building tools.
With your suggestions, encouragement and help I will improve these tools and make new ones available :
a) A single builder object, using a single 'Block', which can make Spheres; Rooms (cuboids); Pyramids; Block Pyramids
b) New build structures. Suggestions include: Mazes; Domes; Circular flooring; Giant Lobsters (!); Scalable buildings

4. To create a better job.
I was earning about L$5000 in a good week from selling these tools. This is not a real-world income and so I have a full time job doing well paid but relatively boring data shuffling. I hope that some people will think my scripting skills (and programming skillls more generally) are worth paying real life rates to work within Second Life. This seems to be a good way to advertise myself, IM me if you have a realistic offer to do something interesting involving scripting in SL (or C#; Python; Linux &c. for that matter!)


Thanks for your time.

sparti Carroll
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Giant Sphere Builder : Block script
01-14-2007 01:13
// PUT THIS SCRIPT in a (small) prim and drop the prim into your builder object
// BUILD SCRIPT follows

CODE

// Child Block for Globe based on latest Wave one
// Based on child for roombuilder
// updated so only passes on commands if general channel was address
// split out shape and appearance messages
// physical sets whether phys on go
// UNIFIED with Wave block

//Simple OpenSource Licence (I am trusting you to be nice)
//1. PLEASE SEND ME UPDATES TO THE CODE
//2. You can do what you want with this code and object including selling it in other objects and so on.
//You can sell it in closed source objects if you must, but please try to send any updates or
//improvements back to me for possible inclusion in the main trunk of development.
//3. You must always leave these instructions in any object created; notecard written; posting to
//any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
//already requested!)
//4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
//5. You can add and edit things below =THE LINE= but please try to keep it all making sense.
//Thank you for your co-operation
//sparti Carroll

integer FLAGdebug = FALSE;

integer FLAGlabel = FALSE;

integer c_listen = 1273574601; // first listen on this, until channel command
integer c_talkto_master = 5612594; // say position e.g. back on this channel
integer c_block_ALL = 12345; // this is id used when all children must obey
integer n_endpoint = 99987;
integer n_nomove = 152635123; // will only respond to delete after this

integer my_id;
integer my_listener;

integer FLAGchanged;

// Block
list blocks_to_link;

// Delayed rez
vector prim_pos;
list prim_params;
rotation prim_rot;
string prim_texture;
float prim_texture_scale;
vector prim_size;
vector prim_colour;
integer prim_physical;
integer prim_repeat; // flag whether to repeat commands (if > 80m from source block)


// *** FUNCTIONS ***

set_position(vector targetpos) {
while (llVecDist(llGetPos(),targetpos) > 0.001) llSetPos(targetpos);}

set_shape(vector size,vector pos, rotation rot,vector cut,vector topsize) {
// See http://secondlife.com/badgeo/wakka.php?wakka=llSetPrimitiveParams
// Set shape of this primitive: width;height;pos;rot refer to this specific wall, NOT the overall collection making the room
prim_pos = pos;
set_position(prim_pos);
prim_rot = rot;
prim_params = [PRIM_TYPE, PRIM_TYPE_BOX,
0, cut, 0.0, <0.0, 0.0, 0.0>,topsize, <0.0, 0.0, 0.0>,
PRIM_SIZE,size];
prim_size = size;
if (FLAGdebug) {
llOwnerSay("Set shape based on size=" + (string)size + " pos=" + (string)pos + " rot=" + (string)rot + " cut=" + (string)cut + " topsize=" + (string)topsize);
}
FLAGchanged = TRUE;
}

set_appearance(string texture,float texture_scale,vector colour,integer physical,integer repeat) {
prim_texture = texture;
prim_texture_scale = texture_scale;
prim_colour = colour;
prim_physical = physical;
prim_repeat = repeat;
if (FLAGdebug) {
llOwnerSay("Set appearance based on txt=" + texture + " texture_scale=" + (string)texture_scale + " colour=" + (string)colour + " physical=" + (string)physical + " repeat=" + (string)repeat);
}
FLAGchanged = TRUE;
}


do_go() {
// call this again, for reset calls... but won't do anything normally
llSetPrimitiveParams([PRIM_PHYSICS,FALSE]);
if (my_id == n_endpoint) llSetPrimitiveParams([PRIM_PHANTOM,TRUE]);
set_position(prim_pos);
llSetPrimitiveParams(prim_params);
llSetRot(prim_rot);
// set our texture on all sides
llSetTexture(prim_texture,ALL_SIDES);
if (prim_texture_scale == 0.0) prim_texture_scale = 1;
float x_scale = prim_size.x / prim_texture_scale;
float y_scale;
if (my_id != n_endpoint) {
y_scale = prim_size.z / prim_texture_scale;
} else {
y_scale = prim_size.y / prim_texture_scale;
}
llScaleTexture(x_scale,y_scale,ALL_SIDES); // scale texture appropriately
llSetColor(prim_colour,ALL_SIDES);
if (prim_physical == 1) {
llSetPrimitiveParams([PRIM_PHYSICS,TRUE]);
}
}

set_links() { integer i;
integer num_params = llGetListLength(blocks_to_link);
key k;
for (i = 1; i < num_params; i++) { // we don't link ourself to ourself, so start 1 not 0
k = (key)llList2String(blocks_to_link,i);
llCreateLink(k,TRUE); } if (FLAGdebug) {
llOwnerSay("Linking finished");
}
}


// STATES

default {
on_rez(integer start_id) { // the object number i am
my_id = start_id;
my_listener = llListen(c_listen, "", "", ""); // we will be told what to do by parent object
if (FLAGlabel) {
llSetText("child " + (string)start_id,<1.0,1.0,1.0>,1.0); // remove any label from parent
} else { llSetText("",<0,0,0>,0);
}
FLAGchanged = FALSE;
llSetStatus(STATUS_DIE_AT_EDGE,TRUE);
}
listen( integer channel, string name, key id, string message ) {
list cmdline = llParseString2List(message,["^"],[]);
integer block_id = llList2Integer(cmdline,0);
integer FLAGall = block_id == c_block_ALL;
if (!FLAGall && (block_id != my_id)) {
return;
}
string cmd = llList2String(cmdline,1);
if (cmd == "delete" || cmd == "deleteall") {
if (FLAGall && prim_repeat) llWhisper(c_listen,(string)c_block_ALL + "^" + cmd);
if (cmd == "deleteall" || (my_id != n_endpoint && my_id != n_nomove)) llDie();
}
else if (cmd == "freeze") {
if (FLAGall && prim_repeat) llWhisper(c_listen,(string)c_block_ALL + "^freeze");
if (my_id != n_endpoint) llRemoveInventory(llGetScriptName());
}
else if (cmd == "nomove") {
if (FLAGall && prim_repeat) llWhisper(c_listen,(string)c_block_ALL + "^nomove");
if (my_id != n_endpoint) my_id = n_nomove;
}
else if (cmd == "report") {
// say position and rotation back to master
vector pos = llGetPos();
rotation rot = llGetRot();
llShout(c_talkto_master,(string)pos + "^" + (string)rot);
}
else if (cmd == "go") {
if (FLAGchanged) {
if (FLAGdebug) llSay(0, "Doing GO for block " + (string)my_id);
FLAGchanged = FALSE;
if (FLAGall && prim_repeat) {
llWhisper(c_listen,(string)c_block_ALL + "^go");
}
do_go();
}
}
else if (cmd == "posgo") {
// move immediately to position
vector goto = (vector)llList2String(cmdline,2);
set_position(goto);
}
else if (cmd == "changed") {
if (FLAGall && prim_repeat) llWhisper(c_listen,(string)c_block_ALL + "^changed");
if (my_id != n_endpoint) FLAGchanged = 1;
}
else if (cmd == "shape") {
vector size = (vector)llList2String(cmdline,2);
vector pos = (vector)llList2String(cmdline,3);
rotation rot = (rotation)llList2String(cmdline,4);
vector cut = (vector)llList2String(cmdline,5);
vector topsize = (vector)llList2String(cmdline,6);
set_shape(size,pos,rot,cut,topsize);
}
else if (cmd == "appearance") {
string texture = llList2String(cmdline,2);
float texture_scale = (float)llList2String(cmdline,3);
vector colour = (vector)llList2String(cmdline,4);
integer physical = (integer)llList2String(cmdline,5);
integer repeat = (integer)llList2String(cmdline,6);
set_appearance(texture,texture_scale,colour,physical,repeat);
}
else if (cmd == "keys") { // should only be received by ids which are base for their surface (not just id 1 but id 1 on each surface
blocks_to_link += llList2List(cmdline,3,-1); // add more keys
}
else if (cmd == "link") { // we have been told keys already
if (FLAGdebug) {
llOwnerSay("Link received - this will take 1s per item");
llOwnerSay("Processing list " + (string)blocks_to_link);
}
if (llGetPermissions() & PERMISSION_CHANGE_LINKS) {
set_links();
} else { llRequestPermissions(llGetOwner(),PERMISSION_CHANGE_LINKS);
} }
} // end listen()
run_time_permissions(integer perm) {
if (perm & PERMISSION_CHANGE_LINKS) {
set_links();
}
}

} // end state run_object
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Giant Sphere Builder : Builder Object script
01-14-2007 01:17
// Sphere Builder script. Put this in your Sphere Builder object
// Which then contains the block (above)
// IM me if you need help
// sparti Carroll

CODE

//Sphere Builder
//17apr06 sC based on Room Builder 1.0
//19apr06 sC fixed demo problem
//21apr06 sC updated to change size of tiles if smaller sphere
//26apr06 sC added colour
//26apr06 sC new calculation method, exact fits
//29apr06 sC version 0.8 fixed
//1.0 sC Open Source version (same as 0.8d)
// Decision, force to nearest EVEN number of tiles per orbit
// ZZZ todo update help and instructions notecard

// ZZZ make the preferred (used) tilesize configurable to smaller than 10.0
// ZZZ option to specify start fraction (of sphere) and end... only goes to nearest tile tho,

// ZZZ rez around start and end appropriately

//Simple OpenSource Licence (I am trusting you to be nice)
//1. PLEASE SEND ME UPDATES TO THE CODE
//2. You can do what you want with this code and object including selling it in other objects and so on.
//You can sell it in closed source objects if you must, but please try to send any updates or
//improvements back to me for possible inclusion in the main trunk of development.
//3. You must always leave these instructions in any object created; notecard written; posting to
//any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
//already requested!)
//4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
//5. You can add and edit things below =THE LINE= but please try to keep it all making sense.
//Thank you for your co-operation
//sparti Carroll


integer FLAGdebug = FALSE;

string version_number = "1.0";
string my_version;
string my_version_demo_1;
string my_version_demo_2;
integer demo_timeout = 120;

integer FLAGdemomode = 0;

integer c_listen = 33;
integer h_listen;
integer c_block_master = 1273574601;
integer c_block_comms;
integer c_block_ALL = 12345;
string my_label = "Globe Maker ";

// Block
string block_name = "Block";

float room_radius;
integer room_slices;
integer room_slices_doubled;
integer room_around;
float room_thickness;
float room_scale;
// calculated during rez
float room_theta; // angle of orbit step (around Z-axis)
float room_phi; // angle between slices
integer room_slice_start;
integer room_slice_end;
integer room_around_start;
integer room_around_end;
// ring flag only produce rings, so no taper and no rotate to poles
integer room_ring;
string room_texture;

//colours
vector room_colour_start;
vector room_colour_end;
vector room_colour_rand;
integer room_colour_floor;
integer room_colour_slice_first;


key k_sparti = "88e0094c-f95e-4e12-86c1-3c6fa6c92285";

// globals
key k_owner;
vector startpoint;
vector startoffset = <0,0,0>; // position of centre of base


// *** FUNCTIONS ***

reset() {
k_owner = llGetOwner();
startpoint = llGetPos();
my_version = my_label + version_number;
my_version_demo_1 = my_version + " DEMO\n Sit on Box then\n Touch for Random Globe Demonstration";
my_version_demo_2 = my_version + " DEMO\n Touch when finished looking at Demo\n Will finish after " + (string)demo_timeout + "s automatically";
//defaults
room_radius = 6;
room_slices = 8;
room_slice_start = 0;
room_slice_end = room_slices;
room_around = 9;
room_around_start = 0;
room_around_end = room_around;
room_thickness = 0.05;
room_scale = 10.0;
room_texture = "texture";
room_colour_start = <0,0,0>;
room_colour_end = <255,255,255>;
room_colour_rand = <0,0,0>;
room_colour_slice_first = 1;
room_colour_floor = 0;
room_ring = 0;
}

// Functions
announce_help() {
llOwnerSay("Owner say '/" + (string)c_listen + " help' for instructions.");
}

set_position(vector targetpos) {
while (llVecDist(llGetPos(),targetpos) > 0.001) llSetPos(targetpos);
}

master_say(list ls) { // need to shout and include secret word
string msg = llDumpList2String(ls,"^");
if (c_block_comms != 0) {
llShout(c_block_comms,msg);
}
}

do_cmd_all(string msg) {
master_say([c_block_ALL,msg]);
}

integer calc_npieces() {
// how many pieces required for completely fitting object with room_radius and max piece dimension 10m ?
float reqd = PI / llAtan2(5.0,room_radius);
if (reqd < 2) reqd = 3;
return (integer)(0.9999 + reqd);
}

integer rez_face(vector posit,string par) {
integer i;
integer j;
integer code = 1000;
float rez_x;
float rez_y;
float rez_radius = 0.9;
integer reqd = calc_npieces();
integer half_reqd = (integer)(((float)reqd + 1.0) / 2.0);
if (par == "auto") {
// set to minimum automatically
room_slices = half_reqd;
room_around = reqd;
}
room_slices_doubled = 2 * room_slices;
room_theta = PI / room_slices_doubled;
room_phi = TWO_PI / room_around;
if (room_slices_doubled < reqd || room_around < reqd) {
llOwnerSay("You need to use at least " + (string)reqd + " around and " + (string)half_reqd + " slices");
if (par != "force") return 0;
}
integer total_items = room_slices * room_around * 2;
integer approx_time = (integer)((float)total_items * 0.7);
string time_estimate;
if (approx_time < 90) {
time_estimate = (string)approx_time + " seconds";
} else {
time_estimate = (string)((approx_time + 60)/ 60) + " minutes";
}
llSay(0,"OK. I need to make " + (string)room_slices_doubled + " slices of " + (string)room_around + " items. A total of " + (string)total_items + " items. This will take approximately " + time_estimate + " if the sim isn't too busy.");
float room_delta = TWO_PI / room_around;
for (i=0; i<room_slices_doubled; i++) {
if (i >= room_slice_start && i <= room_slice_end) {
for (j=0; j<room_around; j++) {
if (j >= room_around_start && j <= room_around_end) {
rez_x = rez_radius * llCos(room_delta * j);
rez_y = rez_radius * llSin(room_delta * j);
llRezObject(block_name,posit + <0,0,1.5> + (i * <0.1,0.1,0.1>) + <rez_x,rez_y,0>, <0,0,0>, <0,0,0,0>, code);
code += 1;
}
}
}
}
return 1;
}

vector calc_colour(integer sn,integer around) {
// slice 0,dir 0 is nearest above equator. Slice 0,dir 1 is nearest below equator
// ZZZ use dir
vector colour = room_colour_start;
if (room_colour_slice_first == 1) {
colour += (room_colour_end - room_colour_start) *(float)((sn * room_around)+around)/ (room_slices_doubled * room_around);
} else {
colour += (room_colour_end - room_colour_start) *(float)((around * room_slices_doubled)+sn)/ (room_slices_doubled * room_around);
}
colour.x += llFrand(room_colour_rand.x);
colour.y += llFrand(room_colour_rand.y);
colour.z += llFrand(room_colour_rand.z);
if (room_colour_floor == 1) {
if (room_colour_start.x < room_colour_end.x) {
if (colour.x < room_colour_start.x) colour.x == room_colour_start.x;
else if (colour.x > room_colour_end.x) colour.x == room_colour_end.x;
} else {
if (colour.x > room_colour_start.x) colour.x == room_colour_start.x;
else if (colour.x < room_colour_end.x) colour.x == room_colour_end.x;
}
if (room_colour_start.y < room_colour_end.y) {
if (colour.y < room_colour_start.y) colour.y == room_colour_start.y;
else if (colour.y > room_colour_end.y) colour.y == room_colour_end.y;
} else {
if (colour.y > room_colour_start.y) colour.y == room_colour_start.y;
else if (colour.y < room_colour_end.y) colour.y == room_colour_end.y;
}
if (room_colour_start.z < room_colour_end.z) {
if (colour.z < room_colour_start.z) colour.z == room_colour_start.z;
else if (colour.z > room_colour_end.z) colour.z == room_colour_end.z;
} else {
if (colour.z > room_colour_start.z) colour.z == room_colour_start.z;
else if (colour.z < room_colour_end.z) colour.z == room_colour_end.z;
}
}
return colour / 256;
}

spin_face(vector sphere_center) {
// new version, with exact fit
key texture = llGetInventoryKey(room_texture);
integer code = 1000;
integer i;
integer j;
float room_theta_half = room_theta / 2.0;
float room_phi_half = room_phi / 2.0;
float tile_height;
if (room_ring == 0) tile_height = 2 * room_radius * llTan(room_theta_half);
else tile_height = 2 * room_radius * llSin(room_theta_half);
// mu is step angle to rotate vertical piece by for successive steps
float mu = room_theta;
rotation rot_mu = llEuler2Rot(<-mu,0,0>);
rotation rot_slice = llEuler2Rot(<-mu/2,0,0>);
// theta is angle up from equator of baseline
float theta = 0;
//float slice_base_radius = room_radius * llCos(theta);
float slice_base_radius = room_radius;
float base_width = 2.0 * slice_base_radius * llTan(room_phi_half);
// counts up slices
vector tile_pos;
rotation use_rot;
for (i=0; i<room_slices; i++) {
//float slice_top_radius = room_radius * llCos(theta + room_theta);
float slice_top_radius = room_radius * llCos(theta + room_theta);
float mid_radius = slice_base_radius - ((slice_base_radius - slice_top_radius) / 2.0);
float mid_height = room_radius * llSin(theta + room_theta_half);
float top_width = 2.0 * slice_top_radius * llTan(room_phi_half);
float piece_taper = top_width / base_width;
vector offset_slice = <0,0,mid_height>;
float rot_around = 0;
integer sn_top = room_slices + i;
integer sn_bot = room_slices - (i + 1);
for (j=0; j<room_around; j++) {
float sin_delta = llSin(rot_around);
float cos_delta = llCos(rot_around);
vector offset_around = <mid_radius * sin_delta,mid_radius * cos_delta,0>;
vector use_colour = calc_colour(sn_top,j);
vector use_size;
vector taper_control;
if (room_ring == 0) {
taper_control = <piece_taper,1.0,0>;
use_size = <base_width,room_thickness,tile_height>;
} else {
taper_control = <1.0,1.0,0>;
use_size = <(base_width + top_width) / 2.0,room_thickness,tile_height>;
}
if (FLAGdebug) llOwnerSay("sn_top=" + (string)sn_top + ", sn_bot=" + (string)sn_bot + ", j=" + (string)j);
if (sn_top >= room_slice_start && sn_top <= room_slice_end && j >= room_around_start && j <= room_around_end) {
tile_pos = sphere_center + offset_slice + offset_around;
if (room_ring == 0) {
use_rot = -rot_slice * llEuler2Rot(<0,0,PI-rot_around>);
} else {
use_rot = llEuler2Rot(<0,0,PI-rot_around>);
}
master_say([code,"shape",use_size,tile_pos,use_rot,<0,1,0>,taper_control]);
master_say([code,"appearance",texture,room_scale,use_colour,0,0]);
code++;
}
use_colour = calc_colour(sn_bot,j);
// taper right way around
if (sn_bot >= room_slice_start && sn_bot <= room_slice_end && j >= room_around_start && j <= room_around_end) {
if (room_ring == 0) {
use_rot = rot_slice * llEuler2Rot(<0,0,PI+rot_around>);
} else {
use_rot = llEuler2Rot(<0,0,PI+rot_around>);
}
use_rot *= llEuler2Rot(<0,PI,0>);
tile_pos = sphere_center - offset_slice + offset_around;
master_say([code,"shape",use_size,tile_pos,use_rot,<0,1,0>,taper_control]);
master_say([code,"appearance",texture,room_scale,use_colour,0,0]);
code++;
}
// prepare for next step around
rot_around += room_phi;
}
rot_slice *= rot_mu;
slice_base_radius = slice_top_radius;
base_width = top_width;
theta += room_theta;
}
}

// Block Related Functions
integer do_rez(string par) { // instantiate the objects
// first freeze or delete any existing objects
do_cmd_all("delete");
vector posit;
posit = startpoint + startoffset + <0,0,room_radius>; // ending up baseposition
if (posit.x + room_radius > 254 || posit.y + room_radius > 254) {
llSay(0,"Too close to sim border for that.");
return 0;
}
// calculate how many prims we need, how many per side and their positions, build prim list describing all of this and sizes<x,y,z> and pos,rot
vector appearat = startpoint;
if (rez_face(appearat,par)) {
c_block_comms = c_block_master; // switch channel after rezzing
spin_face(posit);
do_cmd_all("go");
llSay(0, "Are you sitting comfortably ? Moving to center of structure");
if (!FLAGdebug) set_position(posit);
return 1;
} else {
return 0;
}
}

do_colour(string par,string colpar) {
if (par == "start" || par == "end" || par == "random") {
if (llGetSubString(colpar,0,0) != "<") {
colpar = "<" + colpar + ">";
}
vector colvec = (vector)colpar;
if (par == "start") room_colour_start = colvec;
else if (par == "end") room_colour_end = colvec;
else if (par == "random") room_colour_rand = colvec;
llSay(0, "Colour " + par + " set to " + colpar);
} else if (par == "floor") {
if (colpar == "1" || colpar == "0") room_colour_floor = (integer)colpar;
else room_colour_floor = 1 - room_colour_floor;
llSay(0, "Colour floor, now " + (string)room_colour_floor);
} else if (par == "dir") {
if (colpar == "1" || colpar == "0") room_colour_slice_first = (integer)colpar;
else room_colour_slice_first = 1 - room_colour_slice_first;
llSay(0, "Colour dir, now " + (string)room_colour_slice_first);
}
}

do_around(string par, string par2) {
if (par == "start") {
integer try = (integer)par2;
if (try >= 0 && try <= room_around_end) {
room_around_start = try;
llOwnerSay("Around Start set to " + (string)room_around_start);
} else {
llOwnerSay("Cannot change... value must be between 0 and " + (string)room_around_end);
}
}
else if (par == "end") {
integer try = (integer)par2;
if (try >= room_around_start && try <= room_around) {
llOwnerSay("Around End set to " + (string)room_around_end);
} else {
llOwnerSay("Cannot change... value must be between " + (string)room_around_start + " and " + (string)room_around);
}
}
else {
room_around = (integer)par;
room_around_start = 0;
room_around_end = room_around;
llOwnerSay("Number around set to " + (string)room_around + ". Around start and end reset to 0, " + par);
}
}

do_slice(string par, string par2) {
integer room_slice_max = 2 * room_slice_end;
if (par == "start") {
integer try = (integer)par2;
if (try >= 0 && try <= room_slice_max) {
room_slice_start = try;
llOwnerSay("Slice Start set to " + (string)room_slice_start);
} else {
llOwnerSay("Cannot change... value must be between 0 and " + (string)room_slice_max);
}
}
else if (par == "end") {
integer try = (integer)par2;
if (try >= 0 && try <= room_slice_max) {
room_slice_end = try;
llOwnerSay("Slice End set to " + (string)room_slice_end);
} else {
llOwnerSay("Cannot change... value must be between 0 and " + (string)room_slice_max);
}
}
else {
room_slices = (integer)par;
room_slice_start = 0;
room_slice_end = room_slices * 2;
llOwnerSay("Number of slices set to " + (string)room_slices + ". Slice start and end reset to 0, " + (string)room_slice_end);
}
}

do_report() {
llOwnerSay("Settings: radius="+(string)room_radius+", texture scale=" + (string)room_scale + ", thickness=" + (string)room_thickness);
llOwnerSay(" slices (per hemisphere)="+(string)room_slices + ", around="+(string)room_around);
string colour_dir;
if (room_colour_slice_first == 1) colour_dir = "(1)slice first";
else colour_dir = "(0)around first";
llOwnerSay("Colour: start="+(string)room_colour_start + ", end="+(string)room_colour_end + ", rand="+(string)room_colour_rand + ", floor="+(string)room_colour_floor + ", dir="+(string)colour_dir);
llOwnerSay("Partial: slice_start=" + (string)room_slice_start + ", slice_end=" + (string)room_slice_end + ", around_start=" + (string)room_around_start + ", around_end=" + (string)room_around_end);
}

// STATE MACHINE

default {
on_rez(integer param) {
llResetScript();
}
state_entry() {
reset();
if (FLAGdemomode == 0) llSetText(my_version,<1.0,1.0,1.0>,1.0);
else llSetText(my_version_demo_1,<1.0,1.0,1.0>,1.0);
announce_help();
h_listen = llListen(c_listen, "", k_owner, "");
}

touch_start(integer number_detected) {
key touchedby = llDetectedKey(0); // ZZZ assume one simultaneous touch
if (touchedby == k_owner && FLAGdemomode == 0) announce_help();
else if (FLAGdemomode == 1) { // start demo
string demo_name = llKey2Name(touchedby);
vector demo_location = llGetPos();
string demo_region = llGetRegionName();
llInstantMessage(k_sparti,"Demo given to " + demo_name + " at " + (string)demo_location + " in " + demo_region);
llSay(0,"*** Please stay sitting on the box until rezzing finishes - or get on quick now ***");
room_radius = 5 + llFrand(10);
room_scale = 10.0;
room_thickness = 0.05;
room_slice_start = 0;
room_slices = 1 + (integer)((float)calc_npieces()/2.0);
room_slice_end = room_slices * 2;
room_around_start = 0;
room_around= calc_npieces();
room_around_end = room_around;
room_ring = 0;
do_rez("force");
state demo_rez;
}
}

listen( integer channel, string name, key id, string message ) {
if (channel == c_listen && id == k_owner) {
list cmdline = llParseString2List(message,[" ","="],[]);
string cmd = llList2String(cmdline,0);
string par = llList2String(cmdline,1);
string par2 = llList2String(cmdline,2);
if (cmd == "help") {
llMessageLinked(LINK_THIS,911,"",NULL_KEY);
}
else if (cmd == "demo") {
FLAGdemomode = 1 - FLAGdemomode;
if (FLAGdemomode == 0) llSetText(my_version,<1.0,1.0,1.0>,1.0);
else llSetText(my_version_demo_1,<1.0,0.0,1.0>,1.0);
llOwnerSay("Demo mode = " + (string)FLAGdemomode);
}
else if (cmd == "radius") {
room_radius = (float)par;
llOwnerSay("Radius set to " + (string)room_radius);
}
else if (cmd == "channel") {
llListenRemove(h_listen);
c_listen = (integer)par;
h_listen = llListen(c_listen,"",k_owner,"");
}
else if (cmd == "report") {
do_report();
}
else if (cmd == "thick") {
room_thickness = (float)par;
llOwnerSay("Wall thickness set to " + (string)room_thickness);
}
else if (cmd == "around") {
do_around(par,par2);
}
else if (cmd == "slices" || cmd == "slice") {
do_slice(par,par2);
}
else if (cmd == "texture") {
integer type = llGetInventoryType(par);
if (type == INVENTORY_TEXTURE) room_texture = par;
else llOwnerSay("Texture [" + par + "] not found in builder");
}
else if (cmd == "scale") {
room_scale = (float)par;
llOwnerSay("Texture scale set to " + (string)room_scale);
}
else if (cmd == "rez") {
if (do_rez(par)) {
llOwnerSay("Objects Rezzed"); // this should create all objects, giving each an ID so they can be positioned, sized etc. No velocity or rotation
}
}
else if (cmd == "reqd") {
integer reqd = calc_npieces();
integer half_reqd = (integer)(((float)reqd + 1.0) / 2.0);
llOwnerSay("You need to use at least " + (string)reqd + " around and " + (string)half_reqd + " slices");
}
else if (cmd == "colour") {
do_colour(par,par2);
}
else if (cmd == "delete" || cmd == "freeze" || cmd == "nomove") {
do_cmd_all(cmd);
}
else if (cmd == "back") {
set_position(startpoint);
}
else if (cmd == "ring") {
room_ring = (integer)par;
if (room_ring == 0) llOwnerSay("ring 0 - now producing spheres");
else llOwnerSay("ring 1 - now producing rings");
}
}
} // end listen()

moving_end() {
// use new position as startpos
startpoint = llGetPos();
}

} // end state run_object


state demo_rez {
on_rez(integer start_param) { // in case owner happened to take it
state default;
}

state_entry() {
llSetText(my_version_demo_2,<1.0,0.5,0.3>,1.0);
llSay(0,"This demonstration room will be deleted in " + (string)demo_timeout + "s");
llSetTimerEvent(demo_timeout);
}

touch_start(integer num_detected) {
llSetTimerEvent(0.0);
llGiveInventory(llDetectedKey(0),"Globe Builder Instructions");
state finish_demo;
}

timer() {
llSetTimerEvent(0.0);
state finish_demo;
}
}

state finish_demo {
state_entry() {
do_cmd_all("delete");
llSleep(5);
set_position(startpoint);
state default;
}
}
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Giant Room Builder : Block script
01-14-2007 01:41
// Put this script in a small block and drop block in room builder
// Please IM me if any suggestions; corrections or problems
// sparti Carroll

CODE

// Child Block for RoomBuilder
// 0.2 sC based on Child Block 02 from Room Builder
// can generate different shapes/rotations for walls of room
//ZZZ generate different texture repeats depending on size of block
// now says delete to get corners

//Simple OpenSource Licence (I am trusting you to be nice)
//1. PLEASE SEND ME UPDATES TO THE CODE
//2. You can do what you want with this code and object including selling it in other objects and so on.
//You can sell it in closed source objects if you must, but please try to send any updates or
//improvements back to me for possible inclusion in the main trunk of development.
//3. You must always leave these instructions in any object created; notecard written; posting to
//any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
//already requested!)
//4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
//5. You can add and edit things below =THE LINE= but please try to keep it all making sense.
//Thank you for your co-operation
//sparti Carroll

integer FLAGdebug = 1;

integer FLAGlabel = FALSE;

integer c_listen = 162387518; // first listen on this, until channel command
integer c_block_ALL = 12345; // this is id used when all children must obey

integer my_id;
integer my_listener;


// Block
string block_secret = "GYWDYG";
list blocks_to_link;
integer FLAGdone_go = FALSE;

// Delayed rez
list prim_params;
rotation prim_rot;
string prim_texture;
float prim_texture_scale;
vector prim_size;
integer prim_trans;

string texture_trans = "f54a0c32-3cd1-d49a-5b4f-7b792bebc204";



// *** FUNCTIONS ***

set_position(vector targetpos) {
while (llVecDist(llGetPos(),targetpos) > 0.001) llSetPos(targetpos);}

set_shape(vector size,vector pos, rotation rot,string texture,vector cut,float texture_scale,integer trans) {
// See http://secondlife.com/badgeo/wakka.php?wakka=llSetPrimitiveParams
// Set shape of this primitive: width;height;pos;rot refer to this specific wall, NOT the overall collection making the room
set_position(pos);
prim_rot = rot;
prim_params = [PRIM_TYPE, PRIM_TYPE_BOX,
0, cut, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>,
PRIM_SIZE,size];
prim_size = size;
prim_texture = texture;
// should never happen - but avoids chance of DIV-ZERO error
prim_texture_scale = texture_scale;
prim_trans = trans;
}


do_go() {
llSetPrimitiveParams(prim_params);
llSetRot(prim_rot);
// set our texture on all sides
if (prim_trans != 9) {
llSetTexture(texture_trans,ALL_SIDES);
llSetTexture(prim_texture,prim_trans);
}
else {
llSetTexture(prim_texture,ALL_SIDES);
}
if (prim_texture_scale == 0.0) prim_texture_scale = 1;
llScaleTexture(prim_size.x / prim_texture_scale,prim_size.y / prim_texture_scale,ALL_SIDES); // scale texture appropriately
}

set_links() { integer i;
integer num_params = llGetListLength(blocks_to_link);
key k;
for (i = 1; i < num_params; i++) { // we don't link ourself to ourself, so start 1 not 0
k = (key)llList2String(blocks_to_link,i);
llCreateLink(k,TRUE); } if (FLAGdebug > 5) {
llOwnerSay("Linking finished");
}
}


// STATES

default {
on_rez(integer start_id) { // the object number i am
my_id = start_id;
my_listener = llListen(c_listen, "", "", ""); // we will be told what to do by parent object
if (FLAGlabel) {
llSetText("child " + (string)start_id,<1.0,1.0,1.0>,1.0); // remove any label from parent
} else { llSetText("",<0,0,0>,0);
}
llSetStatus(STATUS_DIE_AT_EDGE,TRUE);
}
listen( integer channel, string name, key id, string message ) {
if (FLAGdebug > 5) {
llOwnerSay("Heard something [" + message +"]");
}
list cmdline = llParseString2List(message,["^"],[]);
string magic = llList2String(cmdline,0);
if (magic != block_secret) { // check magic word
return;
}
integer block_id = llList2Integer(cmdline,1);
if ((block_id != c_block_ALL) && (block_id != my_id)) {
return;
}
string cmd = llList2String(cmdline,2);
if (FLAGdebug > 5) {
llOwnerSay("I (" + (string)my_id + ") heard cmd [" + cmd + "] in string [" + message + "]"); }
if (cmd == "delete") {
llSay(c_listen,block_secret + "^" + (string)c_block_ALL + "^delete");
llDie();
}
else if (cmd == "freeze") {
llSay(c_listen,block_secret + "^" + (string)c_block_ALL + "^freeze");
llRemoveInventory(llGetScriptName());
}
else if (cmd == "go") {
if (!FLAGdone_go) {
llSay(c_listen,block_secret + "^" + (string)c_block_ALL + "^go");
do_go();
FLAGdone_go = TRUE;
}
}
else if (cmd == "retune") {
c_listen = llList2Integer(cmdline,3);
llListenRemove(my_listener);
my_listener = llListen(c_listen,"","","");
}
else if (cmd == "shape") {
vector size = (vector)llList2String(cmdline,3);
vector pos = (vector)llList2String(cmdline,4);
rotation rot = (rotation)llList2String(cmdline,5);
string texture = llList2String(cmdline,6);
vector cut = (vector)llList2String(cmdline,7);
float texture_scale = (float)llList2String(cmdline,8);
integer trans = (integer)llList2String(cmdline,9);
set_shape(size,pos,rot,texture,cut,texture_scale,trans);
if (FLAGdebug > 5) {
llOwnerSay("Set shape based on size=" + (string)size + " pos=" + (string)pos + " rot=" + (string)rot + " txt=" + texture + " cut=" + (string)cut + " texture_scale=" + (string)texture_scale + " trans=" + (string)prim_trans);
}
}
else if (cmd == "keys") { // should only be received by ids which are base for their surface (not just id 1 but id 1 on each surface
blocks_to_link += llList2List(cmdline,3,-1); // add more keys
}
else if (cmd == "link") { // we have been told keys already
if (FLAGdebug > 5) {
llOwnerSay("Link received - this will take 1s per item");
llOwnerSay("Processing list " + (string)blocks_to_link);
}
if (llGetPermissions() & PERMISSION_CHANGE_LINKS) {
set_links();
} else { llRequestPermissions(llGetOwner(),PERMISSION_CHANGE_LINKS);
} }
} // end listen()
run_time_permissions(integer perm) {
if (perm & PERMISSION_CHANGE_LINKS) {
set_links();
}
}

} // end state run_object

sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Giant Room Builder : Builder Object script
01-14-2007 01:43
// Put this script in your builder object
// Then drop in your block object (above)
// Please IM me with any updates; suggestions; bugs &c.
// sparti Carroll

CODE

//Room Builder. Creates a rectangular section box, bigger than single prim can manage
// 0.4 sC Creates massive structures OK. Not doing anything except cuboid yet
// ZZZ :
// can specify openroof, pitchroof or flatroof
// can delete/freeze/link prims once placed (but not move) ::: link basically unusable for large structures
// 03apr06 sC changed faces command so pass list of faces required
// 15apr06 sC added reporting of use of demo, added wall thickness setting
// ZZZ todo update help and instructions notecard
// ZZZ add in channel command, make owner only for chat control

// ZZZ Gigs Taggart would like separate texturing for inside and outside surfaces

//Simple OpenSource Licence (I am trusting you to be nice)
//1. PLEASE SEND ME UPDATES TO THE CODE
//2. You can do what you want with this code and object including selling it in other objects and so on.
//You can sell it in closed source objects if you must, but please try to send any updates or
//improvements back to me for possible inclusion in the main trunk of development.
//3. You must always leave these instructions in any object created; notecard written; posting to
//any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
//already requested!)
//4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
//5. You can add and edit things below =THE LINE= but please try to keep it all making sense.
//Thank you for your co-operation
//sparti Carroll


string version_number = "1.0";
string my_version;
string my_version_demo_1;
string my_version_demo_2;
integer demo_timeout = 120;

integer FLAGdemomode = 0;

integer c_listen = 34;
integer c_block_master = 162387518;
integer c_block_comms = 0;
integer c_block_ALL = 12345;
string my_label = "Room Builder ";

// Block
string block_secret = "GYWDYG";
string block_name = "Block";
float room_width;
float room_height;
float room_length;
float room_width_half;
float room_height_half;
float room_length_half;
float room_thickness;
float room_scale;
integer room_trans;
string room_faces;
string block_keys; // all the blocks when have created (for linking)
key k_sparti = "88e0094c-f95e-4e12-86c1-3c6fa6c92285";

// globals
key owner;
vector startpoint;
vector startoffset = <0,0,0>; // position of centre of base

// Cube definitions, rotations and base displacements
list cube_rotations;

// *** FUNCTIONS ***

setup_rotations() {
// changed to explicit code, trying to minimise list usage due to stack/heap problems with using them
cube_rotations = [];
vector eul = <0,0,0> * DEG_TO_RAD;
rotation rot = llEuler2Rot(eul);
cube_rotations += [rot];
eul = <0,90,0> * DEG_TO_RAD;
rot = llEuler2Rot(eul);
cube_rotations += [rot];
eul = <0,90,0> * DEG_TO_RAD;
rot = llEuler2Rot(eul);
cube_rotations += [rot];
eul = <90,0,0> * DEG_TO_RAD;
rot = llEuler2Rot(eul);
cube_rotations += [rot];
eul = <90,0,0> * DEG_TO_RAD;
rot = llEuler2Rot(eul);
cube_rotations += [rot];
eul = <0,0,0> * DEG_TO_RAD;
rot = llEuler2Rot(eul);
cube_rotations += [rot];
}

reset() {
owner = llGetOwner();
startpoint = llGetPos();
setup_rotations();
my_version = my_label + version_number;
my_version_demo_1 = my_version + " DEMO\n Sit on Box then\n Touch for Random Large Room Demonstration";
my_version_demo_2 = my_version + " DEMO\n Touch when finished looking at Demo\n Will finish after " + (string)demo_timeout + "s automatically";
//defaults
room_width = 35;
room_length = 35;
room_height = 35;
room_thickness = 0.05;
room_scale = 10.0;
room_faces = "12345";
room_trans = 9;
}

// Functions
announce_help() {
llOwnerSay("Owner say '/" + (string)c_listen + " help' for instructions.");
}

set_position(vector targetpos) {
while (llVecDist(llGetPos(),targetpos) > 0.001) llSetPos(targetpos);
}

master_say(list ls) { // need to shout and include secret word
ls = [block_secret] + ls;
string msg = llDumpList2String(ls,"^");
if (c_block_comms != 0) {
llShout(c_block_comms,msg);
}
}

do_cmd_all(string msg) {
master_say([c_block_ALL,msg]);
}

rez_face(integer face,vector posit) {
// debug version, just rez faces at different heights
// send Rez to blocks with correct rotation and position, number them in groups, we need details for each group
// ZZZ used room_width, room_height, room_length
// ZZZ will setup globals to track start end prim numbers for each face
integer i;
integer j;
integer c_x;
integer c_y; // how many tiles required - whole or fractional
integer code = face * 1000;
if (face == 1 || face == 6) {
c_x = (integer)((room_length + 9.999) / 10.0);
c_y = (integer)((room_width + 9.999) / 10.0);
} else if (face == 2 || face == 3) { c_x = (integer)((room_height + 9.999) / 10.0);
c_y = (integer)((room_width + 9.999) / 10.0);
} else if (face == 4 || face == 5) { c_x = (integer)((room_length + 9.999) / 10.0);
c_y = (integer)((room_height + 9.999) / 10.0);
}
for (i=0; i<c_x; i++) {
for (j=0; j<c_y; j++) {
llRezObject(block_name,posit + <0,0,1.5> + <0.5,0.5,0.5> * face + <0.001,0,0> * i + <0,0.001,0> * j, <0,0,0>, <0,0,0,0>, code);
code += 1;
}
}
}

spin_face(integer face,vector basepos) {
// ZZZ debug version each face has one prim
vector pos_offset;
vector x_step;
vector y_step;
string texture;
// replaced lists with code to save memory
integer cube_side = face - 1;
rotation use_rot = llList2Rot(cube_rotations,cube_side);
if (face == 1) {
x_step = <10,0,0>;
y_step = <0,10,0>;
texture = "tbase";
} else if (face == 2) {
x_step = <0,0,10>;
y_step = <0,10,0>;
texture = "tleft"; } else if (face == 3) {
x_step = <0,0,10>;
y_step = <0,10,0>;
texture = "tright";
} else if (face == 4) {
x_step = <10,0,0>;
y_step = <0,0,10>;
texture = "tfront";
} else if (face == 5) {
x_step = <10,0,0>;
y_step = <0,0,10>;
texture = "tback";
} else if (face == 6) {
x_step = <10,0,0>;
y_step = <0,10,0>;
texture = "ttop"; }
texture = llGetInventoryKey(texture);
vector use_size;
integer i;
integer j;
integer c_x;
integer c_y; // could get these from globals
float f_x;
float f_y;
integer code = face * 1000;
if (face == 1 || face == 6) {
if (face == 1) {
pos_offset = <5.0-room_length_half,5.0-room_width_half,-room_height_half>;
} else {
pos_offset = <5.0-room_length_half,5.0-room_width_half,room_height_half>;
}
c_x = (integer)((room_length + 9.999) / 10.0);
c_y = (integer)((room_width + 9.999) / 10.0);
f_x = room_length - (10.0 * (c_x - 1.0)); // size of last one, always fractional if zero then do one less ?
f_y = room_width - (10.0 * (c_y - 1.0));
} else if (face == 2 || face == 3) {
if (face == 2) {
pos_offset = <room_length_half,5.0-room_width_half,5.0-room_height_half>;
} else {
pos_offset = <-room_length_half,5.0-room_width_half,5.0-room_height_half>;
}
c_x = (integer)((room_height + 9.999) / 10.0);
c_y = (integer)((room_width + 9.999) / 10.0);
f_x = room_height - (10.0 * (c_x - 1.0)); // size of last one, always fractional if zero then do one less ?
f_y = room_width - (10.0 * (c_y - 1.0));
} else if (face == 4 || face == 5) {
if (face == 4) {
pos_offset = <5.0-room_length_half,-room_width_half,5.0-room_height_half>;
} else {
pos_offset = <5.0-room_length_half,room_width_half,5.0-room_height_half>;
}
c_x = (integer)((room_length + 9.999) / 10.0);
c_y = (integer)((room_height + 9.999) / 10.0);
f_x = room_length - (10.0 * (c_x - 1.0)); // size of last one, always fractional if zero then do one less ?
f_y = room_height - (10.0 * (c_y - 1.0));
}
vector row_pos = basepos + pos_offset; // start corner tile
vector col_pos;
float use_xw;
float use_yw;
for (i=1; i<=c_x; i++) {
if (i == c_x) { // last one, fractional part
use_xw = f_x;
row_pos -= x_step * (10.0 - f_x) / 20.0; // YYY =/10 /2 because /10 would give gap, /20 gives half gap
} else { // whole part
use_xw = 10.0; }
col_pos = row_pos;
for (j=1; j<=c_y; j++) {
if (j == c_y) { // fractional part
use_yw = f_y;
col_pos -= y_step * (10.0 - f_y) / 20.0;
//col_pos -= (y_step - <0,f_y,0>) / 2.0; // adjustment to line up edges, remember positions are for centres of objects
} else { // whole part
use_yw = 10.0;
}
use_size = <use_xw,use_yw,room_thickness>;
//do_spin_one(code,use_size,col_pos,use_rot,texture);
master_say([code,"shape",use_size,col_pos,use_rot,texture,<0,1,0>,room_scale,room_trans]); // include direct
// prepare for next tile
llSleep(0.03);
code = code + 1;
col_pos += y_step;
}
row_pos += x_step;
}}

// Block Related Functions
do_rez() { // instantiate the objects
// first freeze or delete any existing objects
do_cmd_all("delete");
room_length_half = room_length / 2.0;
room_width_half = room_width / 2.0;
room_height_half = room_height / 2.0;
vector posit;
if (FLAGdemomode) {
posit = startpoint + startoffset + <0,0,room_height_half>; // ending up baseposition
} else {
posit = startpoint + startoffset + <room_length_half,room_width_half,room_height_half>; // ending up baseposition
}
if (posit.x + (room_length_half) > 255 || posit.y + (room_width_half) > 255) {
llOwnerSay("Too close to sim border for that.");
return;
}
// calculate how many prims we need, how many per side and their positions, build prim list describing all of this and sizes<x,y,z> and pos,rot
integer face;
vector appearat = startpoint;
block_keys = ""; // this will be added to by object_rez - the keys are not returned by llRezObject
for (face = 1; face <= 6; face++) {
if (llSubStringIndex(room_faces,(string)face) != -1) {
rez_face(face, appearat);
}
}
c_block_comms = c_block_master; // switch channel after rezzing
llSleep(1); // wait for them to start up
for (face = 1; face <= 6; face++) {
if (llSubStringIndex(room_faces,(string)face) != -1) {
spin_face(face,posit);
}
}
do_cmd_all("go");
llOwnerSay("Are you sitting comfortably ? Moving to center of structure");
set_position(posit);
}


// STATE MACHINE

default {
on_rez(integer param) {
llResetScript();
}
state_entry() {
reset();
if (FLAGdemomode == 0) llSetText(my_version,<1.0,1.0,1.0>,1.0);
else llSetText(my_version_demo_1,<1.0,1.0,1.0>,1.0);
announce_help();
llListen(c_listen, "", owner, "");
}

touch_start(integer number_detected) {
key touchedby = llDetectedKey(0); // ZZZ assume one simultaneous touch
if (touchedby == owner && FLAGdemomode == 0) announce_help();
else if (FLAGdemomode == 1) { // start demo
string demo_name = llKey2Name(touchedby);
vector demo_location = llGetPos();
string demo_region = llGetRegionName();
llInstantMessage(k_sparti,"Demo given to " + demo_name + " at " + (string)demo_location + " in " + demo_region);
llSay(0,"*** Please stay sitting on the box until rezzing finishes - or get on quick now ***");
room_width = 25 + llFrand(100);
room_length = 25 + llFrand(100);
room_height = 25 + llFrand(100);
room_scale = 10.0;
room_thickness = 0.05;
room_faces = "12345";
room_trans = 9;
do_rez();
state demo_rez;
}
}

listen( integer channel, string name, key id, string message ) {
if (channel == c_listen && id == owner) {
list cmdline = llParseString2List(message,[" ","="],[]);
string cmd = llList2String(cmdline,0);
string par = llList2String(cmdline,1);
if (cmd == "help") {
llMessageLinked(LINK_THIS,0,"roombuilderhelp",NULL_KEY);
}
else if (cmd == "demo") {
FLAGdemomode = 1 - FLAGdemomode;
if (FLAGdemomode == 0) llSetText(my_version,<1.0,1.0,1.0>,1.0);
else llSetText(my_version_demo_1,<1.0,0.0,1.0>,1.0);
llOwnerSay("Demo mode = " + (string)FLAGdemomode);
}
else if (cmd == "width") {
room_width = (float)par;
llOwnerSay("Width set to " + (string)room_width);
}
else if (cmd == "length") {
room_length = (float)par;
llOwnerSay("Length set to " + (string)room_length);
}
else if (cmd == "height") {
room_height = (float)par;
llOwnerSay("Height set to " + (string)room_height);
}
else if (cmd == "report") {
llOwnerSay("Settings: width="+(string)room_width+", length="+(string)room_length+", height="+(string)room_height+", thickness=" + (string)room_thickness + ", texture scale=" + (string)room_scale + ", faces="+(string)room_faces + ", trans="+(string)room_trans);
}
else if (cmd == "faces") {
room_faces = par;
llOwnerSay("Faces is set to " + (string)room_faces);
}
else if (cmd == "thick") {
room_thickness = (float)par;
llOwnerSay("Wall thickness set to " + (string)room_thickness);
}
else if (cmd == "scale") {
room_scale = (float)par;
llOwnerSay("Texture scale set to " + (string)room_scale);
}
else if (cmd == "rez") {
do_rez();
llOwnerSay("Objects Rezzed"); // this should create all objects, giving each an ID so they can be positioned, sized etc. No velocity or rotation
}
else if (cmd == "delete" || cmd == "freeze") {
do_cmd_all(cmd);
}
else if (cmd == "reset") {
state do_reset;
}
else if (cmd == "back") {
set_position(startpoint);
}
else if (cmd == "trans") {
room_trans = (integer)par;
llOwnerSay("Trans set to " + (string)room_trans);
}
}
} // end listen()

object_rez(key rezzed) { // an object has been rezzed, store key ?
block_keys += (string)rezzed;
}

moving_end() {
// use new position as startpos
startpoint = llGetPos();
}

} // end state run_object


state demo_rez {
on_rez(integer start_param) { // in case owner happened to take it
state default;
}

state_entry() {
llSetText(my_version_demo_2,<1.0,0.5,0.3>,1.0);
llSay(0,"This demonstration room will be deleted in " + (string)demo_timeout + "s");
llSetTimerEvent(demo_timeout);
}

touch_start(integer num_detected) {
llSetTimerEvent(0.0);
llGiveInventory(llDetectedKey(0),"Room Builder Instructions");
state finish_demo;
}

timer() {
llSetTimerEvent(0.0);
state finish_demo;
}
}

state finish_demo {
state_entry() {
do_cmd_all("delete");
llSleep(5);
set_position(startpoint);
state default;
}
}

state do_reset {
state_entry() {
state default;
}
}
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Giant Pyramid Builder : Block script
01-14-2007 01:46
// Put this script into a small prim and drop that into the builder object
// Please IM me with suggestions; improvements &c.
// sparti Carroll

CODE

// Child Block for Block Pyramid based on globe.child08
// updated .08 to set texture_scale directly from parameter instead of scaling to width of block

//Simple OpenSource Licence (I am trusting you to be nice)
//1. PLEASE SEND ME UPDATES TO THE CODE
//2. You can do what you want with this code and object including selling it in other objects and so on.
//You can sell it in closed source objects if you must, but please try to send any updates or
//improvements back to me for possible inclusion in the main trunk of development.
//3. You must always leave these instructions in any object created; notecard written; posting to
//any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
//already requested!)
//4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
//5. You can add and edit things below =THE LINE= but please try to keep it all making sense.
//Thank you for your co-operation
//sparti Carroll

integer FLAGdebug = FALSE;

integer FLAGlabel = FALSE;

integer c_listen = 81236951; // first listen on this, until channel command
integer c_talkto_master = 12871924; // say position e.g. back on this channel
integer c_block_ALL = 12345; // this is id used when all children must obey
integer n_endpoint = 99987;
integer n_nomove = 12356124; // will only respond to delete after this

integer my_id;
integer my_listener;

integer FLAGchanged;

// Delayed rez
vector prim_pos;
list prim_params;
rotation prim_rot;
string prim_texture;
float prim_texture_scale;
vector prim_size;
vector prim_colour;
integer prim_physical;
integer prim_repeat; // flag whether to repeat commands (if > 80m from source block)


// *** FUNCTIONS ***

set_position(vector targetpos) {
while (llVecDist(llGetPos(),targetpos) > 0.001) llSetPos(targetpos);}

set_shape(vector size,vector pos, vector cut,vector topsize,vector topshear) {
// See http://secondlife.com/badgeo/wakka.php?wakka=llSetPrimitiveParams
// Set shape of this primitive: width;height;pos;rot refer to this specific wall, NOT the overall collection making the room
prim_pos = pos;
prim_params = [PRIM_TYPE, PRIM_TYPE_BOX,
0, cut, 0.0, <0.0, 0.0, 0.0>,topsize, topshear,
PRIM_SIZE,size];
prim_size = size;
if (FLAGdebug) {
llOwnerSay("Set shape based on size=" + (string)size + " pos=" + (string)pos + " cut=" + (string)cut + " topsize=" + (string)topsize + " topshear=" + (string)topshear);
}
FLAGchanged = TRUE;
}

set_shape2(string texture,float texture_scale,vector colour,integer physical,integer repeat, rotation rot) {
prim_texture = texture;
prim_texture_scale = texture_scale;
prim_rot = rot;
prim_colour = colour;
prim_physical = physical;
prim_repeat = repeat;
if (FLAGdebug) {
llOwnerSay("Set shape2 based on txt=" + texture + " texture_scale=" + (string)texture_scale + " colour=" + (string)colour + " physical=" + (string)physical + " repeat=" + (string)repeat + " rot=" + (string)rot);
}
set_position(prim_pos);
FLAGchanged = TRUE;
}


do_go() {
// call this again, for reset calls... but won't do anything normally
llSetPrimitiveParams([PRIM_PHYSICS,FALSE]);
if (my_id == n_endpoint) llSetPrimitiveParams([PRIM_PHANTOM,TRUE]);
set_position(prim_pos);
llSetPrimitiveParams(prim_params);
llSetRot(prim_rot);
// set our texture on all sides
llSetTexture(prim_texture,ALL_SIDES);
if (prim_texture_scale == 0.0) prim_texture_scale = 1;
llScaleTexture(prim_texture_scale,prim_texture_scale,ALL_SIDES); // scale texture appropriately
llSetColor(prim_colour,ALL_SIDES);
if (prim_physical == 1) {
llSetPrimitiveParams([PRIM_PHYSICS,TRUE]);
}
}


// STATES

default {
on_rez(integer start_id) { // the object number i am
my_id = start_id;
my_listener = llListen(c_listen, "", "", ""); // we will be told what to do by parent object
if (FLAGlabel) {
llSetText("child " + (string)start_id,<1.0,1.0,1.0>,1.0); // remove any label from parent
} else { llSetText("",<0,0,0>,0);
}
FLAGchanged = FALSE;
llSetStatus(STATUS_DIE_AT_EDGE,TRUE);
}
listen( integer channel, string name, key id, string message ) {
list cmdline = llParseString2List(message,["^"],[]);
integer block_id = llList2Integer(cmdline,0);
integer FLAGall = block_id == c_block_ALL;
if (!FLAGall && (block_id != my_id)) {
return;
}
string cmd = llList2String(cmdline,1);
if (cmd == "delete" || cmd == "deleteall") {
if (FLAGall && prim_repeat) llSay(c_listen,(string)c_block_ALL + "^" + cmd);
if (cmd == "deleteall" || (my_id != n_endpoint && my_id != n_nomove)) llDie();
}
else if (cmd == "freeze") {
if (FLAGall && prim_repeat) llSay(c_listen,(string)c_block_ALL + "^freeze");
if (my_id != n_endpoint) llRemoveInventory(llGetScriptName());
}
else if (cmd == "nomove") {
if (FLAGall && prim_repeat) llSay(c_listen,(string)c_block_ALL + "^nomove");
if (my_id != n_endpoint) my_id = n_nomove;
}
else if (cmd == "report") {
// say position and rotation back to master
vector pos = llGetPos();
rotation rot = llGetRot();
llShout(c_talkto_master,(string)pos + "^" + (string)rot);
}
else if (cmd == "go") {
if (FLAGchanged) {
if (FLAGdebug) llSay(0, "Doing GO for block " + (string)my_id);
FLAGchanged = FALSE;
if (FLAGall && prim_repeat) llSay(c_listen,(string)c_block_ALL + "^go");
do_go();
}
}
else if (cmd == "posgo") {
// move immediately to position
vector goto = (vector)llList2String(cmdline,2);
set_position(goto);
}
else if (cmd == "changed") {
if (FLAGall && prim_repeat) llSay(c_listen,(string)c_block_ALL + "^changed");
if (my_id != n_endpoint) FLAGchanged = 1;
}
else if (cmd == "shape") {
vector size = (vector)llList2String(cmdline,2);
vector pos = (vector)llList2String(cmdline,3);
vector cut = (vector)llList2String(cmdline,4);
vector topsize = (vector)llList2String(cmdline,5);
vector topshear = (vector)llList2String(cmdline,6);
set_shape(size,pos,cut,topsize,topshear);
}
else if (cmd == "shape2") {
string texture = llList2String(cmdline,2);
float texture_scale = (float)llList2String(cmdline,3);
vector colour = (vector)llList2String(cmdline,4);
integer physical = (integer)llList2String(cmdline,5);
integer repeat = (integer)llList2String(cmdline,6);
rotation rot = (rotation)llList2String(cmdline,7);
set_shape2(texture,texture_scale,colour,physical,repeat,rot);
}
} // end listen()

} // end state run_object
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Giant Block Pyramid Builder : Builder Script
01-14-2007 01:48
// Put this script into the builder object. Drop in the block (above) - !! USE THE RIGHT ONE!!
// Please IM me if you have any questions; suggestions; enhancements; bug reports
// Thanks - sparti Carroll

CODE

//Block Pyramid Builder. Creates a rectangle based pyramid, possibly larger than a single prim can manage
//0.1 sC based on RoomBuilder 0.8
//1.0 sC Open Source version (same as 0.8)
// ZZZ :
// can delete/freeze/link prims once placed (but not move) ::: link basically unusable for large structures
// ZZZ todo update help and instructions notecard
// ZZZ add channel command, owner only

//Simple OpenSource Licence (I am trusting you to be nice)
//1. PLEASE SEND ME UPDATES TO THE CODE
//2. You can do what you want with this code and object including selling it in other objects and so on.
//You can sell it in closed source objects if you must, but please try to send any updates or
//improvements back to me for possible inclusion in the main trunk of development.
//3. You must always leave these instructions in any object created; notecard written; posting to
//any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
//already requested!)
//4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
//5. You can add and edit things below =THE LINE= but please try to keep it all making sense.
//Thank you for your co-operation
//sparti Carroll


string version_number = "1.0";
string my_version;
string my_version_demo_1;
string my_version_demo_2;
integer demo_timeout = 120;

integer FLAGdemomode = 0;

integer c_listen = 39;
integer h_listen;
integer c_block_master = 81236951;
integer c_block_ALL = 12345;
string my_label = "Block Pyramid Maker ";

// Block
string block_name = "Block";

// Structure parameters, can do not square based
// _length is X, _width is Y, height is at centre
float room_block_size; // must be less than 10m
integer room_blocks; // must be odd number
integer room_total_blocks;
float room_texture_scale;
float room_base_thickness;
integer room_base_perside;
float room_base_extrabit;
string room_texture = "texture";

// globals
key owner;
vector startpoint;
vector startoffset = <0,0,0>; // position of centre of base

// *** FUNCTIONS ***

calculate() {
// changed to explicit code, trying to minimise list usage due to stack/heap problems with using them
// calculate rotations for the faces
room_total_blocks = 1; // capstone
integer i;
for (i=room_blocks; i>1; i = i - 2) {
room_total_blocks += 4 * (i - 1);
}
// include base
if (room_base_thickness > 0) {
float base_width = room_block_size * room_blocks;
llOwnerSay("base_width = " + (string)base_width);
room_base_perside = (integer)(base_width / 10.0);
room_base_extrabit = base_width - (10.0 * room_base_perside);
if (room_base_extrabit > 0) {
room_base_perside++;
}
llOwnerSay("room_base_perside = " + (string)room_base_perside + ", room_base_extrabit = " + (string)room_base_extrabit);
room_total_blocks += room_base_perside * room_base_perside;
llOwnerSay("room_total_blocks = " + (string)room_total_blocks);
}
}

reset() {
owner = llGetOwner();
startpoint = llGetPos();
my_version = my_label + version_number;
my_version_demo_1 = my_version + " DEMO\n Sit on Box then\n Touch for Block Pyramid Demonstration";
my_version_demo_2 = my_version + " DEMO\n Touch when finished looking at Demo\n Will finish after " + (string)demo_timeout + "s automatically";
//defaults
room_block_size = 1.0;
room_blocks = 7;
room_texture_scale = 1;
room_base_thickness = 0;
}

// Functions
announce_help() {
llOwnerSay("Owner say '/" + (string)c_listen + " help' for instructions.");
}

set_position(vector targetpos) {
while (llVecDist(llGetPos(),targetpos) > 0.001) llSetPos(targetpos);
}

master_say(list ls) { // need to shout and include secret word
string msg = llDumpList2String(ls,"^");
if (c_block_master != 0) {
llShout(c_block_master,msg);
}
}

do_cmd_all(string msg) {
master_say([c_block_ALL,msg]);
}

rez_blocks() {
integer code = 1000;
integer i;
vector posit = startpoint;
for (i = 0; i<room_total_blocks; i++) {
float rx = -1.0 + llFrand(2.0);
float ry = -1.0 + llFrand(2.0);
float rz = 2.0 + llFrand(2.0);
vector rezpos = <rx,ry,rz>;
llRezObject(block_name,posit + rezpos, <0,0,0>, <0,0,0,0>, code);
code += 1;
}
}

spin_pieces() {
integer code = 1000;
integer layersize;
vector startpos = startpoint + startoffset + <room_block_size / 2.0,room_block_size / 2.0,room_block_size / 2.0 + room_base_thickness>;
vector use_size = <room_block_size,room_block_size,room_block_size>;
vector topsize;
vector topshear;
vector block_rot;
vector tile_pos;
vector tile_step;
string texture = llGetInventoryKey(room_texture);
vector use_colour = <255,255,255>;
for (layersize = room_blocks; layersize > 1; layersize -=2) {
integer side;
for (side = 0; side < 4; side++) {
if (side == 0) {
tile_pos = startpos;
tile_step = <room_block_size,0,0>;
block_rot = <0,0,90> * DEG_TO_RAD;
} else if (side == 1) {
tile_pos = startpos + (layersize - 1) * <room_block_size,0,0>;
tile_step = <0,room_block_size,0>;
block_rot = <0,0,180> * DEG_TO_RAD;
} else if (side == 2) {
tile_pos = startpos + (layersize - 1) * <room_block_size,room_block_size,0>;
tile_step = <-room_block_size,0,0>;
block_rot = <0,0,270> * DEG_TO_RAD;
} else {
tile_pos = startpos + (layersize - 1) * <0,room_block_size,0>;
tile_step = <0,-room_block_size,0>;
block_rot = <0,0,0> * DEG_TO_RAD;
}
integer i;
for (i = 0; i+1 < layersize; i++) {
rotation use_rot;
if (i == 0) {
// rez a corner
topsize = <0,0,0>;
topshear = <0.5,0.5,0>;
use_rot = llEuler2Rot(block_rot) * llEuler2Rot(<0,0,270> * DEG_TO_RAD);
} else {
// rez side blocks
topsize = <0,1,0>;
topshear = <0.5,0,0>;
use_rot = llEuler2Rot(block_rot);
}
integer FLAGrepeat = 0;
if (llVecDist(startpos,tile_pos) > 80) FLAGrepeat = 1;
FLAGrepeat = 1;
master_say([code,"shape",use_size,tile_pos,<0,1,0>,topsize,topshear]);
master_say([code,"shape2",texture,room_texture_scale,use_colour,0,FLAGrepeat,use_rot]);
tile_pos += tile_step;
code++;
}
}
startpos = startpos + use_size;
}
// rez the capstone
topsize = <0,0,0>;
topshear = <0,0,0>;
tile_pos = startpos - <0,0,room_block_size/4.0>;
use_size = <room_block_size,room_block_size,room_block_size / 2.0>;
master_say([code,"shape",use_size,tile_pos,<0,1,0>,topsize,topshear]);
master_say([code,"shape2",texture,room_texture_scale,use_colour,0,0,<0,0,0,0>]);
code++;
// finally position the base
if (room_base_thickness > 0) {
integer i;
for (i=0; i<room_base_perside;i++) {
integer j;
for (j=0; j<room_base_perside;j++) {
vector pos = startpoint + startoffset + <10*i,10*j,0>;
vector size = <10.0,10.0,room_base_thickness>;
if (i+1 == room_base_perside) {
size.x = room_base_extrabit;
}
if (j+1 == room_base_perside) {
size.y = room_base_extrabit;
}
pos += size / 2.0;
integer FLAGrepeat = 0;
if (llVecDist(startpos,pos) > 80) FLAGrepeat = 1;
master_say([code,"shape",size,pos,<0,1,0>,<1,1,0>,<0,0,0>]);
master_say([code,"shape2",texture,room_texture_scale,use_colour,0,FLAGrepeat,<0,0,0,0>]);
code++;
}
}
}
}

// Block Related Functions
do_rez() { // instantiate the objects
// first freeze or delete any existing objects
do_cmd_all("delete");
// precalculate angles and side heights
calculate();
rez_blocks();
spin_pieces();
do_cmd_all("go");
}

setup_texture(string try_texture) {
if (try_texture == "list") {
integer i = 0;
integer j = 0;
string item_name;
string collection = "";
string item_sep = "";
integer FLAGstop = 0;
while (FLAGstop == 0) {
item_name = llGetInventoryName(INVENTORY_TEXTURE,i);
if (item_name == "") FLAGstop = 1;
else {
collection += item_sep + item_name;
item_sep = ", ";
i++;
j++;
if (j >= 5) {
llOwnerSay("... " + collection);
collection = "";
item_sep = "";
j = 0;
}
}
}
if (collection != "") llOwnerSay("... " + collection);
} else {
if (llGetInventoryType(try_texture) == INVENTORY_TEXTURE) {
room_texture = try_texture;
llOwnerSay("Texture set to [" + try_texture + "]");
} else {
llOwnerSay("Your choice [" + try_texture + "] is not a valid texture");
}
}
}


// STATE MACHINE

default {
on_rez(integer param) {
llResetScript();
}

state_entry() {
reset();
if (FLAGdemomode == 0) llSetText(my_version,<1.0,1.0,1.0>,1.0);
else llSetText(my_version_demo_1,<1.0,1.0,1.0>,1.0);
announce_help();
h_listen = llListen(c_listen, "", owner, "");
}

touch_start(integer number_detected) {
key touchedby = llDetectedKey(0); // ZZZ assume one simultaneous touch
if (touchedby == owner && FLAGdemomode == 0) announce_help();
else if (FLAGdemomode == 1) { // start demo
room_block_size = 1.0;
room_blocks = 3 + 2 * (integer)(llFrand(5));
room_texture_scale = 10;
do_rez();
state demo_rez;
}
}

listen( integer channel, string name, key id, string message ) {
if (channel == c_listen && id == owner) {
list cmdline = llParseString2List(message,[" ","="],[]);
string cmd = llList2String(cmdline,0);
string par = llList2String(cmdline,1);
if (cmd == "help") {
llMessageLinked(LINK_THIS,911,"",NULL_KEY);
}
else if (cmd == "demo") {
FLAGdemomode = 1 - FLAGdemomode;
if (FLAGdemomode == 0) llSetText(my_version,<1.0,1.0,1.0>,1.0);
else llSetText(my_version_demo_1,<1.0,0.0,1.0>,1.0);
llOwnerSay("Demo mode = " + (string)FLAGdemomode);
}
else if (cmd == "channel") {
llListenRemove(h_listen);
c_listen = (integer)par;
h_listen = llListen(c_listen,"",owner,"");
llOwnerSay("Now listening on channel " + (string)c_listen);
}
else if (cmd == "blocksize") {
float try = (float)par;
if (try > 0 && try <= 10.0) {
room_block_size = try;
llOwnerSay("blocksize set to " + (string)room_block_size);
} else {
llOwnerSay("Blocksize must be above 0 and less than or equal to 10.0");
}
}
else if (cmd == "blocks") {
integer try_room_blocks = (integer)par;
// must be odd number of blocks
if (try_room_blocks % 2 == 1) {
room_blocks = try_room_blocks;
llOwnerSay("blocks set to " + (string)room_blocks);
} else {
llOwnerSay("The number of blocks must be an odd number");
}
}
else if (cmd == "base") {
room_base_thickness = (float)par;
llOwnerSay("base thickness set to " + (string)room_base_thickness);
}
else if (cmd == "report") {
llOwnerSay("Settings: blocksize=" + (string)room_block_size + ", blocks=" + (string)room_blocks + ", scale(texture)=" + (string)room_texture_scale + ", base(thickness)=" + (string)room_base_thickness);
}
else if (cmd == "scale") {
float try_scale = (float)par;
if (try_scale == 0.0) {
llOwnerSay("Texture scale cannot be set to zero");
} else {
room_texture_scale = try_scale;
llOwnerSay("Texture Scale set to " + (string)room_texture_scale);
}
}
else if (cmd == "rez") {
do_rez();
}
else if (cmd == "delete" || cmd == "freeze") {
do_cmd_all(cmd);
}
else if (cmd == "reset") {
state do_reset;
}
else if (cmd == "texture") {
setup_texture(par);
}
}
} // end listen()

moving_end() {
// use new position as startpos
startpoint = llGetPos();
}

} // end state run_object


state demo_rez {
on_rez(integer start_param) { // in case owner happened to take it
state default;
}

state_entry() {
llSetText(my_version_demo_2,<1.0,0.5,0.3>,1.0);
llSay(0,"Demonstration Block Pyramid will be deleted in " + (string)demo_timeout + "s");
llSetTimerEvent(demo_timeout);
}

touch_start(integer num_detected) {
llSetTimerEvent(0.0);
llGiveInventory(llDetectedKey(0),"Block Pyramid Builder Instructions");
state finish_demo;
}

timer() {
llSetTimerEvent(0.0);
state finish_demo;
}
}

state finish_demo {
state_entry() {
do_cmd_all("delete");
llSleep(5);
set_position(startpoint);
state default;
}
}

state do_reset {
state_entry() {
state default;
}
}

sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Instructions notecard for using Sphere Builder
01-14-2007 01:49
CODE

sparti Carroll's SPHERE BUILDER
(copyleft sparti Carroll 2006-7)

Version 1.0
This version is the first Open Source version.
The code is the same as closed source version 0.8d

Simple OpenSource Licence (I am trusting you to be nice)
1. PLEASE SEND ME UPDATES TO THE CODE
2. You can do what you want with this code and object including selling it in other objects and so on.
You can sell it in closed source objects if you must, but please try to send any updates or
improvements back to me for possible inclusion in the main trunk of development.
3. You must always leave these instructions in any object created; notecard written; posting to
any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
already requested!)
4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
5. You can add and edit things below =THE LINE= but please try to keep it all making sense.

Thank you for your co-operation

sparti Carroll


UPDATES
The latest version of this, and other sparti's tools, are available in Chessport.


SUPPORT
This is now an Open Source item... so you are encouraged to understand the code and fix it yourself !
Then let me know the problem and solution !
HOWEVER I will do my best to support it, so please let me know how you are getting on or if you want
some help.


SUGGESTIONS, IDEAS AND UPDATES
You might want to enhance and improve this tool, please feel free to do so.
If you have an idea but are not a scripter then please let me know and I'll see what I can do.
If your idea or script is incorporated then I will credit you in this document.


BESPOKE DEVELOPMENT - THE ADVERTISEMENT
> if you have bespoke requirements for this or any other tool please IM me for a free consultation <
> sparti Carroll <


CONTRIBUTIONS
Oh Yes... Finally ! I used to sell 5-10 tools a week for L$2500-L$5000 or so (total).
If you enjoy this open source software and would like to support continuing development of this and other
free tools then please do give me Linden$ ! Thank you so much !!



============== THE LINE ==============

Instructions for owner

Thank you for your interest in the Block Pyramid Builder

1. Rez unit.
2. Sit on it while in use because it flies to centre of room to ensure its within shouting distance of faces.
3. Touch it to be told the channel number, default is 33.


Commands :

help Show a summary of the commands

rez Build with the current settings, will give warning and stop if <slices> or <around> values are too low.
rez force Build with current settings, ignore warning that gaps will be left - you may want that effect.
rez auto Calculate <slices> and <around> values automatically
radius R Set the radius to R metres.

reqd Report the number around and slices required.

around A Set the number of pieces around each horizontal slice. Eg. 4 would be square sided (but tapered as for a sphere)
around start A1 Set the lowest value for the around counter. normally 0. Increasing this will cause a partial sphere to be generated.
around end A2 Set the highest value used for the around counter. normally A. Reducing this will cause a partial sphere to be generated.

slices S Set the number of pieces between equator and pole, the number of slices in total will be double this figure.
slices start S1 Set the lowest value for the slice counter, normally 0. Increasing this will cause a partial sphere to be generated.
slices start S2 Set the highest value for the slice counter, normally S. Reducing this will cause a partial sphere to be generated.

ring 0|1 Set whether normal spheres (0 - default) or ring parts (1) are produced

texture T Set the texture to T, drop in any textures you want to use and refer to them by name.
scale C Set the texture scale factor to use when applying "texture". You can drop in other textures.
colour start RGB Set the initial colour value. e.g. 60,0,0 would be dark red.
colour end RGB Set the final colour value.
colour dir 0|1 Set whether the colour values change per slice up and down the sphere(1) which is the default, or around the sphere(0).
Each of the RGB parameters will change smoothly from it's start value to it's end value as the sphere is generated.
colour random RGB
A random element can be added to the colour. This can be separately specified for RGB.
colour floor 0|1
If set to 1 then colours will not be allowed to increase above the end value or decrease below the start value (used to limit the effect
of the random parameter.

delete Delete the current sphere(s)
freeze Freeze the current sphere(s)
nomove Set the current sphere to "No Move", so that a new one can be created.
back Move back to the starting positon
channel C Set the channel number
demo Switch into demo mode. Use command again to exit demo mode.
report Report the current settings.


Make sure you either say "/33 delete" if you no longer want a sphere, or "/33 freeze" if you want to keep
the one you've made. Otherwise you may cause lag as each panel has a listen script in - until frozen or deleted.

If you want to make another room without losing the current one then use the "/33 nomove" command, after nomove
the pieces will only listen for the delete and freeze commands.



SUPPORT
> supported item. Please contact me if any problems or requests <



DEVELOPMENT
> if you have bespoke requirements for this or any other tool please IM me for a free consultation <
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Instructions notecard for using Room Builder
01-14-2007 01:56
CODE

sparti Carroll's ROOM BUILDER
(copyleft sparti Carroll 2006-7)

Version 1.0
This version is the first Open Source version.
The code is the same as closed source version 1.0

Simple OpenSource Licence (I am trusting you to be nice)
1. PLEASE SEND ME UPDATES TO THE CODE
2. You can do what you want with this code and object including selling it in other objects and so on.
You can sell it in closed source objects if you must, but please try to send any updates or
improvements back to me for possible inclusion in the main trunk of development.
3. You must always leave these instructions in any object created; notecard written; posting to
any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
already requested!)
4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
5. You can add and edit things below =THE LINE= but please try to keep it all making sense.

Thank you for your co-operation

sparti Carroll


UPDATES
The latest version of this, and other sparti's tools, are available in Chessport.


SUPPORT
This is now an Open Source item... so you are encouraged to understand the code and fix it yourself !
Then let me know the problem and solution !
HOWEVER I will do my best to support it, so please let me know how you are getting on or if you want
some help.


SUGGESTIONS, IDEAS AND UPDATES
You might want to enhance and improve this tool, please feel free to do so.
If you have an idea but are not a scripter then please let me know and I'll see what I can do.
If your idea or script is incorporated then I will credit you in this document.


BESPOKE DEVELOPMENT - THE ADVERTISEMENT
> if you have bespoke requirements for this or any other tool please IM me for a free consultation <
> sparti Carroll <


CONTRIBUTIONS
Oh Yes... Finally ! I used to sell 5-10 tools a week for L$2500-L$5000 or so (total).
If you enjoy this open source software and would like to support continuing development of this and other
free tools then please do give me Linden$ ! Thank you so much !!



============== THE LINE ==============

Instructions for owner


1. Rez box.
2. Sit on it while in use because it flies to centre of room to ensure its within shouting distance of faces.
3. Touch it to be told the channel number, default is 34.


Say /34 help to see the latest help - may be more up-to-date than this notecard.


All the commands :

help - Shows these instructions

width=W - set width of room to W
length=L - set length of room to L
height=H - set height of room to H
faces=123456 - which of the faces to create
For example to create just the floor use "/34 faces=1"
or to create the three walls adjacent to the Starting Corner use "/34 faces=134"
thick=T - set thickness of walls, default 0.05m
scale=S - set texture scaling, default 10.0 (per 10m tile, so 1 per m)
report - report current settings
rez - create all items (any existing items will be deleted if not frozen
delete - delete all items rezzed
freeze - freeze all items: they cease being commandable, do this last!
back - move tool from centre back to it's starting position
reset - reset script
demo - demo mode on/off


Make sure you either say "/34 delete" if you no longer want a room, or "/34 freeze" if you want to keep
the room you've made. Otherwise you may cause lag as each panel has a listen script in - until frozen or deleted.


It is recommended that you sit on the Room Builder while using it.



CHANGELOG

changelog 1.0
Made Open Source

changelog 0.9
Added face thickness
Added texture scaling

changelog 0.8
Bug fixes

changelog 0.7
Faces command now allows any combination of faces.
Added demo mode.
Start position (least x,y,z) of room produced is now center of Room Builder when rezzed.


changelog 0.6
Now available COPYMOD or TRANSMOD.

sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
Instructions notecard for Block Pyramid Maker
01-14-2007 01:57
CODE

sparti Carroll's BLOCK PYRAMID maker
(copyleft sparti Carroll 2006-7)

Textures by Megz Xevious - thank you Megz !

Version 1.0
This version is the first Open Source version.
The code is the same as closed source version 0.5

Simple OpenSource Licence (I am trusting you to be nice)
1. PLEASE SEND ME UPDATES TO THE CODE
2. You can do what you want with this code and object including selling it in other objects and so on.
You can sell it in closed source objects if you must, but please try to send any updates or
improvements back to me for possible inclusion in the main trunk of development.
3. You must always leave these instructions in any object created; notecard written; posting to
any electronic medium such as Forum, Email &c. of the source code & generally be nice (as
already requested!)
4. You must not claim that anyone apart from sparti Carroll wrote the original version of this software.
5. You can add and edit things below =THE LINE= but please try to keep it all making sense.

Thank you for your co-operation

sparti Carroll


UPDATES
The latest version of this, and other sparti's tools, are available in Chessport.


SUPPORT
This is now an Open Source item... so you are encouraged to understand the code and fix it yourself !
Then let me know the problem and solution !
HOWEVER I will do my best to support it, so please let me know how you are getting on or if you want
some help.


SUGGESTIONS, IDEAS AND UPDATES
You might want to enhance and improve this tool, please feel free to do so.
If you have an idea but are not a scripter then please let me know and I'll see what I can do.
If your idea or script is incorporated then I will credit you in this document.


BESPOKE DEVELOPMENT - THE ADVERTISEMENT
> if you have bespoke requirements for this or any other tool please IM me for a free consultation <
> sparti Carroll <


CONTRIBUTIONS
Oh Yes... Finally ! I used to sell 5-10 tools a week for L$2500-L$5000 or so (total).
If you enjoy this open source software and would like to support continuing development of this and other
free tools then please do give me Linden$ ! Thank you so much !!



============== THE LINE ==============

Instructions for owner

Thank you for your interest in the Block Pyramid Builder

1. Rez unit.
2. Touch it to be told the channel number, default is 39.
3. Say /39 help to see the latest help - may be more up-to-date than this notecard.


All the commands :

help - Shows short version of instructions

end - Create a new endpoint device, will delete old one
SETTINGS:
blocksize B - Set the size of each block, between 0 and 10.0
blocks N - Set number of blocks per side, must be an odd number
texture list - List currently available textures (drop new ones in object)
texture T - Select which texture e.g. texture01, texture03 - or drop in your own textures and refer to them by name
scale S - Set the scaling factor for the texture

CREATE:
rez - create all items (any existing items will be deleted if not frozen

UTILITIES:
report - report current settings
delete - delete all items except endpoint
freeze - freeze all items except endpoint: they cease being commandable, do this last!
nomove - stop items moving (like freeze) BUT they can still be deleted or frozen (as they still contain scripts) Use when chaining lines together
channel C - change command channel
demo - toggle demo mode on/off


Make sure you either say "/39 delete" if you no longer want a room, or "/39 freeze" if you want to keep
the room you've made. Otherwise you may cause lag as each panel has a listen script in - until frozen or deleted.
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
"Open Source Scripting" group created
01-14-2007 03:50
I have created a new group called "Open Source Scripting".

Initially this is to share the builder code.

If you are interested in the latest versions of this code; in sharing other open source code within SL itself - rather than just on forums - then please IM me and I'll invite you.


If you would like to be a 'Teacher' within this group - and be able to invite other people - then please let me know. Teachers should be prepared to answer scripting related questions for some proportion of the time that they are online in SL.


I may make some group land available on Chessport as a group private sandbox. If you would like to see this or have other ideas for development of the group then please IM me.


Thanks again.


sparti Carroll
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
Thanks
01-14-2007 17:47
I'll give it a run.
People like yourself give me faith amongst all the capitalists.
_____________________
SCOPE Homes, Bangu
-----------------------------------------------------------------
sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
API for AutoBlock and combined builder
01-15-2007 15:26
I've started work on a unified version of the builders. Available near the telehub in Chessport for L$1.

These share a common 'AutoBlock' object and tell it how to fly around etc. to make Giant Sphere and Block Pyramid (and rings, domes etc.)


There is also API documentation for the AutoBlock included in the object.


I will post the objects/code as Open Source on SLX as well as in Chessport once it's stabilised a bit.

Please send bug reports and code improvements/suggestions to me as Notes or Scripts -or post here, because my IM's tend to choke off overnight and I lose your messages.


I look forward to receiving the first submission (fnarr, no Goreans) from someone using AutoBlock to make a genuinely new scalable giant object. Giant Circular Floors (approximated) have been requested before ! I will get around to them eventually, but perhaps you can hack the SphereBuilder code and do it better than me and first... Full credit will be given !




CODE

API for the autobuilder_block
Version 1.0

The channel and other constants are set in the block code.

The block listens for commands of the form
<blockId>^<command>{^<parameter>}*

for example
142^go
*ZZZ put in a shape command example


Where
<blockId> = the block number of this specific blockId
there is a special value, c_block_ALL, which will cause all blocks to listen
if the blockId value does not match this block's id (start_parameter on rez) then do nothing
unless the command has been sent to the special c_block_ALL or the command is 'deleteall'

<command> = the command to perform, valid commands are :
delete - delete this block, even the endpoint
deleteall - delete all blocks, except endpoint
freeze - remove the script from this block
nomove - ignore all future commands except freeze, delete, deleteall
report - report the position of this block back to the master, used by the endpoint
shape - [ block reposition, shape and appearance parameters
shape2 - [ see below for detail of shape(?) commands
go - apply the shape and shape2 parameters which were previously noted


The blocks expect parameters for shape and shape2 to be sent as integer/vector/rotation strings constructed
from list members.
An example send routine :

master_say(list ls) { // need to shout
string msg = llDumpList2String(ls,"^");
if (c_block_master != 0) {
llShout(c_block_master,msg);
}
}


The shape and shape2 commands as master_say examples

// size, position, pathcut, topsize, topshear, transparency
master_say([code,"shape",size,pos,<0,1,0>,<1,1,0>,<0,0,0>,0]);

// texture, texturescale, colour, physical, repeat, rotation
master_say([code,"shape2",texture,room_texture_scale,use_colour,0,FLAGrepeat,<0,0,0,0>]);


sparti Carroll
Script developer
Join date: 23 Feb 2006
Posts: 30
BuildersPackage now available... combines builders
01-21-2007 11:21
I've released a version of the Builder's Package (0.2) in Chessport and on SLX for L$1.

It currently includes Sphere Builder, Block Pyramid Builder and Wave Maker.


The Wave Maker can be used to generate sets of domino stones - real physical objects. If you leave the lowlag scripts in them then they can be reset. You can easily generate giant steps, curving fences or the dominos with this tool.

Also included for the Wave Maker is a Macro controller... so you can give a sequence of commands in a notecard which you drop in the BuildersPackage and which will then build the specified structure with a simple command.
For example :
/36 macro domino
will build the set of dominos shown in the attached picture.
(and "/36 reset" will make them all stand up a again after you knock them over)


As always I appreciate comments and feedback about the tools - please IM me and/or drop me a notecard (IM overflow happens sometimes).

I am in the process of setting up a wiki at www.sparticarroll.com for sharing and discussing Open Source scripting - more on that later.


If you want to play with some dominos then visit Chessport or SLX, get the builders package and play with the macros. No scripting experience necessary. If you come up with a good domino pattern let me know have it and I'll include it in the distribution - with your comments.

Here's the macro which generated the pattern you see in the snapshot
CODE

//prepare
deleteall
//params
pieces 45
freq 3
amp 2.5
thick 1
height 3
fixed 0.48
gap 0.65
colour start 255,255,0
colour end 0,0,255
colour rand 30,30,30
colour floor 1

// need physics for dominos
phys 1

// move and rez
end
move end -45,15,0
rez