//---------------------------------------------- //-- Slice Stacker //-- by bloodsong termagant //-- based on Slice Doubler by ruthvenwillenov. //---------------------------------------------- // this will read your SCULPT notecard // and make every other slice copy the slice before it //----------------------------------------------- //-- problems, things to adjust // 1: only stacks odd on even, not vice versa // 2: doesn't average 2 slices, or average 3 slices, or 4 //--dont even know if notecard reading can handle this juggling // 3: doesnt save the odd slice's shape, if it is different from prev //--ie: ending poles, or shape changes. //----------------------------------------------- integer line = 0; //--notecard line # integer slice = 0; //--sculpt slice # integer start=0; //--start to halve integer end=256; //--how can we calculate from SCULPT notecard? hmm. key query; //--keep track of notecardline reading string note; //--name of notecard to use string objName; //--name of object string text; integer listener; //--use to kill menu listener integer SEGet; //-- 0= start else end doMenu(integer lvl) { string s = "Select Start/End slices, or Execute to begin."; list buttons = [ "Execute!", "Start#", "End#"]; listener = llListen(99281, "", llGetOwner(), ""); llSetTimerEvent(22.0); llDialog(llGetOwner(), s, buttons, 99281); } default { state_entry() { objName = llGetObjectName(); note = llGetInventoryName(INVENTORY_NOTECARD,0); if (note == "Slice Halver Help") note = llGetInventoryName(INVENTORY_NOTECARD,1); text = "All Slices"; llSetText(text, <0.5, 0.5, 0.5>, 1.0); llOwnerSay("Using Card "+note); llOwnerSay("Click to set up or start."); } touch_start(integer tsn) { if(llGetOwner() != llDetectedKey(0)) return; doMenu(0); } listen(integer ch, string n, key id, string s) { llListenRemove(listener); llSetTimerEvent(0.0); if(ch != 0) { if("Execute!" == s) { llSetObjectName("!"); //--get rid of line prefixes query = llGetNotecardLine(note,line); } else if ("Start#" == s) { SEGet = 0; listener = llListen(0, "", llGetOwner(), ""); llOwnerSay("Say the Start Number now."); } else if ("End#" == s) { SEGet = 1; listener = llListen(0, "", llGetOwner(), ""); llOwnerSay("Say the End Number now."); } else if ("Help" == s) llGiveInventory(llGetOwner(),"Slice Halver Help"); } else //--channel 0 = start or end number { integer n = (integer)s; if(SEGet == 0) { start = n; llOwnerSay("Start set to #"+(string)start); } else { end = n; llOwnerSay("Start set to #"+(string)end); } text = (string)start +" - "+(string)end; llSetText(text, <0.5, 0.5, 0.5>, 1.0); } } timer() { llListenRemove(listener); llSetTimerEvent(0.0); llOwnerSay("You took too long to respond; I'm ignoring you again."); } dataserver(key queryid, string data) { if(queryid == query) { if(data != EOF) { integer index = llSubStringIndex(data,"= 0) //--a slice line, defined above { data = llGetSubString(data,index,-1); //--not sure how this is different from the whole line //--aha! i remember, ss can read notes spat out with object names at the beginning of lines. list temp = llParseString2List(data,[],["\"",","]); //--separate line by " and , //--now find list item 2 for the line number integer test = llList2Integer(temp, 2); //--A: is it between start and end? if(test >= start && test <= end) {//--then we B: see if it is odd or even if(test % 2 == 0) //--i THINK this is even { slice = test; //temp = llListReplaceList(temp,[slice],2,2); //-- place current slice # in position 2 of that list llOwnerSay(llDumpList2String(temp,"")); //--say the line with current slice # slice++; //--advance slice temp = llListReplaceList(temp,[slice],2,2); //--now same line, with next slice # llOwnerSay(llDumpList2String(temp,"")); //--another line } else //-- it is odd... and we ignore it, cuz we folded it into the prev {} }//--end between S&E else llOwnerSay(data); //--so just say it }//--end it is a slice line else {//--this is a plain line llOwnerSay(data); } query = llGetNotecardLine(note,++line); //--see if this prevents doubling of start line and extra line at end }//--end not EOF else llSetObjectName(objName); //--set this back. }//--end query id } changed(integer ch) { if(ch & CHANGED_INVENTORY) llResetScript(); } }