////////////////////////////////////////////////////////// // (C) Wizardry and Steamworks 2011, license: GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html // // for legal details, rights of fair usage and // // the disclaimer and warranty conditions. // ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // CONFIGURATION // ////////////////////////////////////////////////////////// // The height of the generated board. integer BOARD_HEIGHT = 2; // The width of the generated board. integer BOARD_WIDTH = 2; // The depth of the board. integer BOARD_DEPTH = 2; // The delay between rezzing the object in the primitive. float DELAY = .5; // Set this to the scale of the primitive inside the object. vector OBJECT_SCALE = <.5,.5,.5>; ////////////////////////////////////////////////////////// // INTERNALS // ////////////////////////////////////////////////////////// integer runner = 1; integer gitra = 0; integer gitrb = 0; integer gitrc = 0; vector tilePos = ZERO_VECTOR; default { state_entry() { llSay(0, "Click the glowing prim to deploy more tiles."); } touch_start(integer total_number) { // Sanity. if(BOARD_HEIGHT*BOARD_WIDTH < 1) { llSay(DEBUG_CHANNEL, "Sorry, the width and height have to be larger than zero. Aborting."); return; } if(llGetInventoryName(INVENTORY_OBJECT, 0) == "") { llSay(DEBUG_CHANNEL, "Sorry, I could not find an object in the inventory to rez. Aborting."); return; } tilePos = llGetPos(); state deploy; } } state deploy { state_entry() { llSay(0, "Please wait, deploying prims. Touch To stop..."); llSetTimerEvent(DELAY); } touch_start(integer num) { llSetTimerEvent(0); state default; } timer() { llSetTimerEvent(0); if(runner > BOARD_WIDTH*BOARD_HEIGHT*BOARD_DEPTH+1) { state default; return; } if(gitrc < BOARD_DEPTH) { if(gitrb < BOARD_HEIGHT) { if(gitra < BOARD_WIDTH-1) { llRezObject(llGetInventoryName(INVENTORY_OBJECT,0),tilePos,ZERO_VECTOR,ZERO_ROTATION,++runner); tilePos.x += OBJECT_SCALE.x; llSetPos(tilePos); ++gitra; llSetTimerEvent(DELAY); return; } llRezObject(llGetInventoryName(INVENTORY_OBJECT,0),tilePos,ZERO_VECTOR,ZERO_ROTATION,++runner); if(gitrb+1 >= BOARD_HEIGHT) { OBJECT_SCALE.x *= -1; ++gitrb; gitra = 0; llSetTimerEvent(DELAY); return; } tilePos.z += OBJECT_SCALE.z; llSetPos(tilePos); OBJECT_SCALE.x *= -1; ++gitrb; gitra = 0; llSetTimerEvent(DELAY); return; } tilePos.y += OBJECT_SCALE.y; OBJECT_SCALE.z *= -1; llSetPos(tilePos); ++gitrc; gitrb=0; gitra=0; llSetTimerEvent(DELAY); return; } } }