Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Land L64pooldigger  

L64pooldigger

L6.04-pool-digger.lsl

Category: Land
By : Dana Moore
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for L64pooldigger
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. L64pooldigger_1.lsl
1
2 // Copyright (c) 2008, Scripting Your World
3 // All rights reserved.
4 //
5 // Scripting Your World
6 // By Dana Moore, Michael Thome, and Dr. Karen Zita Haigh
7 // http://syw.fabulo.us
8 // http://www.amazon.com/Scripting-Your-World-Official-Second/dp/0470339837/
9 //
10 // You are permitted to use, share, and adapt this code under the
11 // terms of the Creative Commons Public License described in full
12 // at http://creativecommons.org/licenses/by/3.0/legalcode.
13 // That means you must keep the credits, do nothing to damage our
14 // reputation, and do not suggest that we endorse you or your work.
15
16 // Listing 6.4: Terraforming Pool Digger
17 integer OB_CHANNEL = -654321; // or use a random value
18
19 integer gRadius = 4; // how far to scan around starting point
20 integer gBrush = 0; // brush size 0=2m, 1=4m, 2=8m: see wiki
21 integer gDig = TRUE; // should we dig on the next touch?
22
23 scan(vector center, integer operation) {
24 float step = llPow(2.0, (float) gBrush);
25 float x;
26 for (x = -gRadius; x <= gRadius; x += step) {
27 float y;
28 for (y = -gRadius; y <= gRadius; y += step) {
29 vector p = <center.x + x, center.y + y, center.z>;
30 float dist = llVecDist(p, center);
31 if(dist <= gRadius) {
32 llSetPos(p);
33 integer z;
34 integer c = (integer) (((float) gRadius - dist) / 2);
35 for (z = 0; z <= c; z++) {
36 llModifyLand(operation, gBrush);
37 }
38 }
39 }
40 }
41 }
42
43 default
44 {
45 touch_start(integer total_number) {
46 vector home = llGetPos();
47 if(gDig) {
48 scan(home, LAND_LOWER);
49 } else {
50 llSay(OB_CHANNEL, "die");
51 scan(home, LAND_RAISE);
52 }
53 llSetPos(home);
54
55 if(gDig) {
56 llRezObject("Pool", <home.x, home.y, home.z - 1.0>,
57 <0,0,0>, ZERO_ROTATION, OB_CHANNEL);
58 llSay(OB_CHANNEL, "size=" + (string)(2 * (gRadius + 1)));
59 }
60 gDig = !gDig;
61 }
62 }
63 // END //

Back to the Best Free Tools in Second Life and OpenSim.