//****************************************** // By Ethan Miller, 2006 http://dma.sjsu.edu/~emiller/ // This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. // To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ or send a letter to // Creative Commons, 543 Howard Street, 5th Floor, San Francisco, CA 94105 USA //***************************************** // Instruction for modification: // To add your own vocabulary, and corresponding symbols - you just need to modify the two variables below. // Each string in the triggers variable is a comma-separated list of synonyms. // The corresponding string in the symbols variable is a comma-separated list of alpha values 0 - 10 // (0 = transparent, 10 = fully opaque) // There are 27 blocks in a symbol - it goes left to right down one face, then the middle section, then the other face. Take a look at the examples below to see how it works. //number of triggers, and number of symbols need to match list triggers = ["i,me,i'll,i'm", "think,guess,thought", "hey,hi,hello", "what", "you,you're,your", "ok,alright,yes", "lol,hehe,haha", "cool,sweet,awesome", "why", "friend,friends"]; list symbols = [ "2,2,2,2,2,2,2,2,2,2,2,2,2,10,2,2,2,2,2,2,2,2,2,2,2,2,2", "8,8,8,0,0,0,0,0,0,8,10,8,0,10,0,0,10,0,8,8,8,0,0,0,0,0,0", "0,0,0,0,0,0,0,0,0,0,10,0,0,8,0,0,4,0,0,0,0,0,0,0,0,0,0", "0,0,0,0,0,0,0,0,0,0,4,4,0,8,8,0,10,0,0,0,0,0,0,0,0,0,0", "0,0,0,0,10,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,4,0,0,0,0", "0,0,0,0,0,0,0,0,0,8,8,8,8,0,8,8,8,8,0,0,0,0,0,0,0,0,0", "0,0,0,0,9,0,0,9,0,0,2,0,9,0,9,9,9,9,0,0,0,0,9,0,0,9,0", "10,0,10,0,0,0,10,0,10,0,0,0,0,5,0,0,0,0,10,0,10,0,0,0,10,0,10", "8,8,8,0,0,0,0,0,0,8,8,8,0,0,0,2,2,2,8,8,8,6,6,6,0,0,0", "0,0,0,10,10,10,0,0,0,10,10,10,5,0,5,10,10,10,0,0,0,10,10,10,0,0,0" ]; integer findTrigger(string targ){ integer iTriggers = llGetListLength(triggers); integer iTriggerWords; integer i; integer ii; for(i = 0; i < iTriggers; i++){ list triggerSet = llCSV2List(llList2String(triggers, i)); iTriggerWords = llGetListLength(triggerSet); for(ii = 0; ii < iTriggerWords; ii++){ if(llList2String(triggerSet, ii) == llToLower(targ)){ return i; } } } return -1; } default{ on_rez(integer Meep){ llResetScript(); } state_entry(){ if(llGetListLength(triggers) != llGetListLength(symbols)){ llSay(0, "Config error: # of triggers don't match # of symbols"); return; } llListen(0, "", llGetOwner(), ""); } listen(integer channel, string name, key id, string message){ integer i; list wordlist = llParseString2List(message, [" "], []); list foundlist = []; integer iWords = llGetListLength(wordlist); // one loop to find out how many matches we have, and get list of indexes for(i = 0; i < iWords; i++){ integer found = findTrigger(llList2String(wordlist, i)); if(found >= 0){ foundlist += [found]; } } // now figure where to start our symbol rezzing // each unit is 1/8 meter so including a 1/8 meter space - // each block is 1/2 meter wide integer iSymbols = llGetListLength(foundlist); float x = (float)iSymbols/-4.0; for(i = 0; i < iSymbols; i++){ // get corresponding symbol config list grid = llCSV2List(llList2String(symbols, llList2Integer(foundlist, i))); if(llGetListLength(grid) != 27){ llSay(0, "Yoink! one of your symbol strings is not 27 ints long!"); return; } // pause numbers integer iPause = 160000; // this means 16 seconds integer iPauseInc = 1900; // this is .19 seconds // draw each unit integer ii; float xpos = -0.125; // move 1/8 left float ypos = 0.125; // move 1/8 foward float zpos = 0.125; // move 1/8 up // we're in front upper left block now, going left to right, // down the front face, then middle, then back.... for(ii = 0; ii < 27; ii++){ integer trans = (integer)llList2String(grid, ii); integer arg = iPause + trans; // this IF saves use the trouble of drawing invisible cubes... but makes timing the rising action difficult //if(trans != 0){ llRezObject("unit", llGetPos() + , ZERO_VECTOR, ZERO_ROTATION, arg); iPause -= iPauseInc; //} xpos += 0.125; if(xpos > 0.125){ //reached the end of a row xpos = -0.125; zpos -= 0.125; if(zpos < -0.125){ //reached the end of a face zpos = 0.125; ypos -= 0.125; } } } x += 0.5; // move to next symbol spot } } }