User:Allen Kerensky/Myriad Lite Preview 5/Creator Controller
From OpenSimulator
< User:Allen Kerensky | Myriad Lite Preview 5
Revision as of 11:53, 6 February 2012 by Allen Kerensky (Talk | contribs)
Myriad Lite Creator Controller
Myriad_Lite_Creator_Controller-v0.0.1-20120203.lsl
// Myriad_Lite_Creator_Controller-v0.0.1-20120203.lsl // Copyright (c) 2012 By Allen Kerensky (OSG/SL) // The Myriad RPG System was designed, written, and illustrated by Ashok Desai // Myriad RPG licensed under the Creative Commons Attribution 2.0 UK: England and Wales // http://creativecommons.org/licenses/by/2.0/uk/ // Myriad Lite software Copyright (c) 2011-2012 by Allen Kerensky (OSG/SL) // Baroun's Adventure Machine Copyright (c) 2008-2011 by Baroun Tardis (SL) // Myriad Lite and Baroun's Adventure Machine licensed under the // Creative Commons Attribution-Share Alike-Non-Commercial 3.0 Unported // http://creativecommons.org/licenses/by-nc-sa/3.0/ // You must agree to the terms of this license before making any use of this software. // If you do not agree to this license, simply delete these materials. // There is no warranty, express or implied, for your use of these materials. integer CHANOBJECT; integer HANDOBJECT; integer CHANMYRIAD = -999; integer HANDMYRIAD; integer CHANCOMMAND = 5; integer HANDCOMMAND; string REGION_GENERATOR; vector OFFSET = <0,0,1.0>; key POSER; // who is sitting here string ANIM = "turn_180"; //string ANIM = "SpiceFloat5"; SETUP() { llSetText("Myriad Lite Character Builder (Prototype)\nSit Here To Begin",<1,0,0>,1); llSitTarget(OFFSET,ZERO_ROTATION); llSetSitText("> BUILD <"); // calculate listener channel CHANOBJECT = (integer)("0x"+llGetSubString((string)llGetKey(),0,6)); // release previous object channel if ( HANDOBJECT != 0 ) llListenRemove(HANDOBJECT); // start object-specific listener HANDOBJECT = llListen(CHANOBJECT,"",NULL_KEY,""); // release previous Myriad channel if ( HANDMYRIAD != 0 ) llListenRemove(HANDMYRIAD); // listen on Myriad region event channel HANDMYRIAD = llListen(CHANMYRIAD,"",NULL_KEY,""); // release previous command channel if ( HANDCOMMAND != 0 ) llListenRemove(HANDCOMMAND); // listen on Myriad region event channel HANDCOMMAND = llListen(CHANCOMMAND,"",NULL_KEY,""); // search all prims for prims to show output on, by name integer numprims = llGetNumberOfPrims(); integer i; for ( i=2; i <= numprims; i++) { llSetLinkPrimitiveParamsFast(i,[PRIM_TEXT,"",<0,0,0>,0]); } } COMMAND(string cmd ) { if ( cmd == "NEXT CATEGORY" ) { llMessageLinked(LINK_THIS,0,cmd,NULL_KEY); return; } if ( cmd == "PREV CATEGORY" ) { llMessageLinked(LINK_THIS,0,cmd,NULL_KEY); return; } if ( cmd == "NEXT ITEM" ) { llMessageLinked(LINK_THIS,0,cmd,NULL_KEY); return; } if ( cmd == "PREV ITEM" ) { llMessageLinked(LINK_THIS,0,cmd,NULL_KEY); return; } if ( cmd == "BUY ITEM" ) { llMessageLinked(LINK_THIS,0,cmd,NULL_KEY); return; } if ( cmd == "SELL ITEM" ) { llMessageLinked(LINK_THIS,0,cmd,NULL_KEY); return; } if ( cmd == "SAVE" ) { llMessageLinked(LINK_THIS,0,cmd,NULL_KEY); return; } if ( cmd == "RESET" ) { RESET(); return; } } RESET() { llMessageLinked(LINK_THIS,0,"RESET",NULL_KEY); key who = llAvatarOnSitTarget(); if ( who != NULL_KEY ) { llUnSit(who); } llResetScript(); } default { state_entry() { SETUP(); llRegionSay(CHANMYRIAD,"LIST_REGION_SETTINGS"); } listen(integer channel,string name,key id,string message) { name = ""; // LSLINT id = NULL_KEY; // LSLINT if ( channel == CHANOBJECT ) { if ( llSubStringIndex(message,"REGION_SETTING") == 0 ) { // Parse non-comment lines in keyword = value[,value,...] format list FIELDS = llParseString2List(message,["|"],[]); // break line of text into = delimited fields string SUBFIELD = llStringTrim(llList2String(FIELDS,1),STRING_TRIM); // field one is the data list SUBFIELDS = llParseString2List(SUBFIELD,["="],[]); string CMD = llList2String(SUBFIELDS,0); string DATA = llList2String(SUBFIELDS,1); // break data field into comma-delimited subfields if needed if ( CMD == "GENERATORS" ) { REGION_GENERATOR = llList2String(llCSV2List(DATA),0); llOwnerSay("REGION_GENERATOR = "+REGION_GENERATOR); if ( REGION_GENERATOR == "Random" ) { llSetScriptState("Myriad_Lite_Creator_Random-v0.0.1-20120203.lsl",TRUE); llSetScriptState("Myriad_Lite_Creator_Template-v0.0.1-20120203.lsl",FALSE); llSetScriptState("Myriad_Lite_Creator_Points-v0.0.1-20120203.lsl",FALSE); } if ( REGION_GENERATOR == "Template" ) { llSetScriptState("Myriad_Lite_Creator_Random-v0.0.1-20120203.lsl",FALSE); llSetScriptState("Myriad_Lite_Creator_Template-v0.0.1-20120203.lsl",TRUE); llSetScriptState("Myriad_Lite_Creator_Points-v0.0.1-20120203.lsl",FALSE); } if ( REGION_GENERATOR == "Points-Based" ) { llSetScriptState("Myriad_Lite_Creator_Random-v0.0.1-20120203.lsl",FALSE); llSetScriptState("Myriad_Lite_Creator_Template-v0.0.1-20120203.lsl",FALSE); llSetScriptState("Myriad_Lite_Creator_Points-v0.0.1-20120203.lsl",TRUE); } } return; } return; } } changed(integer change) { if ( change & CHANGED_LINK ) { POSER = llAvatarOnSitTarget(); if ( POSER != NULL_KEY ) { llRequestPermissions(POSER,PERMISSION_TRIGGER_ANIMATION); } else { RESET(); } } } run_time_permissions(integer perm) { if ( perm & PERMISSION_TRIGGER_ANIMATION ) { llStopAnimation("sit"); llStartAnimation(ANIM); llMessageLinked(LINK_THIS,0,"UPDATE",NULL_KEY); } } touch_start(integer total_number) { total_number = 0; // LSLINT string primname = llGetLinkName(llDetectedLinkNumber(0)); COMMAND(primname); } }