// Feel free to alter and distribute this script as you like, as long
as you leave these comments unchanged.
// The original glossary script was produced by Gassy Cat Worshop
(Slate.62.175).
//
//Changed for Second Life Glossary v1.0 by Kathy Yamamoto of Turtlemoon
Publishing (Shipley 210.210) 22 Jun 03
//Changed for Second Life Glossary v2.0 by Kathy Yamamoto of Turtlemoon
Publishing (Shipley 210.210) 27 Jun 03
// VARIABLES
// constants
integer glossary=0;
integer help=1;
integer shop=2;
// defintions
string def_CSV="admit list,afk,atm,attach,avatar,av,baked,ban
list,banisher,boot,brb,btw,calling card,community
standards,coordinates,damage,day,death,detach,drop,gesture,grid,grief
player,griefer,group,home,im,im coma,in-world,info
machine,inventory,irl,kick,l8r,lag,land mark,lm,lmao,liaison,linden,linden
labs,linden bucks,l$,link,lock,log,lol,lot,ltns,map,map
window,mature,metor,mouseview,mute,night,note
card,np,offline,omg,online,ooc,outfit,outlands,pg,physical,ppl,prim,prime,profile,property,public,rating,re,rehi,rez,rl,roflmao,rotflmao,safe,script,server,shard,shout,sim,simulator,spam,splat,stipend,teleport,texture,title,tooltip,track,ty,voting
machine,wb,whisper,wtf,yw"; // lower-case CSV where item x maps on to line x in
0th notecard of obj
list def_list; // this is where the CSV is unpacked
// input
key user; // who may request definitions?
integer in_chan=0; // channel watched for input
string keyword_glossary="find"; // keyword used to signify request for
definition
string keyword_shop="glossary sponsors"; // keyword used to signify request for
shops
string keyword_help="glossary help"; // keyword used to signify request for
shops
integer keyword_glossary_len; // used to parse input
// output
integer out_chan=0; // the channel to which definitions are output
// when word not in glossary, say this...
string not_found_A="Could not find the word ";
// then give the word we couldn't find, and then this...
string not_found_B=" in the glossary. Try respelling it. For words you feel
should be included, please IM Kathy Yamamoto";
string instructions="To look up a word, type: FIND <word>. To list sponsors,
type: GLOSSARY SPONSORS. For help, type: GLOSSARY HELP."; // instructions on use
// ROUTINES
give_card(key a,integer b) // gives user a card by constant
{ llGiveInventory(a,llGetInventoryName(INVENTORY_NOTECARD,b));}
findword(list src, string test) // searches for test in src, accounting for user
error
{ string modtest=llToLower(test); // modtest is lower-case of test
integer i=llListFindList(src,[modtest]); // where is modtest in src?
if (i!=-1) // if found
{ llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,0),i);} // request
corresponding line
else // if not found
{ llWhisper(0, not_found_A+test+not_found_B);}} // tell user we couldn't find it
// STATES
default
{ state_entry() // initialize the glossary
{ def_list = llCSV2List(def_CSV); // unpack the CSV
keyword_glossary_len = llStringLength(keyword_glossary); // get length of asking
keyword
// user=llGetOwner(); // figure out who can request defs
user="";
llWhisper(out_chan,instructions);
llListen(in_chan,"",user,"");} // wait for user to say something on the input
channel
on_rez(integer param) { llResetScript();
}
listen(integer ch,string a,key b,string c) // process input
{ if (llGetSubString(llToLower(c),0,keyword_glossary_len)==(keyword_glossary+"
")) // if input starts with keyword
{ findword(def_list,llGetSubString(c,keyword_glossary_len+1,-1));} // check if
input is in glossary
if (llToLower(c)==keyword_shop) // if user requests shops
{ give_card(b,shop);}
if (llToLower(c)==keyword_help) // if user requests help
{ give_card(b,help);}}
dataserver(key queryid, string str) // output a requested line
{ llWhisper(out_chan,str);} // send the requested line to output channel
}