One of the things I love doing is programming and occasionally I come across a small programming challenge that takes my fancy. This particular one was initiated from a SLED listserv request for a stack of 8 randomly rotated blocks that could then be individually rotated by a user to line up in a particular sequence. Confirmation was to be given upon the correct sequence being achieved. The outer faces of the blocks would hold textures relating to whatever the context of the sequence would be. The base sequencer has coloured faces to demonstrate its use. These faces would be changed to white once the textures have been applied.
How It Works
When rezzed the sequencer appears as a stack of multi-coloured blocks with a small sphere at the top. The blocks have each been given a random rotation relative to the root prim (the sphere) by the on_rez event. If at this stage a user clicks on a block they are IM’d that they must click on the sphere to start. The sphere also has floating text to this affect.
When the sphere is clicked on (by any user other than the owner) the floating text changes to indicate that the sequencer is in use and gives instructions for rotating the blocks and accessing the User Menu. At this point only the user can interact with the sequencer. The user can then click on each block to rotate it counter-clockwise 90 degrees eventually achieving the correct sequence. The user has 10 minutes from first clicking on the sphere to achieve the correct sequence after which the sequencer will time out and reset itself ready for a new user.
When the correct sequence is achieved the floating text will indicate so and an IM will be sent with the same indication. The sphere will also light up. There will be a 10 second delay then the sequencer will reset itself ready for the next user.
When in use the user can click on the sphere to access the User Menu which has two options; Restart and Abandon. Restart resets the blocks with new random rotations and the user can continue to attempt finding the correct sequence. The timer for timing out does not reset. Abandon resets the sequencer for a new user.
The Owner Menu is displayed when the owner of the sequencer clicks on the sphere in start mode. The Owner Menu has six options; Randomise, Setup, Play, Help, GNU GPL and Isa’s Blog. Randomise will apply a random rotation to the blocks (relative to the root prim) and is usually used after the sequencer has been set up. Setup will align all the blocks into the correct sequence to make it easy to apply the appropriate textures and colours for the sequence context. Play will allow the owner to test the sequencer as a user. Help and GNU GPL will load the Sequencer README and the GNU General Public License to Inventory respectively. Isa’s Blog links out to this blog.
Adapting The Sequencer
Any number of blocks can be used in the sequencer; it does not need to be 8. Add or remove blocks by unlinking all prims, adding (by copying current blocks) or removing the required number of blocks, then linking all prims back together ensuring that the sphere is the root prim. The blocks do not need to be stacked one on top of the other. All that is required is when the correct sequence is achieved the rotation of each block matches the rotation of the sphere. This is the test the sequencer makes to find out if the sequence is correct. The sequencer itself can be set at any rotation as the blocks rotate relative to the root prim not the grid. It is suggested that complex arrangements are made with blank blocks, i.e. blocks without the sequencerBlock script in, and once all blocks are aligned with the root prim the scripts are added to the blocks.
A couple of options for the sequencer layout are shown below.
To get a copy of the sequencer or the scripts used to run one, IM Isa Goodman in Second Life or request contact through commenting on this post. The scripts are supplied under the GNU General Public License. You can play with the sequencer at my workshop in Second Life. To achieve the sequence in the test version the blocks must face their green side away from the back wall. This play version has been set up so that it acts as though the user were the owner to enable you to experience both menus.