Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

"Fran Rocks" Random Rock Maker

Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
12-18-2005 11:00
Got rocks?

Before I post this script, which was made by Francis Chung, only to have her mysteriously disassociate herself from it (I jest ;) ), I'd like to shed light on the background of how this came to me. I was musing in my blog about the challenges of making a Rock Tumbler in SL, and it came to mind that at least part of it was achievable.

I thot about landscaping in SL, and how many rocks are used, but how it can get tedious to cut and shape each rock yourself, not to mention how odd that can seem from a certain perspective.

So, after being trapped in a giant jar by Fran who came over, I shared my ideas with her, and she came up—live on the spot, like what Harlan Ellison would do in the window of a cafe if he were a scripter—with a Random Rock Maker, which I've lovingly dubbed "Fran Rocks".

Instructions are EASY PEASY!
  1. Rez a cube, give it a rock (or anything!) texture, put this script inside.
  2. Take the new rock back into the inventory and rez it, and ROCK ON!
  3. You'll see each rezzed rock has a different shape. Click on the rock again for another round of random!
  4. When you're done rocking and rolling, just type "/rock off" and the scripts in the rocks will all disappear.

Make any tweaks you'd like, and you're off and sprinting to a beautiful rock garden! :)


CODE

// Fran wuz here

randomize_rock() {
vector size;
float magnitude;

magnitude = llFrand(1.5) + 0.5;
size.x = (0.1 + llFrand(0.9)) * magnitude;
size.y = (0.1 + llFrand(0.9)) * magnitude;
size.z = (0.1 + llFrand(0.9)) * magnitude;

{ // Box type
float f;
integer holeshape;
vector cut;
float hollow;
vector twist;
vector topsize;
vector topshear;

f = llFrand(1);
if ( f < 0.33 )
holeshape = PRIM_HOLE_SQUARE;
else if ( f < 0.67 )
holeshape = PRIM_HOLE_CIRCLE;
else
holeshape = PRIM_HOLE_TRIANGLE;

cut.x = llFrand(1);
cut.y = cut.x + llFrand(1);
cut.z = llFrand(1);

hollow = llFrand(0.95);

twist.x = llFrand(1) - 0.5;
twist.y = llFrand(1) - 0.5;
twist.z = llFrand(1) - 0.5;

topsize.x = llFrand(1);
topsize.y = llFrand(1);
topsize.z = llFrand(1);

topshear.x = llFrand(1);
topshear.y = llFrand(1);
topshear.z = llFrand(1);

llSetPrimitiveParams( [PRIM_SIZE, size,
PRIM_TYPE, PRIM_TYPE_BOX, holeshape, cut, hollow, twist, topsize, topshear] );
}
}

default {
state_entry() {
randomize_rock();
llListen(0, "", llGetOwner(), "/rock off" );
llListen(1, "", llGetOwner(), "/rock off" );
}

touch_start(integer total_number) {
randomize_rock();
}

on_rez(integer code) {
llResetScript();
}

listen( integer channel, string name, key id, string msg ) {
llRemoveInventory( llGetScriptName() );
}
}
_____________________
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
12-19-2005 20:11
/54/3a/78425/1.html
_____________________
i've got nothing. ;)