Fun and useful JS scripts


@judas is there for you to destroy/break/test whatever you want. If anything bad happened on our side that would actually be a good thing as it would give us a data point with how to deal with script issues.

Go forth and go crazy!


I have been developing a script to build a simple 2 level 60 x 60 house with a gable roof and some window and door openings. To help the beginners. Thanks to KevinMThomas for getting me started.
The walls are all different colours to help define things in the script, I have commented almost every different line with basic help.

The house can be placed anywhere by changing the first 3 values (constants) in the script to your location, these values are then used as constants throughout the script. (details in the script)

With a little experimenting you can change the colours to suit yourself by changing the last 3 numbers in the Voxels.setVoxel(x, y, z, 1, 100, 100, 255) in this case 100, 100, 255 which is lightblue.

It can be scaled with a little tweaking.

Make sure you also get the removal script eraseGreenGables.js

Modify this all you want, Hopefully more to come.
Download scripts here
Build script
Removal script



I am currently seeing an issue where it doesnt finish cutting the doors and windows right, I think this is due to the server because it works well on localhost or an empty sandbox.
I ran the script a second time after commenting the first 4 build functions from line 238 and just let it run the cutDoors() and cutWindows() functions, then it was ok.
I didnt want to have a separate script for windows and doors for portability reasons.


Great job @Adrian. Looking great. This is a great example!


Hi @Adrian keep in mind when you re-run the entire script is has to recreate every voxel. You can include the cutWindows and cutDoors functionality in one script simply / / comment out the areas you don’t want to do at the time you want to run the script and you should be good to go.


Set Grass

Here is a simple script to map out grass on the street level of your plot. Simply fill in the details of your plot dimensions as everything is specified in the code comments.



Great script to show who owns plots on “The Strip”

Just add this script

and when you are over a plot it will show you who owns.


@chris this is a cool script but I must point out that you have duplicated a location,
the location set for Eve and Aaron are exactly the same, according to Eve this location is hers, directly across the road from me. I am unsure where Aaron’s plot is.


Hi @Adrian I have moved Aaron. If you reload that script it should show up correctly


Simple Teleporter Script
by Konstantin@HighFidelity

How to use: When you run the script by url, an extra menu with the name “Teleporter” will appear. With this menu, you can create your own teleporter or ignore teleporters (still work in progress).
In the background, the script scans for teleporters. When it finds an teleportervoxel under you, it will teleport you to the given coordinates.

Have fun!
Cheers, Konstantin


The Genesis Builder - Residential Building Model 6/6/14 WINDOWS BUILD REVISION (Menu remove function now works on Windows OS)

Here is a script to create a basic residential building at a specific location based on your position. Menu driven.



Some of Douglas Crockford’s remedial JavaScript functions can be rather helpful.

For example, supplant() performs primitive string formatting:

function supplant(string, obj) {
	return string.replace(/\{([^{}]*)\}/g, function(a, b) {
		var r = obj[b];
		return typeof r === 'string' || typeof r === 'number' ? r : a;

…turning print("Voxel at" + voxel.x + "," + voxel.y + "," + voxel.z + ">") into print(supplant("Voxel at <{x}, {y}, {z}>", voxel))


Just updated the Genesis Model to work on the Windows OS. Thread above.


Playing with Color!

Here is a script to give you more colors to play with,

Small tweak to put more colours into the voxel palette. I used a basic 16 colour palette here including black, white, red, blue, green etc. Please try it out to add som more colour to our world :slight_smile:

16 colours in sample, including (almost) black. Run the script from the URL below:


Yesssssssss <3 I love you Debs.


Yes Debs more colour, I was frustrated with how hard it was to dial up a particular colour when working with voxels, have to find the colour I want with Rainbow, punch the RGB params into a script and rez a coloured voxel, too slow.

So I created a palette of sorts, utilizing KevinMThomas menu script and some gradient formulas I have come up with.

Running the script produces 2 new menus, a Create, and a Remove .
Under the create there is a selection of colour gradients each will produce a bar of about 20 grades of that colour (see pic)
The pic is all 7 gradient bars,
reds, greens, blues, greys, red to green, green to blue, and blue to red.

Simply dial up a colour ramp and preselect your choice to your UI palette, then remove the palette afterwards.
Use in conjunction with editVoxels.js as posted by @DebsRegent for the extended UI palette of 16 slots.

Get the script from here


Hmm couldn’t post the link, try again.

Here is the link for the Colour Palette Menu in the pic above.

(I hope)
link (maybe)


@debs you rock I love this!


Thanks @KevinMThomas but the credit goes to @Adrian. I was doing this using the HUD initially but Adrian picked up the ball and ran with it. I believe that Arian’s colour selector rezzes inworld in HF? However I think between us we have a winner here. His picker in a HUD.

Colour picker in HUD

After looking at Adrian’s work at the Friday meeting, we discussed how to put a colour selector (like a colour wheel) into a HUD. I think we both believe this is the way to go. (Adrian?)

By the way, the HUD still needs doing - there are plenty of free Javascript colour picker scripts out there, so it’s a matter of who does it first.

We love colour!

I guess I got the stick and poked at it and Adrian ran with it … I had a bit of encouragement from @Judas (I think he just wanted to know if I really ‘could’ script :P)


Yes you guys are awesome this is very useful thank you @adrian for this as well. It is great to see the new color palettes come alive.