diff --git a/128-128 teleporter/128-128 teleporter.txt b/128-128 teleporter/128-128 teleporter.txt new file mode 100644 index 00000000..e2114630 --- /dev/null +++ b/128-128 teleporter/128-128 teleporter.txt @@ -0,0 +1,27 @@ +vector LANDING = <128,128,32>; // Edit this for where they land + + key avatarkey; + + default +{ + state_entry() + { + llVolumeDetect(FALSE); + llVolumeDetect(TRUE); + } + collision_start(integer n) + { + llOwnerSay("Avatar Arriving:" + llDetectedName(0)); + avatarkey = llDetectedKey(0); + osForceOtherSit(avatarkey, llGetKey()); + } + + changed(integer what) { + if (what & CHANGED_LINK) { + llSetRegionPos(llGetObjectDesc()); + llUnSit(avatarkey); + llSetRegionPos(LANDING); + llResetScript(); + } + } +} \ No newline at end of file diff --git a/Animesh_Sequencer/Animesh_Sequencer.lsl b/Animesh_Sequencer/Animesh_Sequencer.lsl new file mode 100644 index 00000000..075e34c9 --- /dev/null +++ b/Animesh_Sequencer/Animesh_Sequencer.lsl @@ -0,0 +1,71 @@ +integer debug = TRUE; // set this top FALSE to shut the chat up. +integer idx = 0; // a counter to fiund the thing we need. +string prioranimation = ""; // where we keep thje last anim,ation so we can stop it. + +// example list of animations to play +// 1,2,3 seconds in this case +// plays "soundfIle on the 1st and last animation. +list animations = ["idle_1", "soundFile1", 1.0, + "idle_2", "", 2.0, + "idle_3","soundFile3", 3.0 + ]; + +// The above list is the names or UUIDS of animations in the prim, optionally a sound file name or UUID, and the time to play them. +// List is a 3-stride list so to play no animation, and a sound for 10 seconds, use +// "","soundfile name", 10, + +// for just an animation for 2 seconds, use this: +// "animationame","", 2.0 + +// for an animation for 20 secondsw with a wav file, use this: +// "animationame", "soundfilename", 20 + +// And there is no comma at the end of the list!! + +default { + state_entry() { // all we do in this ewvent is start a timer. Never rest inside this event! It's an endless loop! + if (debug) llSay(0,"reset"); + llSetTimerEvent(1); + } + on_rez(integer p){ // in case you rez the prim + llResetScript(); + } + changed(integer what) { + if (what & CHANGED_REGION_START) { // in case the OAR was loaded + llResetScript(); + } + if (what & CHANGED_INVENTORY) { // reset if you change any items in the prim inventory + llResetScript(); + } + } + timer() { + // check for end of list, if so start over + if (idx >= llGetListLength(animations)) { + idx = 0; + } + + // Start an animation after sttopping the prior + string animation = llList2String(animations,idx); + if (debug) { + llSay(0,"Playing " + animation); + } + llStopObjectAnimation(prioranimation); + llStartObjectAnimation(animation); + prioranimation = animation; + + // Set Sound + string sound = llList2String(animations,idx+1); + if (debug) { + llSay(0,"Sound " + sound); + } + if (llStringLength(sound)> 0 ) { + llPlaySound(sound, 1.0); + } + + // Set timer + float t = (float) llList2String(animations,idx+2); + llSetTimerEvent(t); + if (debug) llSay(0,"Timer Set to " + (string) t ); + idx+= 3; + } +} diff --git a/Dance Engine/Dance Engine v1.0.lsl b/Dance Engine/Dance Engine v1.0.lsl new file mode 100644 index 00000000..a14b3aa1 --- /dev/null +++ b/Dance Engine/Dance Engine v1.0.lsl @@ -0,0 +1,413 @@ +// Default Program FrameWork +/* + + Replace this Section with Program Specific Information + +*/ + +// Created by Tech Guy of IO + +// Configuration Directives +/* This Section Contains Configuration Variables that will contain data set by reading the notecard specified by ConfigFile Variable */ + + // Communication Channels + integer MenuComChannel; // Menu Communications Channel for All User Dialog Communications + integer ComChannel; // General Communication Channel for Inter-Device Communication + +// System Variables +/* This Section contains variables that will be used throughout the program. */ + // Admin ACL + list Admins; // List of Administrator Keys Read in from ConfigFile + // Dance Animation Names + list Dances; + // Num Dances Per Category + list NumDances; + // Num of Categories + integer NumCats; + // List of Category Names (Index Associated with {NumCats} + list CatNames; + // Couples Dances + list CDances; + // Dancers Keys + list Dancers; + // Maximum Dancers Supported + integer MaxDancers = 20; + // Number of Active Dancers (Not to Exceed Max Dancers) + integer NumDancers; + // Default Dance for someone who requests start + string DefaultDance; + + // Communication Handles + integer MenuComHandle; // Menu Communications Handle + integer ComHandle; // General Communications Handle + // Config Card Reading Variables + integer cLine; // Holds Configuration Line Index for Loading Config Loop + key cQueryID; // Holds Current Configuration File Line during Loading Loop + integer DCounter; + string DanceCat; + + +// System Constants +/* This Section contains constants used throughout the program */ +string BootMessage = "Booting..."; // Default/Initial Boot Message +string ConfigFile = ".config"; // Name of Configuration File +string EMPTY = ""; + +// Menu Constants +string MainMenuMessage = "Wholearth Dance Machine v1.0"; +list MainMenuButtons = [ "<<", "Stop", ">>", "Dances", "Start", "Invite", "Sync", "Random" ]; +list NavButtons = [ "Prev Menu", "Exit Menu" ]; +list AdminButton = [ "Admin" ]; +list AdminMenuButtons = [ "Dance", "Random", "Reset", "Sync" ]; +string AdminMenuMessage = "Admin Menu\n\tDance -> Sets Default Dance for start request\n\tRandom -> Should dances auto cycle.\n\tReset -> Reset Scripts\n\tSync -> Sync's Current Default Dance"; +string DefaultDancesMenuMessage = "Change the Default Dance..."; + +// Color Vectors +list colorsVectors = [<0.000, 0.455, 0.851>, <0.498, 0.859, 1.000>, <0.224, 0.800, 0.800>, <0.239, 0.600, 0.439>, <0.180, 0.800, 0.251>, <0.004, 1.000, 0.439>, <1.000, 0.522, 0.106>, <1.000, 0.255, 0.212>, <0.522, 0.078, 0.294>, <0.941, 0.071, 0.745>, <0.694, 0.051, 0.788>, <1.000, 1.000, 1.000>]; + +// List of Names for Colors +list colors = ["BLUE", "AQUA", "TEAL", "OLIVE", "GREEN", "LIME", "ORANGE", "RED", "MAROON", "FUCHSIA", "PURPLE", "WHITE"]; + +// System Switches +/* This Section contains variables representing switches (integer(binary) yes/no) or modes (string "modename" */ + // Debug Mode Swtich + integer DebugMode = FALSE; // Is Debug Mode Enabled before Reading Obtaining Configuation Information + string AdminOpFlag; + +// Imported Functions +/* This section contains any functions that were not written by Tech Guy */ + +// Home-Brew Functions +/* This section contains any functions that were written by Tech Guy */ + +// Debug Message Function +DebugMessage(string msg){ + if(DebugMode){ + llOwnerSay(msg); + } +} + +// Send Any User a Message +SendMessage(string msg, key userid){ + if(userid=="NULL_KEY" || userid==""){ + //llSay(0, msg); + llRegionSay(0, msg); + }else if(msg!="" && userid!=NULL_KEY){ + //llInstantMessage(userid, msg); + llRegionSayTo(userid, 0, msg); + }else{ + DebugMessage("Error Sending User Message: "+msg); + } +} + +// Main Initialization Logic, Executed Once Upon Script Start +Initialize(){ + SendMessage(BootMessage, llGetOwner()); // State Booting Message + MenuComChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); // Randomize Dialog Com Channel + MenuComHandle = llListen(MenuComChannel, EMPTY, EMPTY, EMPTY); + SendMessage("Configuring...", llGetOwner()); // Message Owner that we are starting the Configure Loop + cQueryID = llGetNotecardLine(ConfigFile, cLine); // Start the Read from Config Notecard +} + +// System has started Function (Runs After Configuration is Loaded, as a result of EOF) +SystemStart(){ + // Clean Up Config Variables + NumDances = NumDances + [DCounter]; + //llOwnerSay((string)llGetListLength(Dances)+llDumpList2String(Dances, "||")); + //llOwnerSay((string)llGetListLength(CatNames)+llDumpList2String(CatNames, "||")); + //llOwnerSay((string)llGetListLength(NumDances)+llDumpList2String(NumDances, "||")); + DCounter = 0; + DanceCat = EMPTY; + SendMessage("System Started!", llGetOwner()); +} + +// Add Admin (Add provided Legacy Name to Admins List after extrapolating userKey) +AddAdmin(string LegacyName){ + string FName = llList2String(llParseString2List(LegacyName, [" "], []), 0); + string LName = llList2String(llParseString2List(LegacyName, [" "], []), 1); + DebugMessage("First Name: "+FName+" Last Name: "+LName); + key UserKey = osAvatarName2Key(FName, LName); + if(UserKey!=NULL_KEY){ + Admins = Admins + UserKey; + DebugMessage("Added Admin: "+LegacyName); + }else{ + DebugMessage("Unable to Resolve: "+LegacyName); + } +} + + +// Configuration Directives Processor (Called Each Time a Line is Found in the config File) +LoadConfig(string data){ + if(data!=""){ // If Line is not Empty + // if the line does not begin with a comment + if(llSubStringIndex(data, "#") != 0) + { + // find first equal sign + integer i = llSubStringIndex(data, "="); + + // if line contains equal sign + if(i != -1){ + // get name of name/value pair + string name = llGetSubString(data, 0, i - 1); + // get value of name/value pair + string value = llGetSubString(data, i + 1, -1); + // trim name + list temp = llParseString2List(name, [" "], []); + name = llDumpList2String(temp, " "); + // make name lowercase + name = llToLower(name); + // trim value + temp = llParseString2List(value, [" "], []); + value = llDumpList2String(temp, " "); + // Check Key/Value Pairs and Set Switches and Lists + if(name=="debugmode"){ // Check DeBug Mode + if(value=="TRUE" || value=="true"){ + DebugMode = TRUE; + llOwnerSay("Debug Mode: Enabled!"); + }else if(value=="FALSE" || value=="false"){ + DebugMode = FALSE; + llOwnerSay("Debug Mode: Disabled!"); + } + }else if(name=="menu"){ + DanceCat = value; + CatNames = CatNames + [value]; + NumCats++; + Dances = Dances + [value]; + DebugMessage("Dance Category Found: "+llList2String(Dances, -1)+"\nTotal Categories: "+(string)NumCats); + if(DCounter>0){ + NumDances = NumDances + [DCounter]; + } + DCounter = 0; + }else if(name=="dance"){ + Dances = Dances + [value]; + DebugMessage("Dance "+value+" found! Placing into Category "+DanceCat); + DCounter++; + if(NumCats==1 && DCounter==1){ + DefaultDance = value; + DebugMessage("Default Dance Set to: "+DefaultDance); + } + DebugMessage((string)DCounter+" Total Dances for "+DanceCat+"."); + }else if(name=="admin"){ + AddAdmin(value); + } + }else{ // line does not contain equal sign + SendMessage("Configuration could not be read on line " + (string)cLine, NULL_KEY); + } + } + } +} + +// Check Security +integer CheckSecurity(key id){ + if(llListFindList(Admins, [id])!=-1){ + return TRUE; + }else{ + return FALSE; + } +} + +// Test of Requesting Users Key is found in Dancers List, Returns True or False +integer IsDancing(key id){ + if(llListFindList(Dancers, [id])!=-1){ + return TRUE; + }else{ + return FALSE; + } +} + +// Manipulate Dancer (Start, Stop, Next/Prev Dance, +Dancer(string CMD, key id, string Dance){ + if(CMD=="Start"){ + if(!IsDancing(id)){ // If the User is not in the dance list and is request to start. + Dancers = Dancers + [id]; + DebugMessage("Added: "+llKey2Name(id)+" to the Dancers List!"); + Relay("Assign", id, Dance); // Assign Requesting User the next available relay + }else{ + DebugMessage("Requesting Relay Re-Init..."); + Relay("Reload", id, Dance); + } + }else if(CMD=="Stop"){ + if(IsDancing(id)){ + Dancers = llDeleteSubList(Dancers, llListFindList(Dancers, [id]), llListFindList(Dancers, [id])); + if(llListFindList(Dancers, [id])==-1){ + DebugMessage("Dancer Removed from List!"); + }else{ + DebugMessage("Failed to Remove Dancer from List!"); + } + Relay("Stop", id, DefaultDance); + } + }else if(CMD==">>"){ + if(IsDancing(id)){ + DebugMessage("Advancing Dance for User: "+llKey2Name(id)+"."); + Relay(CMD, id, Dance); + } + }else if(CMD=="<<"){ + if(IsDancing(id)){ + DebugMessage("Retrogressing Dance for User: "+llKey2Name(id)+"."); + Relay(CMD, id, Dance); + } + }else if(CMD=="Sync"){ + + }else if(CMD=="Change"){ // Change to Selected Dance + if(IsDancing(id)){ + DebugMessage("Changing Dance for User: "+llKey2Name(id)+" to dance: "+Dance); + Relay("Change", id, Dance); + } + } +} + +// Relay Control +Relay(string CMD, key id, string Dance){ + string RelayName = "Relay "; + if(CMD=="Assign"){ + integer i; + for(i=1;i<=MaxDancers;i++){ + integer ISON = llGetScriptState(RelayName+(string)i); + if(!ISON){ // Script is Already in Use + RelayName = RelayName + (string)i; + DebugMessage("Script Relay: "+RelayName); + llSetScriptState(RelayName, TRUE); + llResetOtherScript(RelayName); + DebugMessage("Sending Start Message to Relay: "+RelayName); + llMessageLinked(LINK_THIS, 0, "START||"+DefaultDance, id); + return; + } + } + }else if(CMD=="Reload"){ + + }else if(CMD=="Stop"){ + DebugMessage("Sending Stop Message to Relay..."); + llMessageLinked(LINK_THIS, 0, "STOP||", id); + }else if(CMD=="Change"){ + DebugMessage("Sending Change Message to Relay..."); + llMessageLinked(LINK_THIS, 0, "CHANGE||"+Dance, id); + }else if(CMD==">>" || CMD=="<<"){ + DebugMessage("Sending Slot Adjustment Command..."); + llMessageLinked(LINK_THIS, 0, CMD+"||"+Dance, id); + } +} + +// Show Menu +ShowMenu(string Menu, key id){ + string CurMenuMessage; + list CurMenuButtons; + if(Menu=="MainMenu"){ + CurMenuMessage = MainMenuMessage; + CurMenuButtons = MainMenuButtons; + if(CheckSecurity(id)){ + CurMenuButtons =CurMenuButtons + AdminButton; + } + }else if(Menu=="Dances"){ + list Categories; + integer i; + integer CatIndex; + for(i=0;i>" || msg=="<<" || msg=="Sync"){ + DebugMessage(msg+" Message Received!"); + Dancer(msg, id, DefaultDance); + } + } + + touch_start(integer num){ + if(num>1){ + return; + } + + key UserKey = llDetectedKey(0); + if(NumDancers=2){ + integer DanceIndex = llListFindList(Dances, [ActiveDance]); + PrevDance = ActiveDance; + if(DanceIndex==0){ + ActiveDance = llList2String(Dances, -1); + }else{ + ActiveDance = llList2String(Dances, (DanceIndex - 1)); + } + Dancer("Change"); + } + } + }else if(CMD==">>"){ + if(llGetListLength(Dances)==0){ + if(GetDances()>=2){ + integer DanceIndex = llListFindList(Dances, [ActiveDance]); + PrevDance = ActiveDance; + if(DanceIndex==(llGetListLength(Dances) - 1)){ + ActiveDance = llList2String(Dances, 0); + }else{ + ActiveDance = llList2String(Dances, (DanceIndex + 1)); + } + Dancer("Change"); + } + } + } + } + } + + run_time_permissions(integer perms){ + if(perms & PERMISSION_TRIGGER_ANIMATION){ + llSetTimerEvent(0); + TimerMode = EMPTY; + Dancer("Start"); + }else{ + llRequestPermissions(ActiveDancer, PERMISSION_TRIGGER_ANIMATION); + } + } + + timer(){ + if(TimerMode=="Perms"){ + llMessageLinked(LINK_THIS, 0, "FAIL||"+llGetScriptName(), ActiveDancer); + llSleep(0.1); + llSetScriptState(llGetScriptName(), FALSE); + } + } +} \ No newline at end of file diff --git a/ElevatorKeyFramed-v1.0/ElevatorKeyFramed-v1.0.lsl b/ElevatorKeyFramed-v1.0/ElevatorKeyFramed-v1.0.lsl new file mode 100644 index 00000000..3a345c23 --- /dev/null +++ b/ElevatorKeyFramed-v1.0/ElevatorKeyFramed-v1.0.lsl @@ -0,0 +1,178 @@ +// Rideable Elevator Engine v1.0 +// Created by Tech Guy (Island Oasis) 2014 + +// CONFIGURATION AREA +list floorlist = [1, 23.71295, 30.63740, 38.13171, 45.60405, 53.14041, 60.63789, 68.13129, 75.63333, 83.11023, 90.61882, 98.16618, 105.64812, 113.15546, 120.65170, 128.13916, 135.65147 ]; // List of Floor Z-Vectors associated with floors +list seats = [25,26,27,28,29,30]; // Seat Link Numbers + +key MainComputer = "a50c545c-2472-4e8c-a82d-6fbb7598c418"; + +integer currentfloor = 1; // Stores Current Floor Number (Starts with it being on Floor 1) +integer dest_floor; // Holds Destination Floor +vector currentPos; // Stored Current Position of Car +vector destPos; // Stores Destination Vector +integer MainListener; // Main Listener Handle +float sitTimer = 1.0; // Timer Event Loop Freqency +integer sitCounter; // Sit Counter Down Integer->String +string runstate = "ready"; // Stores Running State of Elevator (ready vs preparing vs moving) +float SpeedT = 5.0; // Travel Speed (Multipled by Travel Distance to get Key Framed Animation Time) +float travelTime; // Will Contain Travel Time for Requested Floor Call +string direction; // Hold Direction Indicator String +vector nextfloor; // Hold Vector of Next Floor +float DiM; // Travel Distance in Meters +integer JR = TRUE; // J + +SetSitTargets(){ // Sets Set Targets on + integer ListLength = llGetListLength(seats); + integer i; + while (i < ListLength){ + llLinkSitTarget(llList2Integer(seats,i),<0.0,0.0,1.0>, ZERO_ROTATION); + ++i; + } +} + +OpenDoors(){ + llWhisper(420, currentfloor+"O"); + llMessageLinked(LINK_SET, 0, "OFF", NULL_KEY); + llWhisper(420, "OFF"); +} + +default +{ + state_entry() + { + + llListenRemove(MainListener); + llSetMemoryLimit(0x4000); + SetSitTargets(); + llOwnerSay("Ready..."); + MainListener = llListen(604, "", "", "" ); + } + + on_rez(integer num) + { + llResetScript(); + } + + listen(integer number, string name, key id, string message) + { + if(message!=""){ + if((integer)messagecurrentfloor){ // If Destination Floor is Higher than Current Floor + llOwnerSay("Going to Floor"+message); + dest_floor = (integer)message; + integer travel_distance = (integer)message - currentfloor; // Number of Floors to Travel + travelTime = travel_distance * SpeedT; // TravelTime + DiM = llList2Float(floorlist, (integer)message) - llList2Float(floorlist, currentfloor); // Travel Distance in Meters + destPos = llGetPos(); + destPos.z = llList2Float(floorlist, dest_floor); + nextfloor = llGetPos(); + nextfloor.z = llList2Float(floorlist, currentfloor+1); + llOwnerSay("Next Floor: "+(string)nextfloor.z); + state moveup; + }else{ + OpenDoors(); + } + } + } +} + +state moveup{ + state_entry(){ + llListenRemove(MainListener); + llSetStatus(STATUS_ROTATE_X| STATUS_ROTATE_Y| STATUS_ROTATE_Z, FALSE); // Restrict Rotation + sitCounter = 3; + integer numSeconds = (integer)sitTimer * sitCounter; + llSay(0,"You have "+(string)numSeconds+" seconds to sit down or be left behind. Thank You.\n Going to Floor"); + runstate = "preparing"; + llSetTimerEvent(sitTimer); + } + + timer(){ + if(runstate=="preparing"){ + if(sitCounter!=0){ + llSay(0,sitCounter+" second remaining..."); + sitCounter = sitCounter - 1; + } + if(sitCounter==0){ + llSay(0,"Going to Floor "+(string)destPos.z); + llSetKeyframedMotion( + [<0.0,0.0,DiM>, travelTime], + [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]); + runstate = "moving"; + llSetTimerEvent(0.25); + } + } + if(runstate=="moving"){ + currentPos = llGetPos(); + if(llRound(currentPos.z)==llRound(destPos.z)){ + currentfloor = dest_floor; + OpenDoors(); + state default; + } + if(llRound(currentPos.z)==llRound(nextfloor.z)){ + currentfloor = currentfloor + 1; + nextfloor.z = llList2Float(floorlist, currentfloor+1); + llRegionSayTo(MainComputer, 421, (string)currentfloor); + } + } + + } +} + +state movedown{ + state_entry(){ + llListenRemove(MainListener); + llSetStatus(STATUS_ROTATE_X| STATUS_ROTATE_Y| STATUS_ROTATE_Z, FALSE); // Restrict Rotation + sitCounter = 3; + integer numSeconds = (integer)sitTimer * sitCounter; + llSay(0,"You have "+(string)numSeconds+" seconds to sit down or be left behind. Thank You.\n Going to Floor"); + runstate = "preparing"; + llSetTimerEvent(sitTimer); + } + + timer(){ + if(runstate=="preparing"){ + if(sitCounter!=0){ + llSay(0,sitCounter+" second remaining..."); + sitCounter = sitCounter - 1; + } + if(sitCounter==0){ + llSay(0,"Going to Floor "+(string)destPos.z); + llSetKeyframedMotion( + [<0.0,0.0,DiM>, travelTime], + [KFM_DATA, KFM_TRANSLATION, KFM_MODE, KFM_FORWARD]); + runstate = "moving"; + llSetTimerEvent(1.0); + } + } + if(runstate=="moving"){ + currentPos = llGetPos(); + if(llRound(currentPos.z)==llRound(destPos.z)){ + llSay(420, (currentfloor-1)+"O"); + llMessageLinked(LINK_SET, 0, "OFF", NULL_KEY); + llSay(420, "OFF"); + currentfloor = dest_floor; + state default; + } + if(llRound(currentPos.z)==llRound(nextfloor.z)){ + currentfloor = currentfloor - 1; + nextfloor.z = llList2Float(floorlist, currentfloor-1); + llRegionSayTo(MainComputer, 421, (string)currentfloor); + } + } + + } +} \ No newline at end of file diff --git a/ElevatorKeyFramed-v1.0/LICENSE.txt b/ElevatorKeyFramed-v1.0/LICENSE.txt new file mode 100644 index 00000000..d6a93266 --- /dev/null +++ b/ElevatorKeyFramed-v1.0/LICENSE.txt @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/HotTub/HotTubEngine-v1.0.lsl b/HotTub/HotTubEngine-v1.0.lsl new file mode 100644 index 00000000..0adbacc6 --- /dev/null +++ b/HotTub/HotTubEngine-v1.0.lsl @@ -0,0 +1,271 @@ +//Hot Tube Engine V1.0 +// Created by Tech Guy of IO + +// Configuration + +// Menus +list MainMenu = ["Lights", "Steam On", "Steam Off", "Jets On", "Jets Off", "Exit"]; // Main Menu Options +list LightsMenu = ["On/Off", "Color", "Main Menu", "Exit"]; + +string MenuFlag = ""; + +// Variables +integer ListenChannel; // Listen Channel Variable Initializer +integer ListenHandle; // Listen Handle + +// Constants +string EMPTY = ""; +vector FullSizeWater = <2.11000, 3.06800, 1.2>; +vector NoWater = <2.11000, 3.06800, 0.00073>; +float NumWaterLevels = 30; +list JetLink = [2, 4, 5, 6, 7, 8, 10]; +key JetTarget = NULL_KEY; + + // Color Vectors +list colorsVectors = [<0.000, 0.455, 0.851>, <0.498, 0.859, 1.000>, <0.224, 0.800, 0.800>, <0.239, 0.600, 0.439>, <0.180, 0.800, 0.251>, <0.004, 1.000, 0.439>, <1.000, 0.522, 0.106>, <1.000, 0.255, 0.212>, <0.522, 0.078, 0.294>, <0.941, 0.071, 0.745>, <0.694, 0.051, 0.788>, <1.000, 1.000, 1.000>]; + // List of Names for Colors +list colors = ["BLUE", "AQUA", "TEAL", "OLIVE", "GREEN", "LIME", "ORANGE", "RED", "MAROON", "FUCHSIA", "PURPLE", "WHITE"]; + + //Initial Light Configuration Values + Some Holders for Temp Values + float Intensity = 1.0; + float Radius = 10.0; + float FallOff = 0.750; + vector DefaultColor = <0.502, 1.0, 1.0>; + float Glow = 0.06; + float Alpha = 0.7; + // PlaceHolders for Current Values of Same + float CurIntensity; + float CurRadius; + float CurFallOff; + vector CurColor; + float CurGlow; + +// Switches +integer LightState = FALSE; // Initial State of Tub Lights +integer SteamState = FALSE; // Initial Steam State +integer JetState = FALSE; // Initial Jet State + +// Functions + +DoMenu(string MFLAG, key userid){ + if(MFLAG==""){ + llSetTimerEvent(30.0); + ListenHandle = llListen(ListenChannel, EMPTY, EMPTY, EMPTY); + llDialog(userid, "Please select option...", MainMenu, ListenChannel); + }else if(MFLAG=="Lights"){ + llSetTimerEvent(30.0); + ListenHandle = llListen(ListenChannel, EMPTY, EMPTY, EMPTY); + llDialog(userid, "Please select option...", LightsMenu, ListenChannel); + }else if(MFLAG=="Color"){ + llSetTimerEvent(30.0); + ListenHandle = llListen(ListenChannel, EMPTY, EMPTY, EMPTY); + llDialog(userid, "Please select lighting color...", colors, ListenChannel); + } +} + +Steam(integer ISON){ + if(ISON){ + llLinkParticleSystem(LINK_ROOT, [ + PSYS_PART_FLAGS,( 0 + |PSYS_PART_INTERP_COLOR_MASK + |PSYS_PART_INTERP_SCALE_MASK ), + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE , + PSYS_PART_START_ALPHA,0.501961, + PSYS_PART_END_ALPHA,0.0117647, + PSYS_PART_START_COLOR,CurColor, + PSYS_PART_END_COLOR,<1,1,1> , + PSYS_PART_START_SCALE,<3,3,0>, + PSYS_PART_END_SCALE,<0.1875,0.1875,0>, + PSYS_PART_MAX_AGE,2.14844, + PSYS_SRC_MAX_AGE,0, + PSYS_SRC_ACCEL,<0,0,-0.203125>, + PSYS_SRC_BURST_PART_COUNT,2, + PSYS_SRC_BURST_RADIUS,0.199219, + PSYS_SRC_BURST_RATE,0.046875, + PSYS_SRC_BURST_SPEED_MIN,0.796875, + PSYS_SRC_BURST_SPEED_MAX,1, + PSYS_SRC_ANGLE_BEGIN,0, + PSYS_SRC_ANGLE_END,1.46875, + PSYS_SRC_OMEGA,<0,0,0>, + PSYS_SRC_TEXTURE, (key)"26321045-e218-49c8-9387-e7801c890e27", + PSYS_SRC_TARGET_KEY, (key)"00000000-0000-0000-0000-000000000000" + ]); + }else{ + llLinkParticleSystem(LINK_ROOT, []); + } +} + +Jets(integer ISON){ + integer i; + if(ISON){ + for(i=0;i<=5;i++){ + llLinkParticleSystem(llList2Integer(JetLink, i), [ + PSYS_PART_FLAGS,( 0 + |PSYS_PART_INTERP_COLOR_MASK + |PSYS_PART_INTERP_SCALE_MASK + |PSYS_PART_FOLLOW_SRC_MASK + |PSYS_PART_FOLLOW_VELOCITY_MASK + |PSYS_PART_TARGET_POS_MASK ), + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE , + PSYS_PART_START_ALPHA,1, + PSYS_PART_END_ALPHA,0, + PSYS_PART_START_COLOR,CurColor , + PSYS_PART_END_COLOR,<1,1,1> , + PSYS_PART_START_SCALE,<0,0,0>, + PSYS_PART_END_SCALE,<0.28125,0.28125,0>, + PSYS_PART_MAX_AGE,3, + PSYS_SRC_MAX_AGE,0, + PSYS_SRC_ACCEL,<0,0,0.046875>, + PSYS_SRC_BURST_PART_COUNT,8, + PSYS_SRC_BURST_RADIUS,0, + PSYS_SRC_BURST_RATE,0.0585938, + PSYS_SRC_BURST_SPEED_MIN,0.5, + PSYS_SRC_BURST_SPEED_MAX,1, + PSYS_SRC_ANGLE_BEGIN,2.09375, + PSYS_SRC_ANGLE_END,0.4375, + PSYS_SRC_OMEGA,<8,1.59375,1>, + PSYS_SRC_TEXTURE, (key)"1c79c1db-7cc0-421f-a363-499725617068", + PSYS_SRC_TARGET_KEY, llList2Key(JetTarget, 0) + ]); + } + }else{ + for(i=0;i<=2;i++){ + llLinkParticleSystem(llList2Integer(JetLink, i), []); + } + for(i=3;i<=5;i++){ + llLinkParticleSystem(llList2Integer(JetLink, i), []); + } + } +} + +ToggleLights(){ + if(LightState){ + llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, FALSE, + PRIM_POINT_LIGHT, FALSE, CurColor, CurIntensity, CurRadius, CurFallOff, + PRIM_COLOR, ALL_SIDES, DefaultColor, Alpha + ]); + if(SteamState){ + vector TempColor = CurColor; + CurColor = <1.0,1.0,1.0>; + Steam(FALSE); + Steam(TRUE); + CurColor = TempColor; + } + if(JetState){ + vector TempColor = CurColor; + CurColor = <1.0,1.0,1.0>; + Jets(FALSE); + Jets(TRUE); + CurColor = TempColor; + } + }else{ + llSetPrimitiveParams([PRIM_FULLBRIGHT, ALL_SIDES, TRUE, + PRIM_POINT_LIGHT, TRUE, CurColor, CurIntensity, CurRadius, CurFallOff, + PRIM_COLOR, ALL_SIDES, CurColor, Alpha + ]); + if(SteamState){ + Steam(FALSE); + Steam(TRUE); + } + if(JetState){ + Jets(FALSE); + Jets(TRUE); + } + } + LightState = !LightState; +} + + + +default{ + state_entry(){ + llListenRemove(ListenHandle); + ListenChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); + // Set Light Config Defaults to Current Values Variables + CurIntensity = Intensity;; + CurRadius = Radius; + CurFallOff = FallOff; + CurColor = DefaultColor; + CurGlow = Glow; + JetTarget = llGetLinkKey(LINK_ROOT); + } + + touch(integer num){ + key id = llDetectedKey(0); + integer WhatTouched = llDetectedLinkNumber(0); + if(WhatTouched!=16){ + return; + }else{ + //llOwnerSay("Link Number: "+(string)WhatTouched); + //return; + DoMenu(EMPTY, id); + } + } + + listen(integer channel, string num, key id, string msg){ + llSetTimerEvent(0.0); // Clear Timer when listen event triggers, We will start timer again if we open another menu with DoMenu(); + if(msg=="Lights"){ // Open Lights Sub-Menu + MenuFlag = "Lights"; + DoMenu(MenuFlag, id); + }else if(msg=="Steam On"){ + SteamState = TRUE; + if(!LightState){ + vector TempColor = CurColor; + CurColor = <1.0,1.0,1.0>; + Steam(FALSE); + Steam(TRUE); + CurColor = TempColor; + }else{ + Steam(TRUE); + } + }else if(msg=="Steam Off"){ + SteamState = FALSE; + Steam(FALSE); + }else if(msg=="Jets On"){ + JetState = TRUE; + if(!LightState){ + vector TempColor = CurColor; + CurColor = <1.0,1.0,1.0>; + Jets(FALSE); + Jets(TRUE); + CurColor = TempColor; + }else{ + Jets(TRUE); + } + }else if(msg=="Jets Off"){ + JetState = FALSE; + Jets(FALSE); + }else if(msg=="On/Off"){ + ToggleLights(); + }else if(msg=="Color"){ + MenuFlag = msg; + DoMenu(MenuFlag, id); + }else if(msg=="Main Menu"){ + MenuFlag = ""; + DoMenu(EMPTY, id); + }else if(llListFindList(colors, [msg])!=-1){ + integer ColorIndex = llListFindList(colors, [msg]); + CurColor = llList2Vector(colorsVectors, ColorIndex); + if(LightState){ + ToggleLights(); + ToggleLights(); + } + if(SteamState){ + Steam(FALSE); + Steam(TRUE); + } + if(JetState){ + Jets(FALSE); + Jets(TRUE); + } + }else{ + llSetTimerEvent(0); + llListenRemove(ListenHandle); + } + } + + timer(){ + llSetTimerEvent(0); + llListenRemove(ListenHandle); + } +} \ No newline at end of file diff --git a/JacuzziTub/JacuzziTub-v1.0.lsl b/JacuzziTub/JacuzziTub-v1.0.lsl new file mode 100644 index 00000000..6eebdd3a --- /dev/null +++ b/JacuzziTub/JacuzziTub-v1.0.lsl @@ -0,0 +1,204 @@ +// Jacuzzi Engine v1.0 by Tech Guy +// Configuration + +// Menus +list MainMenu = ["Fill", "Empty", "Steam On", "Steam Off", "Jets On", "Jets Off", "Exit"]; // Main Menu Options + +// Variables +integer ListenChannel; // Listen Channel Variable Initializer +integer ListenHandle; // Listen Handle + +// Constants +string EMPTY = ""; +vector FullSizeWater = <2.11000, 3.06800, 1.2>; +vector NoWater = <2.11000, 3.06800, 0.00073>; +float NumWaterLevels = 30; +list JetLink = [14, 15, 16, 11, 12, 13]; +list JetTarget = ["9fdd5d24-7801-4f16-8c85-c9a7d8fff952", "8259c797-bd86-4157-b65d-a68781626864", "b67326c0-d279-4af5-b692-670532c130fe", "f553d16c-26e1-48dd-a553-205bb7d71296", "f8220e96-bbf7-4df2-9588-c8b374c6af9e", "203df0d7-8910-436f-a46a-0a50b854e3ae"]; + +// System States +integer JetState = FALSE; +integer WaterState = FALSE; +integer SteamState = FALSE; + +// Functions +Water(integer ISON){ + float StepSize = (FullSizeWater.z - NoWater.z) / NumWaterLevels; // Size to Change prim each Step + integer i; + if(ISON){ + llSetLinkTextureAnim(2, TRUE | LOOP, ALL_SIDES, 8, 8, 0.0, 64.0, 24.5 ); + llSetLinkAlpha(2, 1.0, ALL_SIDES); + for(i=0;i<=NumWaterLevels;i++){ + vector Size = llList2Vector(llGetLinkPrimitiveParams(2, [PRIM_SIZE]), 0); + Size.z = Size.z + StepSize; + llSetLinkPrimitiveParams(2, [PRIM_SIZE, Size]); + } + SteamState = TRUE; + Steam(TRUE); + }else{ + Steam(FALSE); + Jets(FALSE); + for(i=0;i<=NumWaterLevels;i++){ + vector Size = llList2Vector(llGetLinkPrimitiveParams(2, [PRIM_SIZE]), 0); + Size.z = Size.z - StepSize; + llSetLinkPrimitiveParams(2, [PRIM_SIZE, Size]); + } + llSetLinkAlpha(2, 0.0, ALL_SIDES); + llSetLinkTextureAnim(2, FALSE | LOOP, ALL_SIDES, 8, 8, 0.0, 64.0, 24.5 ); + + } +} + +Steam(integer ISON){ + if(ISON){ + llLinkParticleSystem(2, [ + PSYS_PART_FLAGS,( 0 + |PSYS_PART_INTERP_COLOR_MASK + |PSYS_PART_INTERP_SCALE_MASK ), + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE , + PSYS_PART_START_ALPHA,0.501961, + PSYS_PART_END_ALPHA,0.0117647, + PSYS_PART_START_COLOR,<1,1,1> , + PSYS_PART_END_COLOR,<1,1,1> , + PSYS_PART_START_SCALE,<3,3,0>, + PSYS_PART_END_SCALE,<0.1875,0.1875,0>, + PSYS_PART_MAX_AGE,2.14844, + PSYS_SRC_MAX_AGE,0, + PSYS_SRC_ACCEL,<0,0,-0.203125>, + PSYS_SRC_BURST_PART_COUNT,2, + PSYS_SRC_BURST_RADIUS,0.199219, + PSYS_SRC_BURST_RATE,0.046875, + PSYS_SRC_BURST_SPEED_MIN,0.796875, + PSYS_SRC_BURST_SPEED_MAX,1, + PSYS_SRC_ANGLE_BEGIN,0, + PSYS_SRC_ANGLE_END,1.46875, + PSYS_SRC_OMEGA,<0,0,0>, + PSYS_SRC_TEXTURE, (key)"26321045-e218-49c8-9387-e7801c890e27", + PSYS_SRC_TARGET_KEY, (key)"00000000-0000-0000-0000-000000000000" + ]); + }else{ + llLinkParticleSystem(2, []); + } +} + +Jets(integer ISON){ + integer i; + if(ISON){ + for(i=0;i<=2;i++){ + llLinkParticleSystem(llList2Integer(JetLink, i), [ + PSYS_PART_FLAGS,( 0 + |PSYS_PART_INTERP_COLOR_MASK + |PSYS_PART_INTERP_SCALE_MASK + |PSYS_PART_FOLLOW_SRC_MASK + |PSYS_PART_FOLLOW_VELOCITY_MASK + |PSYS_PART_TARGET_POS_MASK ), + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE , + PSYS_PART_START_ALPHA,1, + PSYS_PART_END_ALPHA,0, + PSYS_PART_START_COLOR,<0.501961,0.501961,1> , + PSYS_PART_END_COLOR,<1,1,1> , + PSYS_PART_START_SCALE,<0,0,0>, + PSYS_PART_END_SCALE,<0.28125,0.28125,0>, + PSYS_PART_MAX_AGE,3, + PSYS_SRC_MAX_AGE,0, + PSYS_SRC_ACCEL,<0,0,0.046875>, + PSYS_SRC_BURST_PART_COUNT,8, + PSYS_SRC_BURST_RADIUS,0, + PSYS_SRC_BURST_RATE,0.0585938, + PSYS_SRC_BURST_SPEED_MIN,0.5, + PSYS_SRC_BURST_SPEED_MAX,1, + PSYS_SRC_ANGLE_BEGIN,2.09375, + PSYS_SRC_ANGLE_END,0.4375, + PSYS_SRC_OMEGA,<8,1.59375,1>, + PSYS_SRC_TEXTURE, (key)"1c79c1db-7cc0-421f-a363-499725617068", + PSYS_SRC_TARGET_KEY, llList2Key(JetTarget, i) + ]); + } + for(i=3;i<=5;i++){ + llLinkParticleSystem(llList2Integer(JetLink, i), [ + PSYS_PART_FLAGS,( 0 + |PSYS_PART_INTERP_COLOR_MASK + |PSYS_PART_INTERP_SCALE_MASK + |PSYS_PART_FOLLOW_SRC_MASK + |PSYS_PART_FOLLOW_VELOCITY_MASK + |PSYS_PART_TARGET_POS_MASK ), + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_ANGLE_CONE , + PSYS_PART_START_ALPHA,1, + PSYS_PART_END_ALPHA,0, + PSYS_PART_START_COLOR,<0.501961,0.501961,1> , + PSYS_PART_END_COLOR,<1,1,1> , + PSYS_PART_START_SCALE,<0,0,0>, + PSYS_PART_END_SCALE,<0.28125,0.28125,0>, + PSYS_PART_MAX_AGE,3, + PSYS_SRC_MAX_AGE,0, + PSYS_SRC_ACCEL,<0,0,0.046875>, + PSYS_SRC_BURST_PART_COUNT,8, + PSYS_SRC_BURST_RADIUS,0, + PSYS_SRC_BURST_RATE,0.0585938, + PSYS_SRC_BURST_SPEED_MIN,0.5, + PSYS_SRC_BURST_SPEED_MAX,1, + PSYS_SRC_ANGLE_BEGIN,2.09375, + PSYS_SRC_ANGLE_END,0.4375, + PSYS_SRC_OMEGA,<8,1.59375,1>, + PSYS_SRC_TEXTURE, (key)"1c79c1db-7cc0-421f-a363-499725617068", + PSYS_SRC_TARGET_KEY, llList2Key(JetTarget, i) + ]); + } + }else{ + for(i=0;i<=2;i++){ + llLinkParticleSystem(llList2Integer(JetLink, i), []); + } + for(i=3;i<=5;i++){ + llLinkParticleSystem(llList2Integer(JetLink, i), []); + } + } +} + +default{ + state_entry(){ + llListenRemove(ListenHandle); + ListenChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); + } + + touch(integer num){ + key id = llDetectedKey(0); + llSetTimerEvent(30.0); + ListenHandle = llListen(ListenChannel, EMPTY, EMPTY, EMPTY); + llDialog(id, "Please select option...", MainMenu, ListenChannel); + } + + listen(integer channel, string num, key id, string msg){ + llSetTimerEvent(30.0); + if(msg=="Fill"){ + WaterState = TRUE; + Water(TRUE); + }else if(msg=="Empty"){ + WaterState = FALSE; + Water(FALSE); + }else if(msg=="Steam On"){ + if(!WaterState){ + llSay(0, "You must have water in the tub to turn the Steam On."); + return; + } + Steam(TRUE); + }else if(msg=="Steam Off"){ + Steam(FALSE); + }else if(msg=="Jets On"){ + if(!WaterState){ + llSay(0, "You must have water in the tub to turn the Jets On."); + return; + } + Jets(TRUE); + }else if(msg=="Jets Off"){ + Jets(FALSE); + }else{ + llSetTimerEvent(0); + llListenRemove(ListenHandle); + } + } + + timer(){ + llSetTimerEvent(0); + llListenRemove(ListenHandle); + } +} \ No newline at end of file diff --git a/JacuzziTub/LICENSE.txt b/JacuzziTub/LICENSE.txt new file mode 100644 index 00000000..d6a93266 --- /dev/null +++ b/JacuzziTub/LICENSE.txt @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl b/Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl index 9ba925b2..71308ccd 100644 --- a/Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl +++ b/Lag Meter/Lag Meter/Object/Open Source Lag meter.lsl @@ -20,6 +20,7 @@ //Configuration: integer MeasureNonParcelPrims=FALSE; //Variables, these are dynamically set, don't bother with them. +float timertime=0.5; string region; string sim; vector color; @@ -31,30 +32,58 @@ integer minutes; integer seconds; integer lastrestartedcalc; list same_params =[PRIM_SLICE, <0.5, 1.0, 0.0>,PRIM_FULLBRIGHT,ALL_SIDES,TRUE,PRIM_TEXTURE,ALL_SIDES,TEXTURE_BLANK,ZERO_VECTOR,ZERO_VECTOR,0]; +integer toggle=1; default { state_entry() { - - llSetObjectName("Open Source Lag Meter v3"); + llSetObjectName("Open Source Lag Meter v12.1"); llSetLinkPrimitiveParams(1,same_params+[PRIM_COLOR,ALL_SIDES,<0,0,0>,.4,PRIM_SIZE,<.5,.5,4>]); - llSetLinkPrimitiveParams(2,same_params+[PRIM_COLOR,ALL_SIDES,<0,1,0>,1.,PRIM_SIZE,<.4,.4,3.8>,PRIM_POS_LOCAL,<0,0,.04>]); + llSetLinkPrimitiveParams(2,same_params+[PRIM_COLOR,ALL_SIDES,<0,1,0>,1.,PRIM_SIZE,<.4,.4,3.8>,PRIM_POS_LOCAL,<0,0,.04>,PRIM_GLOW,ALL_SIDES,0.1]); llSetText("Initalizing...",<1,1,0>, 1.0); //First start, Set some stuff. lastrestart = llGetUnixTime(); - llSetTimerEvent(0.5); //One second is too much checking. Let's not be a resource hog. + llSetTimerEvent(timertime); //One second is too much checking. Let's not be a resource hog. } + + on_rez(integer start_param) + { + llSetPos(llGetPos()+<0,0,-2.>); + } + changed(integer change) { if(change & CHANGED_REGION_START) lastrestart = llGetUnixTime(); } + + touch_start(integer num_detected) + { + key avatarKey = llDetectedKey(0); + if (avatarKey==llGetOwner()) + { + toggle=!toggle; + if(toggle==0) + { + llSetTimerEvent(0); + llSetLinkColor(2,<0.5,0.5,0.5>,ALL_SIDES); + llSetText("deactivated.\nTouch to activate.",<1,0.5,0>, 1.0); + } + else + { + llSetLinkColor(2,<0,1,0>,ALL_SIDES); + llSetTimerEvent(timertime); + } + + } + } + timer(){ region = llGetRegionName(); avatars = llGetListLength(llGetAgentList(AGENT_LIST_REGION, [])); //Restart time - lastrestartedcalc = llGetUnixTime()-lastrestart; + lastrestartedcalc = llGetUnixTime()-(integer)llGetEnv("region_start_time");//-lastrestart; days=0; hours=0; minutes=0; @@ -83,13 +112,23 @@ default color=<1,0,0>; integer primsused=llGetParcelPrimCount(llGetPos(), PARCEL_COUNT_TOTAL, MeasureNonParcelPrims); integer maxprims=llGetParcelMaxPrims(llGetPos(), MeasureNonParcelPrims); + string sim_version=llGetEnv("sim_version"); + list lsim_version=llParseString2List(sim_version,[" "],[]); + string sim_version_clean=llList2String(lsim_version,0)+" "+llList2String(lsim_version,1); llSetText( "Region: "+region+ - "\nAvatars: "+(string)avatars+ + //"\nSimChan: "+llGetEnv("sim_channel")+ + "\nSimHostn: "+llGetEnv("simulator_hostname")+ + "\nSimVrsn: "+sim_version_clean+ + "\nPhysics: "+osGetPhysicsEngineName()+ + "\nScripts: " + osGetScriptEngineName()+ +// "\nProdn: "+llGetEnv("region_product_name")+ + "\nAvas: "+(string)avatars+"/"+llGetEnv("agent_limit")+ "\nPrims left: "+(string)(maxprims-primsused)+" ("+(string)primsused+"/"+(string)maxprims+")"+ + "\nTemp on rez: "+(string)llGetParcelPrimCount(llGetPos(),PARCEL_COUNT_TEMP, FALSE)+ "\nDilation: "+llGetSubString((string)((1.-region_time_dilation)*100.), 0, 3)+"%"+ "\nFPS: "+llGetSubString((string)llGetRegionFPS(), 0, 5)+ - "\nLast restart:\n"+(string)days+" Days, "+(string)hours+" Hours, "+(string)minutes+" Minutes, and "+(string)seconds+" Seconds ago.", + "\nLast restart:\n"+(string)days+" days, "+(string)hours+" hrs, "+(string)minutes+" min, and "+(string)seconds+" sec ago.", //"\nLast restart:\n"+(string)days+":"+(string)hours+":"+(string)minutes+":"+(string)seconds, color, 1.0); //llSetLinkPrimitiveParamsFast(2,[PRIM_SLICE,<0,(region_time_dilation),0>,PRIM_COLOR,ALL_SIDES,color,1]); diff --git a/Land to Sculpt/Land to Sculpt.txt b/Land to Sculpt/Land to Sculpt.txt new file mode 100644 index 00000000..721a9538 --- /dev/null +++ b/Land to Sculpt/Land to Sculpt.txt @@ -0,0 +1,93 @@ +string int2hex(integer x) +{ + string hex="0123456789ABCDEF"; + return llGetSubString(hex, (x >> 4), (x >> 4)) + + llGetSubString(hex, x & 0xF, x & 0xF); +} + +default +{ + state_entry() + { + llOwnerSay("Script running"); + } + + touch_end(integer touched) + { + if (llDetectedKey(0) == llGetOwner()) + { + llOwnerSay("Starting..."); + + float mapX = 0.0; + float mapY = 0.0; + float mapZ = 0.0; + + integer x = 0; + integer y = 0; + integer z = 0; + + integer offsetX = 0; + integer offsetY = 0; + + string colorX = ""; + string colorY = ""; + string colorZ = ""; + + string draw = osSetPenSize("", 1); + + vector pos = llGetPos(); + + for (; y < 64; y++) + { + draw = osMovePen(draw, 0, y); + + offsetX = 0; + if (y == 63) offsetY = 1; + + for (x = 0; x < 64; x++) + { + if (x == 63) offsetX = 1; + + mapX = ((float)x + offsetX) / 2.0 - 16.0; + mapY = ((float)y + offsetY) / 2.0 - 16.0; + mapZ = llGround(); + + if (mapZ > (pos.z + 16.0)) z = 255; + else if (mapZ < (pos.z - 16.0)) z = 0; + else { z = llRound((mapZ - (pos.z - 16.0)) * 8.0); } + + if (x == 63) colorX = "FF"; + else colorX = int2hex(x * 4); + if (y == 63) colorY = "FF"; + else colorY = int2hex(y * 4); + if (z == 256) colorZ = "FF"; + else colorZ = int2hex(z); + + draw = osSetPenColor(draw, "FF" + colorX + colorY + colorZ); + draw = osDrawLine(draw, x, y, x + 1, y); + } + } + osSetDynamicTextureDataBlendFace("", "vector", draw, "width:64,height:64", FALSE, 2, 0, 255, 1); + + + + + llSetPrimitiveParams([PRIM_SIZE, <32.0, 32.0, 32.0>, + PRIM_TYPE, PRIM_TYPE_SCULPT, + llGetTexture(1), + PRIM_SCULPT_TYPE_PLANE | PRIM_SCULPT_FLAG_INVERT]); + + state done; + } + } +} + +state done +{ + state_entry() + { + llSetClickAction(CLICK_ACTION_NONE); + llOwnerSay("Done."); + //llRemoveInventory(llGetScriptName()); + } +} \ No newline at end of file diff --git a/Lucky Chair/LICENSE.txt b/Lucky Chair/LICENSE.txt new file mode 100644 index 00000000..d6a93266 --- /dev/null +++ b/Lucky Chair/LICENSE.txt @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/Lucky Chair/Lucky Chair Engine.lsl b/Lucky Chair/Lucky Chair Engine.lsl new file mode 100644 index 00000000..1b8bb71e --- /dev/null +++ b/Lucky Chair/Lucky Chair Engine.lsl @@ -0,0 +1,106 @@ +key Sitter = NULL_KEY; +list Prizes; +string TimerMode; +integer TimerRoundCount; +integer TimerCountDown = 10; +list Players; +string SittingAnim = "Sit 1"; + +// Init Function +Init(){ + integer NumPrizes = llGetInventoryNumber(INVENTORY_OBJECT); + integer i; + for(i=0;i0){ + llLinkSitTarget(1, <0,0,0.1>, ZERO_ROTATION); + llOwnerSay("System Ready!"); + } +} + +PickWinner(){ + float Num = llFrand(10.0); + if((integer)Num > 5){ + integer NumPrizes = llGetListLength(Prizes); + string Prize = llList2String(Prizes, (integer)llFrand((NumPrizes - 1))); + llShout(0, "We have a WINNER! Prize Won: "+Prize); + llRegionSayTo(Sitter, 0, "You are a WINNER! You have won the "+Prize); + llGiveInventory(Sitter, Prize); + Players = Players + [Sitter]; + llUnSit(Sitter); + Sitter = NULL_KEY; + }else{ + Players = Players + [Sitter]; + llRegionSayTo(Sitter, 0, "Better Luck Next Time!"); + llUnSit(Sitter); + Sitter = NULL_KEY; + } +} + +default{ + on_rez(integer params){ + llResetScript(); + } + + state_entry(){ + Init(); + } + + changed(integer change){ + if(change & CHANGED_INVENTORY){ + llResetScript(); + } + + if(change & CHANGED_LINK){ + key sitterKey=llAvatarOnLinkSitTarget(1); + if (Sitter==NULL_KEY && sitterKey!=NULL_KEY) // someone sitting down + { + Sitter=sitterKey; + llRegionSayTo(Sitter, 0, "Please Accept Animation Permissions to start the Lucky Chair!"); + TimerMode = "Sitting"; + llSetTimerEvent(15.0); + llRequestPermissions(Sitter,PERMISSION_TRIGGER_ANIMATION); + }else if (Sitter!=NULL_KEY && sitterKey==NULL_KEY){ + Sitter = NULL_KEY; + llSetTimerEvent(0); + }else if (Sitter!=NULL_KEY && sitterKey!=Sitter) // someone sitting but object already occupied by someone else + { + llUnSit(sitterKey); + llRegionSayTo(sitterKey,0,"Sorry, someone else is already sitting here, Please wait..."); + } + return; + } + } + + run_time_permissions(integer perms){ + if(perms & PERMISSION_TRIGGER_ANIMATION){ + TimerMode = "CountDown"; + llStopAnimation("stand"); + llStartAnimation(SittingAnim); + llShout(0, "We have a player for the lucky chair!\n Counting Down..."); + llSetTimerEvent(1.0); + } + } + + timer(){ + if(TimerMode=="Sitting"){ + llStopAnimation(SittingAnim); + llStartAnimation("stand"); + llUnSit(Sitter); + llSleep(1.0); + llResetScript(); + }else if(TimerMode=="CountDown"){ + if(TimerRoundCount==0){ + TimerRoundCount = TimerCountDown; + llSetTimerEvent(0); + PickWinner(); + }else{ + llShout(0, "Picking a Winner in "+(string)TimerRoundCount+" seconds..."); + TimerRoundCount--; + } + } + } +} \ No newline at end of file diff --git a/Metors/DayChecker1_00.lsl b/Metors/DayChecker1_00.lsl new file mode 100644 index 00000000..88e3b1bd --- /dev/null +++ b/Metors/DayChecker1_00.lsl @@ -0,0 +1,52 @@ +//DayChecker 1.0 + +// Simple script for testing day/night time and give a shout if daytime changes + +// GLOBALS + + integer Debug = FALSE ; + integer time_check = 20 ; // periode om nacht te checken + integer Gchannel = 10001 ; // General channel for daycheck + +default // default daytime state +{ + state_entry() + { + llRegionSay(Gchannel, "Day"); + llSetTimerEvent(time_check); // Checks default every 120 secs = 2 minutes + } + timer() // If timer reached ... + { + vector sun = llGetSunDirection(); // Gets Sun Direction as a vector + if (sun.z < 0) state nighttime; // If its night goes to state nighttime + llOwnerSay("It's daytime " + (string)sun.z); // Says to Owner its daytime + } + touch_start(integer total_number) // If touched ... + { + key lAvatarKey = llDetectedKey(0) ; + string lAvatarName = llKey2Name(llDetectedKey(0)) ; + state nighttime; + } +} + +state nighttime // nighttime state + +{ + state_entry() + { + llRegionSay(Gchannel, "Night"); + llSetTimerEvent(time_check); // Checks default every 120 secs = 2 minutes + + } + timer() // If timer reached .... + { + vector sun = llGetSunDirection(); // Gets Sun Direction as a vector + if (sun.z > 0) state default; // If its day, change back to daytime state + llOwnerSay("It's nighttime " + (string)sun.z); // Says to Owner its daytime + } + touch_start(integer total_number) // If touched ... + { + llWhisper(0,"Nighttime"); // Says to Owner its nighttime + state default; + } +} \ No newline at end of file diff --git a/Metors/Meteors.jpg b/Metors/Meteors.jpg new file mode 100644 index 00000000..560a99c7 Binary files /dev/null and b/Metors/Meteors.jpg differ diff --git a/Metors/Meteors.lsl b/Metors/Meteors.lsl new file mode 100644 index 00000000..864804ae --- /dev/null +++ b/Metors/Meteors.lsl @@ -0,0 +1,74 @@ +// Name:meteors.lsl +// Author:JPvdGiessen IT Consultancy + + integer Debug = FALSE ; + integer Gchannel =10001; // Channel for DayChecker + + vector color = <1,1,1>; // Use to change the color of the light + float intensity = 1.000; // Use to change the intensity of the light, from 0 to 1 + float radius = 1.000; // Use to change the radius of the light, from 0 to 20 + float falloff = 0.150; // Use to set the falloff of the light, from 0 to 2 + +particlesOn() +{ + integer flags = 0; + flags = flags | PSYS_PART_EMISSIVE_MASK | PSYS_PART_INTERP_COLOR_MASK; +// flags = flags | PSYS_PART_FOLLOW_SRC_MASK; + flags = flags | PSYS_PART_FOLLOW_VELOCITY_MASK; + + llParticleSystem([ PSYS_PART_MAX_AGE, 50.5, + PSYS_PART_FLAGS, flags, + PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>, + PSYS_PART_END_COLOR, <1.0, 1.0, 0.8>, + PSYS_PART_START_SCALE, <0.3,0.3,0.3>, + PSYS_PART_END_SCALE, <0.5,0.5,0.5>, + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE, + PSYS_SRC_BURST_RATE, 1, + PSYS_SRC_ACCEL, <0,1.0,0>, + PSYS_SRC_BURST_PART_COUNT, 5, + PSYS_SRC_BURST_SPEED_MIN, 0.05, + PSYS_SRC_BURST_SPEED_MAX, 25.0, + PSYS_SRC_INNERANGLE, 0.5, + PSYS_SRC_OUTERANGLE, 0.0, + PSYS_SRC_OMEGA, <0,0,0>, + PSYS_PART_START_ALPHA, 1.0, + PSYS_PART_END_ALPHA, 0.25, + PSYS_SRC_BURST_RADIUS, 4.5 + ]); +} + +particlesOff() +{ + llParticleSystem([]); +} + +default +{ + state_entry() + { + llSay(0, "Script running"); + llListen (Gchannel, "", "", ""); + } + + listen(integer channel, string name, key id, string message) + { + if ( message == "Night") + { + particlesOn() ; + llSetPrimitiveParams( [ PRIM_GLOW, ALL_SIDES, 0.3 ] ) ; + llSetPrimitiveParams([PRIM_POINT_LIGHT,TRUE, + <1.0,0.7,1.0>, // light color vector range: 0.0-1.0 *3 + intensity, // intensity (0.0-1.0) + radius, // radius (.1-10.0) + falloff ]); // falloff (.01-1.0) + llSetAlpha(1.0, ALL_SIDES); + } else if ( message == "Day") { + particlesOff() ; + llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]); + llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, // if this is false, light is off, + <0.0,1.0,0.0>,1.0, 10.0, 0.5]); // rest of params don't matter + llSetPrimitiveParams( [ PRIM_GLOW, ALL_SIDES, 0 ] ) ; + llSetAlpha(0.0, ALL_SIDES); + } + } +} \ No newline at end of file diff --git a/Metors/readme.txt b/Metors/readme.txt new file mode 100644 index 00000000..54aa489e --- /dev/null +++ b/Metors/readme.txt @@ -0,0 +1,11 @@ +Name: Meteors, Particle Script +Author: J.P. van de Giessen (J.P. van de Giessen IT Consultancy, www.giessenict.nl) +Mail: tersus@solcon.nl +Creation Date: 9 jul 2012 +Release: 1.01 +Description: Create a prime (like a sphere), place the Meteor.lsl script in it and put the sphere on a height of about 60 meters. Create a second prim and + place the DayChecker script in it. Both prims must be in the same region. At night you will see the meteors, or if you can't wait, touch the DayChecker prim. + If you use it in your own environment, please sent an image to me. +License: This object is created by J.P. van de Giessen IT Consultancy (www.giessenict.nl) and is published under the following copyrights: + Creative Commons Naamsvermelding-NietCommercieel-GelijkDelen 3.0 Nederland license (http://creativecommons.org/licenses/by-nc-sa/3.0/nl/). + diff --git a/Music+Player+CD+Script/Music+Player+CD+Script.lsl b/Music+Player+CD+Script/Music+Player+CD+Script.lsl new file mode 100644 index 00000000..5ecf76df --- /dev/null +++ b/Music+Player+CD+Script/Music+Player+CD+Script.lsl @@ -0,0 +1,240 @@ +//Multi File Sound Player For Music Or Sounds Works Without Needing File Name changing If Named Right +//Script auto determin order of list of sound files in alphbetical order + +float INTERVAL = 10.00; + +integer LISTEN_CHAN = 2000; +integer SEND_CHAN = 2001; +float VOLUME = 1.0; + +integer g_iSound; +integer tottrack; +integer g_iListenCtrl = -1; +integer g_iPlaying; +integer g_iLinked; +integer g_iStop; +integer g_iPod; +string g_sLink; + +// DEBUG +integer g_iWasLinked; +integer g_iFinished; + +Initialize() +{ + // reset listeners + if ( g_iListenCtrl != -1 ) + { + llListenRemove(g_iListenCtrl); + } + g_iListenCtrl = llListen(LISTEN_CHAN,"","",""); + g_iPlaying = 0; + g_iLinked = 0; +} + + + +PlaySong() +{ + integer i; + + g_iPlaying = 1; + llSetSoundQueueing(TRUE); + tottrack = llGetInventoryNumber(INVENTORY_SOUND); + llPlaySound(llGetInventoryName(INVENTORY_SOUND, 0),VOLUME); + llPreloadSound(llGetInventoryName(INVENTORY_SOUND, 1)); + llSetTimerEvent(5.0); // wait 5 seconds before queueing the second file + g_iSound = 1; +// for ( i = 1; i < tottrack; i++ ) +// { +// llPreloadSound(llGetInventoryName(INVENTORY_SOUND, i)); +// } +} + + +StopSong() +{ + + g_iPlaying = 0; + llStopSound(); + llSetTimerEvent(0.0); + +} + + +integer CheckLink() +{ + string sLink; + + sLink = llGetLinkName(1); + g_sLink = sLink; + if ( llGetSubString(sLink,0,6) == "Jukebox" ) + { + return TRUE; + } + return FALSE; +} + + +default +{ + state_entry() + { + Initialize(); + } + + on_rez(integer start_param) + { + Initialize(); + if ( start_param ) + { + g_iPod = start_param - 1; + if ( g_iPod ) + { + llRequestPermissions(llGetOwner(),PERMISSION_ATTACH); + } else { + // Tell the controller what the CD key is so it can lin + } + } + } + + changed(integer change) + { + if ( change == CHANGED_LINK ) + { + if ( llGetLinkNumber() == 0 ) + { + StopSong(); + llDie(); + } else { + if ( g_iStop ) + { + llMessageLinked(1,llGetLinkNumber(),"UNLINK",""); + } else { + llMessageLinked(1,llGetLinkNumber(),"LINKID",""); + g_iWasLinked = 1; + } + } + } + } + + attach(key id) + { + if ( id == NULL_KEY ) + { + llDie(); + } else { + PlaySong(); + } + } + + run_time_permissions(integer perm) + { + if ( perm == PERMISSION_ATTACH ) + { + llAttachToAvatar(ATTACH_LSHOULDER); + llSetTexture("clear",ALL_SIDES); + } + } + + touch_start(integer total_number) + { + integer i; + + for ( i = 0; i < total_number; i++ ) + { + if ( llDetectedKey(i) == llGetOwner() ) + { + if ( g_iPlaying ) + { + g_iPlaying = 0; + llStopSound(); + llSetTimerEvent(0.0); + } else { + PlaySong(); + } + } + } + } + + listen(integer channel, string name, key id, string message) + { + if ( message == "RESET" ) + { + if ( llGetLinkNumber() == 0 ) + { + llDie(); + } else { + llMessageLinked(1,llGetLinkNumber(),"UNLINK",""); + } + } + + if ( message == "STOP" ) + { + if ( g_iPod ) + { + StopSong(); + llDetachFromAvatar(); + } + } + } + + link_message(integer sender_num, integer num, string str, key id) + { + if ( str == "PLAY" ) + { + if ( !g_iPlaying ) + { + PlaySong(); + } + return; + } + + if ( str == "STOP" ) + { + g_iStop = 1; + StopSong(); + llMessageLinked(1,llGetLinkNumber(),"UNLINK",""); + } + + if ( str == "VOLUME" ) + { + VOLUME = (float)num / 10.0; + llAdjustSoundVolume(VOLUME); + } + } + + timer() + { + if ( g_iPlaying ) + { + if ( g_iSound == 1 ) + { + llSetTimerEvent(INTERVAL); + } + llPlaySound(llGetInventoryName(INVENTORY_SOUND, g_iSound),VOLUME); + if ( g_iSound < (tottrack - 1) ) + { + llPreloadSound(llGetInventoryName(INVENTORY_SOUND, g_iSound+1)); + } + g_iSound++; + if ( g_iSound >= tottrack ) + { + llSetTimerEvent(INTERVAL + 5.0); + g_iPlaying = 0; + } + } else { + if ( llGetLinkNumber() != 0 ) + { + llSetTimerEvent(0.0); + if ( g_iPod ) + { + llDetachFromAvatar(); + } else { + llMessageLinked(1,0,"FINISH",""); + g_iFinished = 1; + } + } + } + } +} diff --git a/Networked Teleporter/DialogControl.lsl b/Networked Teleporter/DialogControl.lsl new file mode 100644 index 00000000..b87aa49a --- /dev/null +++ b/Networked Teleporter/DialogControl.lsl @@ -0,0 +1,525 @@ +// ********** SIMPLE DIALOG MODULE ********** // +// By Nargus Asturias +// Version 1.80 +// +// Support only one dialog at a time. DO NOT request multiple dialog at once! +// Use of provided functions are recommented. Instruction here are for hardcore programmers only! +// +// Request: Send MessageLinked to the script. There are 3 dialog modes: +// lnkDialog : Normal dialog with message and buttons +// lnkDialogNumericAdjust : A dialog with buttons can be used to adjust numeric value +// lnkDialogNotify : Just a simple notification dialog. No return value and no buttons. +// +// Send MessageLinked with code lnkDialogReshow to force active dialog to reappear. +// Send MessageLinked with code lnkDialogCancel to force cancel active dialog +// +// If a lnkDialog is requested with more than 12 buttons, multi-pages dialog is used to show the buttons. +// +// [ For lnkDialog ] +// MessageLinked Format: +// String part: List dumped into string, each entry seperated by '||' +// Field 1: Dialog message (512 bytes maximum) +// Field 2: Time-out data (integer) +// Field 3-4: Button#1 and return value pair +// Field 5-6: Button#2 and return value pair +// And go on... +// Key part: Key of AV who attend this dialog +// +// Response: MessageLinked to the prim that requested dialog (but no where else) +// num == lnkDialogResponse: AV click on a button. The buttons value returned as a string +// num == lnkDialogTimeOut: Dialog timeout. +// +// [ For lnkDialogNumericAdjust ] +// MessageLinked Format: +// String part: List dumped into string, each entry seperated by '||' +// Field 1: Dialog message (512 bytes maximum) +// Put {VALUE} where you want the current value to be displayed) +// Field 2: Time-out data (integer) +// Field 3: Most significant value (ie. 100, for +/-100) +// Field 4: String-casted numeric value to be adjusted +// Field 5: 2nd most significant value (ie. 10, for +/-10) +// Field 6: Use '1' to enable "+/-" button, '0' otherwise. +// Field 7: 3nd significant value (ie. 1, for +/-1) +// Field 8: Use '1' for integer, or '0' for float +// Field 9: Least significant value (ie. 0.1, for +/-0.1) +// Field 10: Reserved. Not used. +// Key part: Key of AV who attend this dialog +// +// Response: MessageLinked to the prim that requested dialog (but no where else) +// num == lnkDialogResponse: OK or Cancel button is clicked. The final value returned as string. +// num == lnkDialogTimeOut: Dialog timeout. +// +// ******************************************* // + +// Constants +integer lnkDialog = 14001; +integer lnkDialogNumericAdjust = 14005; +integer lnkDialogNotify = 14004; + +integer lnkDialogReshow = 14011; +integer lnkDialogCancel = 14012; + +integer lnkDialogResponse = 14002; // A button is hit, or OK is hit for lnkDialogNumericAdjust +integer lnkDialogCanceled = 14006; // Cancel is hit for lnkDialogNumericAdjust +integer lnkDialogTimeOut = 14003; // No button is hit, or Ignore is hit + +integer lnkMenuClear = 15001; +integer lnkMenuAdd = 15002; +integer lnkMenuShow = 15003; +integer lnkMenuNotFound = 15010; + +string seperator = "||"; + +// Menus variables +list menuNames = []; // List of names of all menus +list menus = []; // List of packed menus command, in order of menuNames + +integer lastMenuIndex = 0; // Latest called menu's index + +// Dialog variables +integer dialogChannel; // Channel number used to spawn this dialog +string message; // Message to be shown with the dialog +integer timerOut; // Dialog time-out +key keyId; // Key of user who attending this dialog +integer requestedNum; // Link-number of the requested prim +list buttons; // List of dialog buttons +list returns; // List of results from dialog buttons + +float numericValue; +integer useInteger; + +// Other variables +integer buttonsCount; +integer startItemNo; +integer listenId; + +string redirectState; + +integer responseInt = -1; +string responseStr; +key responseKey; + +list order_buttons(list buttons) +{ + return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10); +} + + +// ********** String Functions ********** +string replaceString(string pattern, string replace, string source){ + integer index = llSubStringIndex(source, pattern); + if(index < 0) return source; + + source = llDeleteSubString(source, index, (index + llStringLength(pattern) - 1)); + return llInsertString(source, index, replace); +} + +// ********** Dialog Functions ********** +// Function: createDialog +// Create dialog with given message and buttons, direct to user with give id +integer createDialog(key id, string message, list buttons){ + integer channel = -((integer)llFrand(8388608))*(255) - (integer)llFrand(8388608) - 11; + + llListenRemove(listenId); + listenId = llListen(channel, "", keyId, ""); + llDialog(keyId, message, order_buttons(buttons), channel); + + return channel; +} + +// Function: createMultiDialog +// Create dialog with multiple pages. Each page has Back, Next, and a Close button. Otherwise same functionality as createDialog() function. +integer createMultiDialog(key id, string message, list buttons, integer _startItemNo){ + integer channel = -llRound(llFrand( llFabs(llSin(llGetGMTclock())) * 1000000 )) - 11; + + if(_startItemNo < 0) _startItemNo = 0; + if(_startItemNo >= buttonsCount - 1) _startItemNo -= 9; + startItemNo = _startItemNo; + + integer vButtonsCount = buttonsCount - 2; + + // Generate list of buttons to be shown + string closeButton = llList2String(buttons, buttonsCount - 1); + + integer stopItemNo = startItemNo + 8; + if(stopItemNo >= buttonsCount - 1) stopItemNo = vButtonsCount; + + list thisButtons = llList2List(buttons, startItemNo, stopItemNo); + + // Generate dialog navigation buttons + integer i = stopItemNo - startItemNo + 1; + i = i % 3; + if(i > 0) + { + while(i < 3) + { + thisButtons += [" "]; + i++; + } + } + + if(startItemNo > 0) + thisButtons += ["<< BACK"]; + else thisButtons += [" "]; + + thisButtons += [closeButton]; + + if(stopItemNo < vButtonsCount) + thisButtons += ["NEXT >>"]; + else thisButtons += [" "]; + + // Append page number to the message + integer pageNumber = (integer)(stopItemNo / 9) + 1; + integer pagesCount = llCeil(vButtonsCount / 9.0); + string vMessage = "PAGE: " + (string)pageNumber + " of " + (string)pagesCount + "\n" + + message; + + // Display dialog + llListenRemove(listenId); + listenId = llListen(channel, "", keyId, ""); + llDialog(keyId, vMessage, order_buttons(thisButtons), channel); + + return channel; +} + +// Function: generateNumericAdjustButtons +// Generate numeric adjustment dialog which adjustment values are in given list. +// If useNegative is TRUE, "+/-" button will be available. +list generateNumericAdjustButtons(list adjustValues, integer useNegative){ + list dialogControlButtons; + list positiveButtons; + list negativeButtons; + list additionButtons; + + dialogControlButtons = ["OK", "Cancel"]; + + // Config adjustment buttons + integer count = llGetListLength(adjustValues); + integer index; + for(index = 0; (index < count) && (index < 3); index++){ + string sValue = llList2String(adjustValues, index); + + if((float)sValue != 0){ + positiveButtons += ["+" + sValue]; + negativeButtons += ["-" + sValue]; + } + } + + // Check positive/negative button + if(useNegative) + additionButtons = ["+/-"]; + else additionButtons = []; + + // If there is fourth adjustment button + if(count > 3){ + if(llGetListLength(additionButtons) == 0) additionButtons = [" "]; + + string sValue = llList2String(adjustValues, index); + additionButtons += ["+" + sValue, "-" + sValue]; + }else if(additionButtons != []) additionButtons += [" ", " "]; + + // Return list dialog buttons + return additionButtons + negativeButtons + positiveButtons + dialogControlButtons; +} + +setResponse(integer int, string str, key id){ + responseInt = int; + responseStr = str; + responseKey = id; +} + +checkDialogRequest(integer sender_num, integer num, string str, key id){ + if((num == lnkDialogNotify) || (num == lnkDialogNumericAdjust) || (num == lnkDialog)){ + list data = llParseStringKeepNulls(str, [seperator], []); + + message = llList2String(data, 0); + timerOut = llList2Integer(data, 1); + keyId = id; + requestedNum = sender_num; + buttons = []; + returns = []; + + if(message == "") message = " "; + if(timerOut > 7200) timerOut = 7200; + integer i; + integer count; + count = llGetListLength(data); + for(i=2; i 12) + redirectState = "MultiDialog"; + else redirectState = "Dialog"; + } + + if(TRUE) state StartDialog; + }else checkMenuRequest(sender_num, num, str, id); +} + +// ********** Menu Functions ********** +clearMenusList(){ + menuNames = []; + menus = []; + + lastMenuIndex = 0; +} + +addMenu(string name, string message, list buttons, list returns){ + // Reduced menu request time by packing request commands + string packed_message = message + seperator + "0"; + + integer i; + integer count = llGetListLength(buttons); + for(i=0; i= 0) + menus = llListReplaceList(menus, [packed_message], index, index); + else{ + menuNames += [name]; + menus += [packed_message]; + } +} + +integer showMenu(string name, key id){ + if(llGetListLength(menuNames) <= 0) return FALSE; + + integer index; + if(name != ""){ + index = llListFindList(menuNames, [name]); + if(index < 0) return FALSE; + }else index = lastMenuIndex; + + lastMenuIndex = index; + + // Load menu command and execute + string packed_message = llList2String(menus, index); + llMessageLinked(LINK_THIS, lnkDialog, packed_message, id); + return TRUE; +} + +checkMenuRequest(integer sender_num, integer num, string str, key id){ + // Menu response commands + if(num == lnkDialogResponse){ + if(llGetSubString(str, 0, 4) == "MENU_"){ + str = llDeleteSubString(str, 0, 4); + showMenu(str, id); + } + } + + // Menu management commands + else if(num == lnkMenuClear) + clearMenusList(); + else if(num == lnkMenuAdd){ + list data = llParseString2List(str, [seperator], []); + + string message = llList2String(data, 0); + list buttons = []; + list returns = []; + + integer i; + integer count = llGetListLength(data); + for(i=2; i 0) llMessageLinked(requestedNum, responseInt, responseStr, responseKey); + } + + link_message(integer sender_num, integer num, string str, key id){ + checkDialogRequest(sender_num, num, str, id); + } +} + +state StartDialog{ + state_entry(){ + if(redirectState == "Dialog") state Dialog; + else if(redirectState == "MultiDialog") state MultiDialog; + else if(redirectState == "NumericAdjustDialog") state NumericAdjustDialog; + else state default; + } +} + +state Dialog{ + state_entry(){ + responseInt = -1; + dialogChannel = createDialog(keyId, message, buttons); + llSetTimerEvent(timerOut); + } + + state_exit(){ + llSetTimerEvent(0); + } + + on_rez(integer start_param){ + state default; + } + + timer(){ + setResponse(lnkDialogTimeOut, "", keyId); + state default; + } + + link_message(integer sender_num, integer num, string str, key id){ + if(num == lnkDialogReshow){ + dialogChannel = createDialog(keyId, message, buttons); + llSetTimerEvent(timerOut); + }else if(num == lnkDialogCancel) state default; + + else checkDialogRequest(sender_num, num, str, id); + } + + listen(integer channel, string name, key id, string msg){ + if((channel != dialogChannel) || (id != keyId)) return; + + integer index = llListFindList(buttons, [msg]); + setResponse(lnkDialogResponse, llList2String(returns, index), keyId); + state default; + } +} + +state MultiDialog { + state_entry(){ + responseInt = -1; + startItemNo = 0; + dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo); + llSetTimerEvent(timerOut); + } + + state_exit(){ + llSetTimerEvent(0); + } + + on_rez(integer start_param){ + state default; + } + + timer(){ + setResponse(lnkDialogTimeOut, "", keyId); + state default; + } + + link_message(integer sender_num, integer num, string str, key id){ + if(num == lnkDialogReshow){ + dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo); + llSetTimerEvent(timerOut); + }else if(num == lnkDialogCancel) state default; + + else checkDialogRequest(sender_num, num, str, id); + } + + listen(integer channel, string name, key id, string msg){ + if((channel != dialogChannel) || (id != keyId)) return; + + // Dialog control buttons + if(msg == "<< BACK"){ + dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo - 9); + llSetTimerEvent(timerOut); + }else if(msg == "NEXT >>"){ + dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo + 9); + llSetTimerEvent(timerOut); + }else if(msg == " "){ + dialogChannel = createMultiDialog(keyId, message, buttons, startItemNo); + llSetTimerEvent(timerOut); + + // Response buttons + }else{ + integer index = llListFindList(buttons, [msg]); + setResponse(lnkDialogResponse, llList2String(returns, index), keyId); + state default; + } + } +} + +state NumericAdjustDialog { + state_entry(){ + responseInt = -1; + + numericValue = llList2Float(returns, 0); + useInteger = llList2Integer(returns, 2); + buttons = generateNumericAdjustButtons(buttons, llList2Integer(returns, 1)); + + string vMessage; + if(useInteger) + vMessage = replaceString("{VALUE}", (string)((integer)numericValue), message); + else vMessage = replaceString("{VALUE}", (string)numericValue, message); + + dialogChannel = createDialog(keyId, vMessage, buttons); + llSetTimerEvent(timerOut); + } + + state_exit(){ + llSetTimerEvent(0); + } + + on_rez(integer start_param){ + state default; + } + + timer(){ + setResponse(lnkDialogTimeOut, "", keyId); + state default; + } + + link_message(integer sender_num, integer num, string str, key id){ + if(num == lnkDialogReshow){ + dialogChannel = createDialog(keyId, message, buttons); + llSetTimerEvent(timerOut); + }else if(num == lnkDialogCancel) state default; + + else checkDialogRequest(sender_num, num, str, id); + } + + listen(integer channel, string name, key id, string msg){ + if((channel != dialogChannel) || (id != keyId)) return; + + // Dialog control button is hit + if(msg == "OK"){ + setResponse(lnkDialogResponse, (string)numericValue, keyId); + state default; + }else if(msg == "Cancel"){ + setResponse(lnkDialogCanceled, (string)numericValue, keyId); + llMessageLinked(requestedNum, lnkDialogCanceled, (string)numericValue, keyId); + state default; + + // Value adjustment button is hit + }else if(msg == "+/-") + numericValue = -numericValue; + else if(llSubStringIndex(msg, "+") == 0) + numericValue += (float)llDeleteSubString(msg, 0, 0); + else if(llSubStringIndex(msg, "-") == 0) + numericValue -= (float)llDeleteSubString(msg, 0, 0); + + // Spawn another dialog if no OK nor Cancel is hit + string vMessage; + if(useInteger) + vMessage = replaceString("{VALUE}", (string)((integer)numericValue), message); + else vMessage = replaceString("{VALUE}", (string)numericValue, message); + dialogChannel = createDialog(keyId, vMessage, buttons); + llSetTimerEvent(timerOut); + } +} \ No newline at end of file diff --git a/Networked Teleporter/Manual.txt b/Networked Teleporter/Manual.txt new file mode 100644 index 00000000..4eb549f4 --- /dev/null +++ b/Networked Teleporter/Manual.txt @@ -0,0 +1,28 @@ +Telepad Instructions + +This Networked Telepad system allows you to +create teleport points throughout a region. +Its almost too easy to use. + +1) Simply Rez a pad where you want a TP Point. +2) Edit the description (*not* the name) of + the object to the name of the place + (House, Pool, Skybox, etc...) +3) Click on the telepad, and choose "Reset" + from the dialog box. Only the owner can do this. + (this adds the telepad to the network) + +**Important** if you move a telepad, or delete one, + you must use "Reset" to be sure all telepads receive + the changes. (Reset just the one you moved, not all of them) + + To use it, touch it, choose the destination, then right + click it and choose Teleport. + + ** advanced configuration options ** + If the description starts with a minus (for example -Beach) + then the telepad will serve as a direct telepad to that location. + + To change the channel number for the network. Changet the number proceeding the colon in the + teleport pads description. + For example Beach:-99999 diff --git a/Networked Teleporter/Teleport Manager.lsl b/Networked Teleporter/Teleport Manager.lsl new file mode 100644 index 00000000..11b8e053 --- /dev/null +++ b/Networked Teleporter/Teleport Manager.lsl @@ -0,0 +1,351 @@ +// +// Telepad Instructions +// +// This Networked Telepad system allows you to +// create teleport points throughout a region. +// Its almost too easy to use. +// +// 1) Simply Rez a pad where you want a TP Point. +// 2) Edit the description (*not* the name) of +// the object to the name of the place +// (House, Pool, Skybox, etc...) +// 3) Click on the telepad, and choose "Reset" +// from the dialog box. Only the owner can do this. +// (this adds the telepad to the network) +// +// InWorldz and OpenSim 0.6.9 (osgrid and others) Caviat! (fixed in 0.7.1) +// Don't rotate the prim! Be sure it is set to Rotation 0,0,0 +// There is a little bug that prevents the teleporter from dropping +// you off in the right place. However, when the bug is fixed, this script +// should work even with rotations, or child rotaions, unless rotations will +// be working differently than the other place. Also, if it is inside a child +// prim, it is likely to have rotation issues as well. +// +// **Important** if you move a telepad, or delete one, +// you must use "Reset" to be sure all telepads receive +// the changes. (Reset just the one you moved, not all of them) +// +// To use it, touch it, choose the destination, then right +// click it and choose Teleport. +// +// ** advanced ** +// If the description starts with a minus (for example -Beach) +// then the telepad will serve as a direct telepad to that // // location. +// +// To use a special channel number for the network other +// than the default.. add colon channel number to the description. +// For example Beach:-99999 +// + + + + +integer network_channel = -23423432; // default +integer dialog_channel = 0; + +integer same_owner = TRUE; +integer directMode = FALSE; +float timeout = 15.0; + +string myname; +list pads; + +string destination; + +integer collecting = FALSE; + +//== dialog control stuff + +// ********** DIALOG FUNCTIONS ********** +// Dialog constants +integer lnkDialog = 14001; +integer lnkDialogNotify = 14004; +integer lnkDialogResponse = 14002; +integer lnkDialogTimeOut = 14003; + +integer lnkDialogReshow = 14011; +integer lnkDialogCancel = 14012; + +integer lnkMenuClear = 15001; +integer lnkMenuAdd = 15002; +integer lnkMenuShow = 15003; + +string seperator = "||"; +integer dialogTimeOut = 0; + +string packDialogMessage(string message, list buttons, list returns){ + string packed_message = message + seperator + (string)dialogTimeOut; + + integer i; + integer count = llGetListLength(buttons); + for(i=0; i 24) button = llGetSubString(button, 0, 23); + packed_message += seperator + button + seperator + llList2String(returns, i); + } + + return packed_message; +} + +dialogReshow(){llMessageLinked(LINK_THIS, lnkDialogReshow, "", NULL_KEY);} +dialogCancel(){ + llMessageLinked(LINK_THIS, lnkDialogCancel, "", NULL_KEY); + llSleep(1); +} + +dialog(key id, string message, list buttons, list returns){ + llMessageLinked(LINK_THIS, lnkDialog, packDialogMessage(message, buttons, returns), id); +} + +dialogNotify(key id, string message){ + list rows; + + llMessageLinked(LINK_THIS, lnkDialogNotify, + message + seperator + (string)dialogTimeOut + seperator, + id); +} +// ********** END DIALOG FUNCTIONS ********** + + + + +dotext() +{ + +string tex = "Telepad\n"; + if (directMode) + { + tex += "Direct Teleport to "+myname; + llSetSitText("Teleport"); + } + else + { + if (destination != "") + { + tex += "Click to go to "+destination + + "\n.\nRight-Click->Touch\nfor another Destination\n"; + llSetSitText("Teleport"); + } + else + { + tex += "Click to choose Destination\n"; + llSetSitText("."); + } + } + llSetText(tex,<1.0,1.0,1.0>,1.0); +} + +pinger() +{ + if (directMode) return; + llRegionSay(network_channel,llDumpList2String( + [ myname, llGetPos(), llGetRot() ], ":")); +} + +setupMenus() +{ + + llMessageLinked(LINK_THIS, lnkMenuClear, "", NULL_KEY); + + list b1; + list b2; + + integer n; + integer i; + + pads = llListSort(pads,3,TRUE); + n = llGetListLength(pads); + for (i = 0; i < n; i += 3) + { + b1 += [ llList2String(pads,i) ]; + b2 += [ "pad," + llList2String(pads,i) ]; + } + //llOwnerSay(llDumpList2String(b1,":")); + + llMessageLinked(LINK_THIS, lnkMenuAdd, packDialogMessage( + "[ Networked Telepad ]\n" + + " Choose Destination", + b1 + [ " " ], + b2 + [ " " ] + ), "MainMenu"); + + + llMessageLinked(LINK_THIS, lnkMenuAdd, packDialogMessage( + "[ Networked Telepad ]\n" + + " Choose Destination", + b1 + [ "Reset" ], + b2 + [ "RESET" ] + ), "OwnerMenu"); + +} + + + + +default +{ + state_entry() + { + //llSetRot(ZERO_ROTATION); + llSetClickAction(CLICK_ACTION_TOUCH); + dotext(); + string mydesc = llGetObjectDesc(); + list d = llParseString2List(mydesc,[ ":" ],[]); + myname = llList2String(d,0); + if (llGetSubString(myname,0,0) == "-") + { + directMode = TRUE; + myname = llGetSubString(myname,1,-1); + dotext(); + } + string altchan = llList2String(d,1); + integer n = (integer)altchan; + if (n != 0) + { + if (n > 0) n = - n; + network_channel = n; + } + if ((float)llList2String(d,2) > 0) + { + timeout = (float)llList2String(d,2); + } + if (myname == "") + { + llOwnerSay("Please name this telepad by putting a name in the objects description"); + return; + } + llListen(network_channel,"",NULL_KEY,""); + llRegionSay(network_channel,"ping"); + collecting = TRUE; + llSleep(0.2 + llFrand(0.3)); + llSetTimerEvent(2.0); + pinger(); + } + on_rez(integer num) + { + llResetScript(); + } + listen(integer chan, string name, key id, string message) + { + if (same_owner) + { + key ok = llGetOwnerKey(id); + if (ok != llGetOwner()) return; + } + if (message == "ping") + { + pads = []; + llSetTimerEvent(2.0); + collecting = TRUE; + pinger(); + return; + } + list v = llParseString2List(message,[ ":" ],[]); + if (llGetListLength(v) != 3) return; + + string n = llList2String(v,0); + if (directMode && n != myname) return; + + vector vec = (vector)llList2String(v,1); + rotation rot = (rotation)llList2String(v,2); + integer i = llListFindList(pads, [ n ]); + if (i > -1) + { + pads = llListReplaceList(pads, [ n, vec, rot ], i, i+2); + } + else + { + pads += [ n, vec, rot ]; + } + if (directMode) + { + vec = ( vec - llGetPos() ) / llGetRot(); + rot = rot / llGetRot(); + vec.z += 1.5; + llSitTarget(vec,rot); + llSetClickAction(CLICK_ACTION_SIT); + } + else + { + collecting = TRUE; + llSetTimerEvent(2.0); + } + + } + touch_start(integer num) + { + if (collecting) return; + key toucher = llDetectedKey(0); + if (toucher == llGetOwner()) + { + llMessageLinked(LINK_THIS, lnkMenuShow, "OwnerMenu", llDetectedKey(0)); + } + else + { + llMessageLinked(LINK_THIS, lnkMenuShow, "MainMenu", llDetectedKey(0)); + } + } + timer() + { + if (collecting) + { + llSetTimerEvent(0.0); + setupMenus(); + collecting = FALSE; + return; + } + llSitTarget(ZERO_VECTOR,ZERO_ROTATION); + llSetClickAction(CLICK_ACTION_TOUCH); + destination = ""; + dotext(); + } + changed(integer change) + { + if (change & CHANGED_LINK) + { + llSleep(0.1); + if (llAvatarOnSitTarget() != NULL_KEY) + { + llUnSit(llAvatarOnSitTarget()); + if (!directMode) llSetTimerEvent(timeout); + } + } + } + link_message(integer sender, integer num, string message, key id) + { + if(num == lnkDialogResponse) + { + integer p = llSubStringIndex(message,","); + integer s; + string cmd; + string rest; + if (p > -1) + { + cmd = llToLower(llGetSubString(message,0,p-1)); + rest = llGetSubString(message,p+1,-1); + } + else + { + cmd = llToLower(message); + } + if (id == llGetOwner() && message == "RESET") llResetScript(); + if (cmd == "pad") + { + integer ii = llListFindList(pads, [ rest ]); + if (ii > -1) + { + destination = rest; + vector vv = llList2Vector(pads,ii+1); + rotation rr = llList2Rot(pads,ii+2); + vv = (vv - llGetPos()) / llGetRot(); + rr = rr / llGetRot(); + vv.z += 1.5; + llSitTarget(vv,rr); + llSetClickAction(CLICK_ACTION_SIT); + if (!directMode) llSetTimerEvent(timeout); + dotext(); + } + } + } + } +} \ No newline at end of file diff --git a/PhotoStudio/PhotoStudioEngine-v1.0.lsl b/PhotoStudio/PhotoStudioEngine-v1.0.lsl new file mode 100644 index 00000000..a6a9d47f --- /dev/null +++ b/PhotoStudio/PhotoStudioEngine-v1.0.lsl @@ -0,0 +1,622 @@ +// Variables + //Dialog Channel + integer DHandleChannel; + integer ChatHandle; + + // Textures +list Textures = []; // Holds list of Texture keys +integer NumTextures; // Total Number of Backgrounds +key CurrentTexture = NULL_KEY; // Will Hold key of Current Background +list TextureGrid = [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]; // Link Numbers of Texture Grid +list EmitterGrid = [25,26,27,28,29,30]; // Link Numbers of Emitter Texture Grid +string NoTextureID = "940333d1-4838-46f2-9331-58de6e726fa6"; +integer lastStartNumber; + + //Poses + +list Poses = []; // Hold List of Pose Names +integer NumPoses; // Hold Total Number of Poses +integer CurrentPoseIndex = 0; +key SeatedUserID; + + // Lights Variables + list ColorVectors = [<0.000, 0.455, 0.851>, <0.498, 0.859, 1.000>, <0.224, 0.800, 0.800>, <0.239, 0.600, 0.439>, <0.180, 0.800, 0.251>, <0.004, 1.000, 0.439>, <1.000, 0.863, 0.000>, <1.000, 0.522, 0.106>, <1.000, 0.255, 0.212>, <0.522, 0.078, 0.294>, <0.941, 0.071, 0.745>, <0.694, 0.051, 0.788>, <1.000, 1.000, 1.000>]; + + + list Colors = ["BLUE", "AQUA", "TEAL", "OLIVE", "GREEN", "LIME", "YELLOW", "ORANGE", "RED", "MAROON", "FUCHSIA", "PURPLE", "WHITE"]; + list ColorsMenuStaticOptions = ["Custom", "Main Menu", "Next Page", "Prev Page"]; + + list Lights = [33,34,48,49]; + list LightsMenu = ["Light On", "Light Off", "Intensity", "Color", "Radius", "FallOff", "Exit Menu", "Reset Lights"]; + string CurrentSubMenu = ""; + string CurrentColor = ""; + vector CustomColorVector; + integer CurrentMenuPage = 0; + list IntensityMenu = ["+0.001","-0.001","+0.01","-0.01","+0.1","-0.1","Main Menu"]; + list RadiusMenu = ["+0.5","-0.5","+1.0","-1.0","+5.0","-5.0","Main Menu"]; + list FallOffMenu = ["+0.100","-0.100","+0.250","-0.250","Main Menu"]; + integer LightsOn = FALSE; + float Intensity = 1.0; + float Radius = 10.0; + float FallOff = 0.0; + + //Sit Target Variables + vector SitTarget; + + + // Security +list UserKeys = []; // Hold Authorized User Keys +key notecardQueryId; // Holds NoteCard Query ID +integer notecardLine; // Hold Id of Notecard Line Being Queried +list SecurityMenu = ["Owner", "Anyone", "Auth List", "Add User", "Remove User", "List Users", "Exit Menu"]; + +// Constants +string AuthCardName = ".users"; // Name of Notecard that Hold Names of Authorized Users (One Per line) +vector DefaultPostion = <-3.631882,-0.110687,-0.220459>; +rotation DefaultRotation = ZERO_ROTATION; + +// Switches +string AuthMode = "List"; // Hold Type of Auth Mode (Owner,List,Open) +integer FireOn = FALSE; +string TimerSwitch = ""; +integer CustomColor = FALSE; +integer Debug = FALSE; + +//Functions + +DebugMsg(string message){ + if(Debug){ + llOwnerSay(message); + } +} + +UpdateSitLinkTarget(string direction){ + list Positions = llGetLinkPrimitiveParams(51, [PRIM_POS_LOCAL, PRIM_ROT_LOCAL]); + vector LocPos = llList2Vector(Positions, 0); + rotation LocRot = llList2Rot(Positions, 1); + if(direction=="Left"){ + LocPos.y = LocPos.y - 0.1; + llSetLinkPrimitiveParamsFast(51, [PRIM_POS_LOCAL, LocPos]); + }else if(direction=="Right"){ + LocPos.y = LocPos.y + 0.1; + llSetLinkPrimitiveParamsFast(51, [PRIM_POS_LOCAL, LocPos]); + }else if(direction=="Forward"){ + LocPos.x = LocPos.x + 0.1; + llSetLinkPrimitiveParamsFast(51, [PRIM_POS_LOCAL, LocPos]); + }else if(direction=="Backward"){ + LocPos.x = LocPos.x - 0.1; + llSetLinkPrimitiveParamsFast(51, [PRIM_POS_LOCAL, LocPos]); + }else if(direction=="Up"){ + LocPos.z = LocPos.z + 0.1; + llSetLinkPrimitiveParamsFast(51, [PRIM_POS_LOCAL, LocPos]); + }else if(direction=="Down"){ + LocPos.z = LocPos.z - 0.1; + llSetLinkPrimitiveParamsFast(51, [PRIM_POS_LOCAL, LocPos]); + }else if(direction=="Reset"){ + llSetLinkPrimitiveParamsFast(51, [PRIM_POS_LOCAL, DefaultPostion, PRIM_ROT_LOCAL, DefaultRotation]); + }else if(direction=="RR"){ + vector RotationVector = llRot2Euler(LocRot); + RotationVector.z = RotationVector.z + (-0.5 / PI); + rotation NewRot = llEuler2Rot(RotationVector); + llSetLinkPrimitiveParamsFast(51, [PRIM_ROT_LOCAL, NewRot]); + }else if(direction=="RL"){ + vector RotationVector = llRot2Euler(LocRot); + RotationVector.z = RotationVector.z - (-0.5 / PI); + rotation NewRot = llEuler2Rot(RotationVector); + llSetLinkPrimitiveParamsFast(51, [PRIM_ROT_LOCAL, NewRot]); + } +} + +ShowSecurityDialog(string DialogType, key userid, string addremove){ + if(!ChatHandle){ + ChatHandle = llListen(DHandleChannel, "", NULL_KEY, ""); + } + if(DialogType=="Normal"){ + llDialog(userid, "Security\n\n\t Access Modes:\n\t\tOwner Only\n\t\tAnyone\n\t\tAuthorized List\n\n\tModify List:\n\t\tAdd User\n\t\tRemove User", SecurityMenu, DHandleChannel); + }else if(DialogType=="CustomInput"){ + llTextBox(userid, "Please enter the full Username of the person you with to "+addremove+" the authorized users list.", DHandleChannel); + } + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); +} + +Security(){ + llOwnerSay("Attempting to Load Authorized User Config..."); + if(llGetInventoryKey(AuthCardName) == NULL_KEY){ + llOwnerSay("No .users config file found!"); + }else{ + notecardQueryId = llGetNotecardLine(AuthCardName, notecardLine); + } +} + +ChangeAuthList(string action, string username, key callinguser){ + integer spaceIndex = llSubStringIndex(username, " "); + string firstName = llGetSubString(username, 0, spaceIndex - 1); + string lastName = llGetSubString(username, spaceIndex + 1, -1); + key userkey = osAvatarName2Key(firstName, lastName); + if(action=="Add"){ + UserKeys = UserKeys + userkey; + llOwnerSay("Added User: "+firstName+" "+lastName+" to Authorized Users List"); + }else if(action=="Remove"){ + integer placeinlist = llListFindList(UserKeys, [userkey]); + if (placeinlist != -1){ + UserKeys = llDeleteSubList(UserKeys, placeinlist, placeinlist); + llRegionSayTo(callinguser, 0, firstName+" "+lastName+" Removed, Loading Auth List..."); + ListAuthedUsers(callinguser); + }else{ + llRegionSayTo(callinguser, 0, "That user was not found in the list! Showing List..."); + ListAuthedUsers(callinguser); + } + } +} + +ListAuthedUsers(key id){ + llRegionSayTo(id, 0, "Authorized User List:"); + integer i; + for(i=0;i<=(llGetListLength(UserKeys) - 1);i++){ + llRegionSayTo(id, 0, llKey2Name(llList2Key(UserKeys, i))); + } +} + +UpdateLights(string status){ + integer i; + string Message; + if(CustomColor){ + Message = status+","+(string)CustomColorVector+","+(string)Intensity+","+(string)Radius+","+(string)FallOff; + }else{ + Message = status+","+llList2String(ColorVectors, llListFindList(Colors, [CurrentColor]))+","+(string)Intensity+","+(string)Radius+","+(string)FallOff; + } + for(i=0;i<=3;i++){ + llMessageLinked(llList2Integer(Lights, i), 0, Message, ""); + } +} + +integer CheckSecurity(key TouchedMe){ + if(AuthMode=="Open"){ + return TRUE; + }else if(AuthMode=="Owner"){ + if(TouchedMe==llGetOwner()){ + return TRUE; + }else{ + llSay(0, "You are not allow to use this! Please contact Owner."); + return FALSE; + } + }else if(AuthMode=="List"){ + if(llListFindList(UserKeys, [TouchedMe])!=-1){ + return TRUE; + }else{ + llSay(0, "You are not authorized. Please contact Owner"); + return FALSE; + } + }else{ + llOwnerSay("Securiy Error"); + return FALSE; + } +} + +LoadTextures(){ + NumTextures = llGetInventoryNumber(INVENTORY_TEXTURE); + if(NumTextures<=0){ + llOwnerSay("No Backgrounds Found!"); + llMessageLinked(LINK_SET, 0, "NOBG", ""); + return; + } + integer i; + for(i=0;i, ZERO_ROTATION); +} + +// Texture Grid Functions + +UpdateGrid(integer startnum){ + integer i; + integer NumOnGrid = llGetListLength(TextureGrid) - 1; + string TextureID; + for(i=0;i<=NumOnGrid;i++){ + TextureID = llList2String(Textures, startnum); + startnum++; + integer CurrentLinkID = llList2Integer(TextureGrid, i); + if(TextureID!=""){ + llSetLinkPrimitiveParamsFast(CurrentLinkID, [ + PRIM_TEXTURE, 0, TextureID, <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0, + PRIM_FULLBRIGHT, 0, TRUE]); + lastStartNumber = startnum; + }else{ + startnum = 0; + lastStartNumber = 0; + } + } +} + +ChangePose(string Direction){ + if(Direction=="Next"){ + llStopAnimation(llList2String(Poses, CurrentPoseIndex)); + CurrentPoseIndex++; + if(llList2String(Poses, CurrentPoseIndex)==""){ + CurrentPoseIndex = 0; + } + llStartAnimation(llList2String(Poses, CurrentPoseIndex)); + }else if(Direction=="Prev"){ + llStopAnimation(llList2String(Poses, CurrentPoseIndex)); + CurrentPoseIndex--; + if(llList2String(Poses, CurrentPoseIndex)==""){ + CurrentPoseIndex = llGetListLength(Poses) - 1; + } + llStartAnimation(llList2String(Poses, CurrentPoseIndex)); + } + llSay(0, "New Pose: "+llList2String(Poses, CurrentPoseIndex)); +} + +default +{ + on_rez(integer start_params){ + llResetScript(); + } + + state_entry() + { + if(Initialize()){ + llOwnerSay("Initialization Complete"); + UpdateGrid(0); + } + } + + changed(integer change){ + if(change & CHANGED_INVENTORY){ + TimerSwitch = "Inventory"; + llSetTimerEvent(5.0); + } + if(change & CHANGED_LINK){ + SeatedUserID = llAvatarOnLinkSitTarget(51); + if(SeatedUserID!=NULL_KEY){ // Someone is Sitting + llRequestPermissions(SeatedUserID, PERMISSION_TRIGGER_ANIMATION); + }else{ // Someone Just Stood Up + if (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION){ + llStopAnimation(llList2String(Poses, CurrentPoseIndex)); + } + } + } + } + + run_time_permissions(integer perms){ + llStopAnimation("sit"); + llSay(0, "Starting Pose: "+llList2String(Poses, CurrentPoseIndex)); + llStartAnimation(llList2String(Poses, CurrentPoseIndex)); + } + + touch(integer num){ + key WhoTouched = llDetectedKey(0); + integer WhatTouched = llDetectedLinkNumber(0); + integer authok = CheckSecurity(WhoTouched); + if(!authok){ + return; + } + if(llDetectedLinkNumber(0)==LINK_ROOT){ + vector TouchedPos = llDetectedTouchST(0); // Get Click Position + if(TouchedPos.x >= 0.14 && TouchedPos.x <= 0.185 && TouchedPos.y <= 0.248 && TouchedPos.y >= 0.103){ // Left Texture Change Button + UpdateGrid((lastStartNumber + 21)); + }else if(TouchedPos.x >= 0.21 && TouchedPos.x <= 0.26 && TouchedPos.y <= 0.248 && TouchedPos.y >= 0.103){ // Right Texture Change Button + UpdateGrid((lastStartNumber - 21)); + }else if(TouchedPos.x >= 0.669 && TouchedPos.x <= 0.733 && TouchedPos.y <= 0.68 && TouchedPos.y >= 0.57){ // Fire On/Off Button + if(FireOn){ + llSetLinkAlpha(47, 1.0, 1); + llRegionSayTo(WhoTouched, 0, "Fire Off"); + }else{ + llSetLinkAlpha(47, 0.0, 1); + llRegionSayTo(WhoTouched, 0, "Fire On"); + } + FireOn = !FireOn; + }else if(TouchedPos.x >= 0.669 && TouchedPos.x <= 0.733 && TouchedPos.y <= 0.539 && TouchedPos.y >= 0.421){ // Lights Menu Button + ChatHandle = llListen(DHandleChannel, "", NULL_KEY, ""); + llDialog(WhoTouched, "Lighting Controls", LightsMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(TouchedPos.x >= 0.379 && TouchedPos.x <= 0.457 && TouchedPos.y <= 0.187 && TouchedPos.y >= 0.045){ // Pose Scroll Left + ChangePose("Next"); + }else if(TouchedPos.x >= 0.661 && TouchedPos.x <= 0.734 && TouchedPos.y <= 0.194 && TouchedPos.y >= 0.056){ // Pose Scroll Right + ChangePose("Prev"); + }else if(TouchedPos.x >= 0.686 && TouchedPos.x <= 0.728 && TouchedPos.y <= 0.938 && TouchedPos.y >= 0.780){ // Pose Scroll Right + ShowSecurityDialog("Normal", WhoTouched, ""); + } + }else if(llListFindList(TextureGrid, WhatTouched)!=-1){ // If Prim Touched was a Texture Grid Prim + list Texture = llGetLinkPrimitiveParams(WhatTouched, [PRIM_TEXTURE, 0]); + //Lower + llSetLinkPrimitiveParamsFast(50, [ + PRIM_TEXTURE, 0, llList2String(Texture, 0), <1.000000,0.351709,0.000000>, <0.000000,-0.324137,0.000000>, 1.570796, + PRIM_FULLBRIGHT, 0, TRUE]); + //Curve + llSetLinkPrimitiveParamsFast(32, [ + PRIM_TEXTURE, 2, llList2String(Texture, 0), <-1.000000,0.681924,0.000000>, <0.000000,0.124485,0.000000>, 1.570796, + PRIM_FULLBRIGHT, 0, TRUE]); + //Upper + llSetLinkPrimitiveParamsFast(46, [ + PRIM_TEXTURE, 2, llList2String(Texture, 0), <1.000000,0.494858,0.000000>, <0.000000,0.252571,0.000000>, 0.0, + PRIM_FULLBRIGHT, 0, TRUE]); + }else if(llListFindList(EmitterGrid, WhatTouched)!=-1){ // If Prim Touched was a Emitter Grid Prim + list ToEmit = llGetLinkPrimitiveParams(WhatTouched, [PRIM_TEXTURE, 0]); + llRegionSayTo(WhoTouched, 0, "Emitters Toggled"); + llMessageLinked(LINK_SET, 0, llList2String(ToEmit, 0), NULL_KEY); + }else if(llDetectedLinkNumber(0)==2){ // If Prim Touched was the Pose Circle Menu + vector TouchedPos = llDetectedTouchST(0); // Get Click Position + if(TouchedPos.x >= 0.348 && TouchedPos.x <= 0.651 && TouchedPos.y <= 0.206 && TouchedPos.y >= 0.022){ // Move Avatar Left + UpdateSitLinkTarget("Left"); + }else if(TouchedPos.x >= 0.348 && TouchedPos.x <= 0.651 && TouchedPos.y <= 0.957 && TouchedPos.y >= 0.766){ // Move Avatar Right + UpdateSitLinkTarget("Right"); + }else if(TouchedPos.x >= 0.033 && TouchedPos.x <= 0.228 && TouchedPos.y <= 0.639 && TouchedPos.y >= 0.336){ // Move Avatar Up + UpdateSitLinkTarget("Up"); + }else if(TouchedPos.x >= 0.777 && TouchedPos.x <= 0.996 && TouchedPos.y <= 0.642 && TouchedPos.y >= 0.336){ // Move Avatar Down + UpdateSitLinkTarget("Down"); + }else if(TouchedPos.x >= 0.581 && TouchedPos.x <= 0.716 && TouchedPos.y <= 0.530 && TouchedPos.y >= 0.258){ // Move Avatar Forward + UpdateSitLinkTarget("Forward"); + }else if(TouchedPos.x >= 0.270 && TouchedPos.x <= 0.416 && TouchedPos.y <= 0.696 && TouchedPos.y >= 0.429){ // Move Avatar Backward + UpdateSitLinkTarget("Backward"); + }else if(TouchedPos.x >= 0.680 && TouchedPos.x <= 0.861 && TouchedPos.y <= 0.849 && TouchedPos.y >= 0.687){ // Move Avatar Rotate Right + UpdateSitLinkTarget("RR"); + }else if(TouchedPos.x >= 0.144 && TouchedPos.x <= 0.318 && TouchedPos.y <= 0.303 && TouchedPos.y >= 0.144){ // Move Avatar Rotate Left + UpdateSitLinkTarget("RL"); + }else if(TouchedPos.x >= 0.573 && TouchedPos.x <= 0.729 && TouchedPos.y <= 0.701 && TouchedPos.y >= 0.537){ // Reset Avatar Position + llRegionSayTo(WhoTouched, 0, "Resetting Avatar Position and Rotation..."); + UpdateSitLinkTarget("Reset"); + } + }else{ // Some Other Prim was Touched Speak It's ID + //llOwnerSay((string)llDetectedLinkNumber(0)); + } + } + + listen(integer chan, string sender, key id, string msg){ + if(msg=="Anyone"){ + AuthMode = "Open"; + llRegionSayTo(id, 0, "Security mode set to: Anyone"); + }else if(msg=="Auth List"){ + AuthMode = "List"; + llRegionSayTo(id, 0, "Security mode set to: Authorized Users List"); + }else if(msg=="Owner"){ + AuthMode = "Owner"; + llRegionSayTo(id, 0, "Security mode set to: Owner Only"); + } + if(msg=="Reset Lights"){ + Intensity = 1.0; + Radius = 10.0; + FallOff = 0.0; + CustomColor = FALSE; + CurrentColor = "<1.0,1.0,1.0>"; + llRegionSayTo(id, 0, "Resetting Lights..."); + UpdateLights("TRUE"); + }else if(msg=="Light Off"){ // Turn Lights On + llRegionSayTo(id, 0, "Turning Lights Off..."); + UpdateLights("FALSE"); + }else if(msg=="Light On"){ // Turn Lights Off + llRegionSayTo(id, 0, "Turning Lights On..."); + UpdateLights("TRUE"); + }else if(msg=="Exit Menu"){ // Exit Menu + CurrentSubMenu = ""; + llListenRemove(ChatHandle); + }else if(msg=="Color"){ // Change Color + CurrentSubMenu = msg; + llRegionSayTo(id, 0, "Change Color of Lights"); + integer StartIndex = (CurrentMenuPage * 7); + list DialogMenu = llList2List(Colors, StartIndex, (StartIndex + 7)) + ColorsMenuStaticOptions; + llDialog(id, "Colors", DialogMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(msg=="Intensity"){ // Change Intensity + CurrentSubMenu = msg; + llRegionSayTo(id, 0, "Change Light Intensity"); + llDialog(id, "Intensity", IntensityMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(msg=="Radius"){ // Change Effective Radius + CurrentSubMenu = msg; + llRegionSayTo(id, 0, "Change Light Radius"); + llDialog(id, "Radius", RadiusMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(msg=="FallOff"){ // Change Effective Radius + CurrentSubMenu = msg; + llRegionSayTo(id, 0, "Change Light Fall Off"); + llDialog(id, "FallOff", FallOffMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(msg=="Add User"){ // Prompt User for Persons Name to add to Authorized User List + CurrentSubMenu = msg; + ShowSecurityDialog("CustomInput", id, "Add to"); + }else if(msg=="Remove User"){ // Prompt User for Persons Name to remove from Authorized User List + CurrentSubMenu = msg; + ShowSecurityDialog("CustomInput", id, "Remove from"); + }else if(msg=="List Users"){ // Prompt User for Persons Name to remove from Authorized User List + CurrentSubMenu = ""; + llSetTimerEvent(0); + llRegionSayTo(id, 0, "Listing Authorized Users..."); + ListAuthedUsers(id); + }else if(CurrentSubMenu == "Color"){ // If we are processing a response from the Colors Sub Menu + if(msg=="Next Page"){ + CurrentMenuPage++; + integer StartIndex = (CurrentMenuPage * 7); + list DialogMenu = llList2List(Colors, StartIndex, (StartIndex + 7)) + ColorsMenuStaticOptions; + llDialog(id, "Colors", DialogMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(msg == "Prev Page"){ + CurrentMenuPage--; + integer StartIndex = (CurrentMenuPage * 7); + list DialogMenu = llList2List(Colors, StartIndex, (StartIndex - 7)) + ColorsMenuStaticOptions; + llDialog(id, "Colors", DialogMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(msg == "Custom"){ + CurrentSubMenu = "CustomColorVector"; + llTextBox(id, "Please Enter a Valid Color Vector\nIn the format of: <128,128,128>\n\n Note: Submit Empty Value to return Menu", DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(msg == "Main Menu"){ + CurrentSubMenu = msg; + CurrentMenuPage = 0; + llDialog(id, "Lighting Controls", LightsMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(llListFindList(Colors, [msg])!=-1){ + CustomColor = FALSE; + string ColorVector = llList2String(ColorVectors, llListFindList(Colors, [msg])); + CurrentColor = msg; + UpdateLights("TRUE"); + llListenRemove(ChatHandle); + } + }else if(CurrentSubMenu=="CustomColorVector"){ + if(msg==""){ + CurrentSubMenu = "Color"; + integer StartIndex = (CurrentMenuPage * 7); + list DialogMenu = llList2List(Colors, StartIndex, (StartIndex + 7)) + ColorsMenuStaticOptions; + llOwnerSay((string)llGetListLength(DialogMenu)); + llDialog(id, "Colors", DialogMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else{ + vector NewColor = msg; + if(NewColor.x <= 255 && NewColor.x >=0 && NewColor.y <= 255 && NewColor.y >= 0 && NewColor.z <= 255 && NewColor.z >= 0){ // Valid Input Vector + CustomColor = TRUE; + CustomColorVector = NewColor; + UpdateLights("TRUE"); + }else{ // InValid Input Vector + CustomColor = FALSE; + llRegionSayTo(id, 0, "Invalid Input Vector. Please Try Again"); + CurrentSubMenu = "CustomColorVector"; + llTextBox(id, "Please Enter a Valid Color Vector\nIn the format of: <128,128,128>\n\n Note: Submit Empty Value to return Menu", DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + } + } + }else if(CurrentSubMenu=="Intensity"){ + if(msg=="Main Menu"){ + CurrentSubMenu = msg; + CurrentMenuPage = 0; + llDialog(id, "Lighting Controls", LightsMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(llListFindList(IntensityMenu, [msg]) != -1){ + string mathOP = llGetSubString(msg, 0, 0); + string AdjAmount = llGetSubString(msg, 1, -1); + if(mathOP=="-"){ + Intensity = Intensity - (float)AdjAmount; + }else if(mathOP=="+"){ + Intensity = Intensity + (float)AdjAmount; + } + UpdateLights("TRUE"); + llDialog(id, "Intensity", IntensityMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(0); + llSetTimerEvent(30.0); + } + }else if(CurrentSubMenu=="Radius"){ + if(msg=="Main Menu"){ + CurrentSubMenu = msg; + CurrentMenuPage = 0; + llDialog(id, "Lighting Controls", LightsMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(llListFindList(RadiusMenu, [msg]) != -1){ + string mathOP = llGetSubString(msg, 0, 0); + string AdjAmount = llGetSubString(msg, 1, -1); + if(mathOP=="-"){ + Radius = Radius - (float)AdjAmount; + }else if(mathOP=="+"){ + Radius = Radius + (float)AdjAmount; + } + UpdateLights("TRUE"); + llDialog(id, "Radius", RadiusMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(0); + llSetTimerEvent(30.0); + } + }else if(CurrentSubMenu=="FallOff"){ + if(msg=="Main Menu"){ + CurrentSubMenu = msg; + CurrentMenuPage = 0; + llDialog(id, "Lights Menu", LightsMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(30.0); + }else if(llListFindList(FallOffMenu, [msg]) != -1){ + string mathOP = llGetSubString(msg, 0, 0); + string AdjAmount = llGetSubString(msg, 1, -1); + if(mathOP=="-"){ + FallOff = FallOff + (float)AdjAmount; + }else if(mathOP=="+"){ + FallOff = FallOff - (float)AdjAmount; + } + UpdateLights("TRUE"); + llDialog(id, "FallOff", FallOffMenu, DHandleChannel); + TimerSwitch = "DialogTimeOut"; + llSetTimerEvent(0); + llSetTimerEvent(30.0); + } + }else if(CurrentSubMenu=="Remove User"){ // Receiving Name of User to Remove from Security Tab + ChangeAuthList("Remove", msg, id); + }else if(CurrentSubMenu=="Add User"){ // Receiving Name of User to Add to Security Tab + ChangeAuthList("Add", msg, id); + } + } + + + timer(){ + if(TimerSwitch=="Inventory"){ + llOwnerSay("Inventory Change Detected... Reloading..."); + llResetScript(); + }else if(TimerSwitch=="DialogTimeOut"){ + llSay(0, "No Respose received to Dialog, Closing Listener..."); + llListenRemove(ChatHandle); + TimerSwitch = ""; + llSetTimerEvent(0); + } + } + + dataserver(key query_id, string data) + { + if (query_id == notecardQueryId) + { + if (data == EOF) + llOwnerSay("Done reading notecard, read " + (string) notecardLine + " notecard lines."); + else + { + // bump line number for reporting purposes and in preparation for reading next line + ++notecardLine; + integer spaceIndex = llSubStringIndex(data, " "); + string firstName = llGetSubString(data, 0, spaceIndex - 1); + string lastName = llGetSubString(data, spaceIndex + 1, -1); + UserKeys = UserKeys + osAvatarName2Key(firstName, lastName); + llOwnerSay("Added User: "+firstName+" "+lastName); + notecardQueryId = llGetNotecardLine(AuthCardName, notecardLine); + } + } + } +} \ No newline at end of file diff --git a/Purple Bouncy Particles script/Purple Bouncy Particles script.lsl b/Purple Bouncy Particles script/Purple Bouncy Particles script.lsl new file mode 100644 index 00000000..369833eb --- /dev/null +++ b/Purple Bouncy Particles script/Purple Bouncy Particles script.lsl @@ -0,0 +1,91 @@ +// Keknehv's Particle Script v1.2 +// 1.0 -- 5/30/05 +// 1.1 -- 6/17/05 +// 1.2 -- 9/22/05 (Forgot PSYS_SRC_MAX_AGE) + +// This script may be used in anything you choose, including and not limited to commercial products. +// Just copy the MakeParticles() function; it will function without any other variables in a different script +// ( You can, of course, rename MakeParticles() to something else, such as StartFlames() ) + +// This script is basically an llParticleSystem() call with comments and formatting. Change any of the values +// that are listed second to change that portion. Also, it is equipped with a touch-activated off button, +// for when your particles go haywire and cause everyone to start yelling at you. + +// Contact Keknehv Psaltery if you have questions or comments. + +MakeParticles() //This is the function that actually starts the particle system. +{ + llParticleSystem([ //KPSv1.0 + PSYS_PART_FLAGS , 0 //Comment out any of the following masks to deactivate them + | PSYS_PART_BOUNCE_MASK //Bounce on object's z-axis + | PSYS_PART_WIND_MASK //Particles are moved by wind + | PSYS_PART_INTERP_COLOR_MASK //Colors fade from start to end + | PSYS_PART_INTERP_SCALE_MASK //Scale fades from beginning to end + | PSYS_PART_FOLLOW_SRC_MASK //Particles follow the emitter + | PSYS_PART_FOLLOW_VELOCITY_MASK //Particles are created at the velocity of the emitter + //| PSYS_PART_TARGET_POS_MASK //Particles follow the target + | PSYS_PART_EMISSIVE_MASK //Particles are self-lit (glow) + //| PSYS_PART_TARGET_LINEAR_MASK //Undocumented--Sends particles in straight line? + , + + //PSYS_SRC_TARGET_KEY , NULL_KEY, //Key of the target for the particles to head towards + //This one is particularly finicky, so be careful. + //Choose one of these as a pattern: + //PSYS_SRC_PATTERN_DROP Particles start at emitter with no velocity + //PSYS_SRC_PATTERN_EXPLODE //Particles explode from the emitter + //PSYS_SRC_PATTERN_ANGLE Particles are emitted in a 2-D angle + //PSYS_SRC_PATTERN_ANGLE_CONE Particles are emitted in a 3-D cone + //PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY Particles are emitted everywhere except for a 3-D cone + + PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE + + ,PSYS_SRC_TEXTURE, "Bling" //UUID of the desired particle texture, or inventory name + ,PSYS_SRC_MAX_AGE, 0.0 //Time, in seconds, for particles to be emitted. 0 = forever + ,PSYS_PART_MAX_AGE, 3.0 //Lifetime, in seconds, that a particle lasts + ,PSYS_SRC_BURST_RATE, 0.5 //How long, in seconds, between each emission + ,PSYS_SRC_BURST_PART_COUNT, 2 //Number of particles per emission + ,PSYS_SRC_BURST_RADIUS, 5.0 //Radius of emission + ,PSYS_SRC_BURST_SPEED_MIN, 1.0 //Minimum speed of an emitted particle + ,PSYS_SRC_BURST_SPEED_MAX, 2.0 //Maximum speed of an emitted particle + ,PSYS_SRC_ACCEL, <0.0,0.0,-0.8> //Acceleration of particles each second + ,PSYS_PART_START_COLOR, <1.0,0.0,1.0> //Starting RGB color + ,PSYS_PART_END_COLOR, <1.0,1.0,1.0> //Ending RGB color, if INTERP_COLOR_MASK is on + ,PSYS_PART_START_ALPHA, 1.0 //Starting transparency, 1 is opaque, 0 is transparent. + ,PSYS_PART_END_ALPHA, 1.0 //Ending transparency + ,PSYS_PART_START_SCALE, <0.05,0.05,0.0> //Starting particle size + ,PSYS_PART_END_SCALE, <0.1,0.1,0.0> //Ending particle size, if INTERP_SCALE_MASK is on + ,PSYS_SRC_ANGLE_BEGIN, PI //Inner angle for ANGLE patterns + ,PSYS_SRC_ANGLE_END, PI //Outer angle for ANGLE patterns + ,PSYS_SRC_OMEGA, <0.0,0.0,0.0> //Rotation of ANGLE patterns, similar to llTargetOmega() + ]); +} + +default +{ + state_entry() + { + MakeParticles(); //Start making particles + } + + touch_start( integer num ) //Turn particles off when touched + { + state off; //Switch to the off state + } +} + +state off +{ + state_entry() + { + llParticleSystem([]); //Stop making particles + } + + touch_start( integer num ) //Turn particles back on when touched + { + state default; + } + on_rez(integer num_param) + { + llResetScript(); + } +} \ No newline at end of file diff --git a/Rental System/LD Rental Board Engine.lsl b/Rental System/LD Rental Board Engine.lsl new file mode 100644 index 00000000..dcc69cea --- /dev/null +++ b/Rental System/LD Rental Board Engine.lsl @@ -0,0 +1,565 @@ +// Default Program FrameWork +/* + + Replace this Section with Program Specific Information + +*/ + +// Created by Tech Guy of IO + +// Configuration Directives +/* This Section Contains Configuration Variables that will contain data set by reading the notecard specified by ConfigFile Variable */ + + // Communication Channels + integer MenuComChannel; // Menu Communications Channel for All User Dialog Communications + integer ComChannel; // General Communication Channel for Inter-Device Communication + +// System Variables +/* This Section contains variables that will be used throughout the program. */ + // Admin ACL + list Admins = []; // List of Administrator Keys Read in from ConfigFile + // Communication Handles + integer MenuComHandle; // Menu Communications Handle + integer ComHandle; // General Communications Handle + // Config Card Reading Variables + integer cLine; // Holds Configuration Line Index for Loading Config Loop + key cQueryID; // Holds Current Configuration File Line during Loading Loop + + +// System Constants +/* This Section contains constants used throughout the program */ +string BootMessage = "Booting..."; // Default/Initial Boot Message +string ConfigFile = ".config"; // Name of Configuration File +string EMPTY = ""; +string SecurityKey; +list Wings; +integer Floors; +string CurrentWing; +list Units; +integer CurUnitID; +integer CurPayPrice; +list CurUnitData; +integer CurrentYear = 2015; + +// Color Vectors +list colorsVectors = [<0.000, 0.455, 0.851>, <0.498, 0.859, 1.000>, <0.224, 0.800, 0.800>, <0.239, 0.600, 0.439>, <0.180, 0.800, 0.251>, <0.004, 1.000, 0.439>, <1.000, 0.522, 0.106>, <1.000, 0.255, 0.212>, <0.522, 0.078, 0.294>, <0.941, 0.071, 0.745>, <0.694, 0.051, 0.788>, <1.000, 1.000, 1.000>]; + +// List of Names for Colors +list colors = ["BLUE", "AQUA", "TEAL", "OLIVE", "GREEN", "LIME", "ORANGE", "RED", "MAROON", "FUCHSIA", "PURPLE", "WHITE"]; + +// XyText Cell Com Numbers +integer CA1 = 281000; +integer CA2 = 282000; +integer CA3 = 283000; +integer CA4 = 284000; +integer CB1 = 285000; +integer CB2 = 286000; +integer CB3 = 287000; +integer CB4 = 288000; +integer CC1 = 289000; +integer CC2 = 290000; +integer CC3 = 291000; +integer CC4 = 292000; + +// Display Prim and Face IDs +integer DisplayPrim = 14; +integer DisplayFace = 4; + +// System Switches +/* This Section contains variables representing switches (integer(binary) yes/no) or modes (string "modename" */ + // Debug Mode Swtich + integer DebugMode = FALSE; // Is Debug Mode Enabled before Reading Obtaining Configuation Information + +// Imported Functions +/* This section contains any functions that were not written by Tech Guy */ + +list uUnix2StampLst( integer vIntDat ){ + if (vIntDat / 2145916800){ + vIntDat = 2145916800 * (1 | vIntDat >> 31); + } + integer vIntYrs = 1970 + ((((vIntDat %= 126230400) >> 31) + vIntDat / 126230400) << 2); + vIntDat -= 126230400 * (vIntDat >> 31); + integer vIntDys = vIntDat / 86400; + list vLstRtn = [vIntDat % 86400 / 3600, vIntDat % 3600 / 60, vIntDat % 60]; + + if (789 == vIntDys){ + vIntYrs += 2; + vIntDat = 2; + vIntDys = 29; + }else{ + vIntYrs += (vIntDys -= (vIntDys > 789)) / 365; + vIntDys %= 365; + vIntDys += vIntDat = 1; + integer vIntTmp; + while (vIntDys > (vIntTmp = (30 | (vIntDat & 1) ^ (vIntDat > 7)) - ((vIntDat == 2) << 1))){ + ++vIntDat; + vIntDys -= vIntTmp; + } + } + return [vIntYrs, vIntDat, vIntDys] + vLstRtn; +} +/*//-- Anti-License Text --//*/ +/*// Contributed Freely to the Public Domain without limitation. //*/ +/*// 2009 (CC0) [ http://creativecommons.org/publicdomain/zero/1.0 ] //*/ +/*// Void Singer [ https://wiki.secondlife.com/wiki/User:Void_Singer ] //*/ +/*//-- + + +// Home-Brew Functions +/* This section contains any functions that were written by Tech Guy */ + +// Debug Message Function +DebugMessage(string msg){ + if(DebugMode){ + llOwnerSay(msg); + } +} + +// Send Any User a Message +SendMessage(string msg, key userid){ + if(userid=="NULL_KEY" || userid==""){ + //llSay(0, msg); + llRegionSay(0, msg); + }else if(msg!="" && userid!=NULL_KEY){ + //llInstantMessage(userid, msg); + llRegionSayTo(userid, 0, msg); + }else{ + DebugMessage("Error Sending User Message: "+msg); + } +} + +// Convert Input (S)ColorName to (V)Color +vector Color2Vector(string ColorName){ + integer VectorIndex = llListFindList(colors, [llToUpper(ColorName)]); + vector Color; + if(VectorIndex==-1){ + Color = ZERO_VECTOR; + }else{ + Color = llList2Vector(colorsVectors, VectorIndex); + } + return Color; +} + +// Main Initialization Logic, Executed Once Upon Script Start +Initialize(){ + SendMessage(BootMessage, llGetOwner()); // State Booting Message + MenuComChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); // Randomize Dialog Com Channel + SendMessage("Configuring...", llGetOwner()); // Message Owner that we are starting the Configure Loop + cQueryID = llGetNotecardLine(ConfigFile, cLine); // Start the Read from Config Notecard +} + +// System has started Function (Runs After Configuration is Loaded, as a result of EOF) +SystemStart(){ + SendMessage("System Started!", llGetOwner()); + CurUnitID = 0; + //llSetTimerEvent(300.0); + UpdateUnitInfo("", (string)CurUnitID, NULL_KEY); + llSetTimerEvent(10.0); +} + +// Add Admin (Add provided Legacy Name to Admins List after extrapolating userKey) +AddAdmin(string LegacyName){ + string FName = llList2String(llParseString2List(LegacyName, [" "], []), 0); + string LName = llList2String(llParseString2List(LegacyName, [" "], []), 1); + DebugMessage("First Name: "+FName+" Last Name: "+LName); + key UserKey = osAvatarName2Key(FName, LName); + if(UserKey!=NULL_KEY){ + Admins = Admins + UserKey; + DebugMessage("Added Admin: "+LegacyName); + }else{ + DebugMessage("Unable to Resolve: "+LegacyName); + } +} + +// Update Stats +UpdateUnitInfo(string UnitName, string UnitIndex, key WhoTouched){ + list UnitData; + integer CurUnitIndex; + if(UnitName!=""){ + CurUnitIndex = llListFindList(Units, [UnitName]); + }else if(UnitIndex!=""){ + CurUnitIndex = ((integer)UnitIndex * 10); + if(CurUnitIndex==1){ + CurUnitIndex--; + } + //llOwnerSay("Inex: "+(string)CurUnitIndex); + } + UnitData = llList2List(Units, CurUnitIndex, (CurUnitIndex + 9)); + CurUnitData = UnitData; + // Set Price to make board payable if unit is available + if(llList2String(UnitData, 5)=="FALSE" || (llList2String(UnitData, 5)=="TRUE" && llList2Key(UnitData, 6) == WhoTouched)){ + //llOwnerSay("Path1"); + CurPayPrice = llList2Integer(UnitData, 1); + if(CurPayPrice>0){ + llSetPayPrice(CurPayPrice, [ CurPayPrice, (CurPayPrice * 2), (CurPayPrice * 3), (CurPayPrice * 4)]); + } + llMessageLinked(LINK_SET, 0, "green", ""); + }else if(llList2String(UnitData, 5)=="TRUE"){ + //llOwnerSay(llList2String(UnitData, 5)); + llSetPayPrice(PAY_HIDE, [ PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE ]); + llMessageLinked(LINK_SET, 0, "red", ""); + } + //llOwnerSay(llDumpList2String(UnitData, "||")); + // Update Display Text + string DisplayUnitName; + if(llStringLength(llList2String(UnitData, 0))==2){ + DisplayUnitName = llList2String(UnitData, 0)+" "; + }else{ + DisplayUnitName = llList2String(UnitData, 0)+" "; + } + string DisplayString; + if(llStringLength(llList2String(UnitData, 8))==3){ + DisplayString = "Unit: "+DisplayUnitName+" Prims: "+llList2String(UnitData, 8)+" Price: "+llList2String(UnitData, 1)+"wk "; + }else{ + DisplayString = "Unit: "+DisplayUnitName+" Prims: "+llList2String(UnitData, 8)+"Price: "+llList2String(UnitData, 1)+"wk "; + } + if(llList2String(UnitData, 5)=="FALSE"){ + DisplayString = DisplayString + "Available "; + }else{ + DisplayString = DisplayString + "UnAvailable"; + } + DisplayString = DisplayString + "Expires: "; + integer InputExpireTimeStamp = llList2Integer(UnitData, 7); + if(InputExpireTimeStamp==0){ + DisplayString = DisplayString + "12 Weeks 6 Days"; + }else{ + list TimeList = uUnix2StampLst(InputExpireTimeStamp); + DisplayString = DisplayString + " " + (string)(llList2Integer(TimeList, 0) + (CurrentYear - llList2Integer(TimeList, 0))) + "/" + llList2String(TimeList, 1) + "/" + llList2String(TimeList, 2); + //llOwnerSay(DisplayString); + } + //llOwnerSay("T"+(string)llStringLength(DisplayString)); + //llOwnerSay(DisplayString); + llMessageLinked(LINK_SET, CA1, llGetSubString(DisplayString, 0, 5), "''''"); + llMessageLinked(LINK_SET, CA2, llGetSubString(DisplayString, 6, 11), "''''"); + llMessageLinked(LINK_SET, CA3, llGetSubString(DisplayString, 12, 17), "''''"); + llMessageLinked(LINK_SET, CA4, llGetSubString(DisplayString, 18, 23), "''''"); + llMessageLinked(LINK_SET, CB1, llGetSubString(DisplayString, 24, 29), "''''"); + llMessageLinked(LINK_SET, CB2, llGetSubString(DisplayString, 30, 35), "''''"); + llMessageLinked(LINK_SET, CB3, llGetSubString(DisplayString, 36, 41), "''''"); + llMessageLinked(LINK_SET, CB4, llGetSubString(DisplayString, 42, 47), "''''"); + llMessageLinked(LINK_SET, CC1, llGetSubString(DisplayString, 48, 53), "''''"); + llMessageLinked(LINK_SET, CC2, llGetSubString(DisplayString, 54, 60), "''''"); + llMessageLinked(LINK_SET, CC3, llGetSubString(DisplayString, 61, 66), "''''"); + llMessageLinked(LINK_SET, CC4, llGetSubString(DisplayString, 67, -1), "''''"); + // Update Main Texture Display and Buffer Display + llSetLinkPrimitiveParamsFast(DisplayPrim, [PRIM_TEXTURE, DisplayFace, llList2String(UnitData, 9), <1.0,1.0,1.0>, ZERO_VECTOR, 0.0]); +} + + +// Configuration Directives Processor (Called Each Time a Line is Found in the config File) +LoadConfig(string data){ + if(data!=""){ // If Line is not Empty + // if the line does not begin with a comment + if(llSubStringIndex(data, "#") != 0) + { + // find first equal sign + integer i = llSubStringIndex(data, "="); + + // if line contains equal sign + if(i != -1){ + // get name of name/value pair + string name = llGetSubString(data, 0, i - 1); + // get value of name/value pair + string value = llGetSubString(data, i + 1, -1); + // trim name + list temp = llParseString2List(name, [" "], []); + name = llDumpList2String(temp, " "); + // make name lowercase + name = llToLower(name); + // trim value + temp = llParseString2List(value, [" "], []); + value = llDumpList2String(temp, " "); + // Check Key/Value Pairs and Set Switches and Lists + if(name=="debugmode"){ // Check DeBug Mode + if(value=="TRUE" || value=="true"){ + DebugMode = TRUE; + llOwnerSay("Debug Mode: Enabled!"); + }else if(value=="FALSE" || value=="false"){ + DebugMode = FALSE; + llOwnerSay("Debug Mode: Disabled!"); + } + }else if(name=="comchannel"){ + ComChannel = (integer)value; + DebugMessage("Com Channel: "+(string)ComChannel); + }else if(name=="securitykey"){ + SecurityKey = value; + DebugMessage("Security Key: "+SecurityKey); + }else if(name=="admin"){ + AddAdmin(value); + }else if(name=="wings"){ + Wings = llCSV2List(value); + CurrentWing = llList2String(Wings, 0); + DebugMessage("Wings: "+llDumpList2String(Wings, " & ")); + }else if(name=="floors"){ + Floors = (integer)value; + DebugMessage("Total Number of Floors Per Wing: "+(string)Floors); + } + }else{ // line does not contain equal sign + SendMessage("Configuration could not be read on line " + (string)cLine, NULL_KEY); + } + } + } +} + +// Get Unit Configuration Information from the Server +GetServerConfig(){ + if(ComHandle<=0){ // Need to Open Com Handle + DebugMessage("Opening Com Channel "+(string)ComChannel+"..."); + ComHandle = llListen(ComChannel, EMPTY, EMPTY, EMPTY); + } + integer count = 0; + string GetConfigCmd; + DebugMessage("Calling Server..."); + for(count=0;count<=Floors;count++){ + GetConfigCmd = "GETCONFIG||"+count+llToUpper(CurrentWing); + llRegionSay(ComChannel, GetConfigCmd); + if(count==Floors){ + integer NumWings = llGetListLength(Wings); + integer NextWingIndex = (llListFindList(Wings, [CurrentWing]) + 1); + if(NextWingIndex>=NumWings){ + count = Floors; + }else{ + count = 0; + CurrentWing = llList2String(Wings, NextWingIndex); + } + } + } +} + + +// Validate the Servers Security Key +integer CheckServerSecurity(string InKey){ + if(InKey==SecurityKey){ + return TRUE; + }else{ + return FALSE; + } +} + +// Next / Prev Unit Display Changer +ChangeUnit(string Direction, key WhoTouched){ + if(Direction=="Next"){ + CurUnitID++; + if(CurUnitID>=(Floors * llGetListLength(Wings))){ + CurUnitID = 0; + } + }else if(Direction=="Prev"){ + if(CurUnitID==0){ + CurUnitID = (Floors * llGetListLength(Wings)); + CurUnitID--; + }else{ + CurUnitID--; + } + } + //llOwnerSay("CurUnitID: "+(string)CurUnitID); + UpdateUnitInfo("", (string)CurUnitID, WhoTouched); +} + +AnnounceUnitStateChange(list InputData){ + string SendString = llDumpList2String(InputData, "||"); + llRegionSay(-86000, SendString); +} + +// Check for Expired Units +CheckExpires(){ + integer count; + integer Start; + integer End; + list CurrentUnit; + string CurrentWing = "a"; + integer CurrentTime; + for(count=1;count<=Floors;count++){ + Start = llListFindList(Units, (string)count+llToUpper(CurrentWing)); + End = (Start + 9); + CurrentUnit = llList2List(Units, Start, End); + CurrentTime = llGetUnixTime(); + integer UnitExpiry = llList2Integer(CurrentUnit, 7); + if(CurrentTime>UnitExpiry && UnitExpiry>0){ + if(llList2String(CurrentUnit, 0)=="1A" || llList2String(CurrentUnit, 0)=="1B"){ + // Do Nothing + }else{ + // Notify Server of Rented Unit + list SendList = [ "AVAIL" ] + CurrentUnit; + string SendString = llDumpList2String(SendList, "||"); + DebugMessage("Updating Server..."); + llRegionSay(ComChannel, SendString); + + // Announce Change to Front Door Panels (And Anything Else we later want to listen) + AnnounceUnitStateChange(SendList); + //llOwnerSay("Expired "+llList2String(CurrentUnit, 0)); + } + } +// llOwnerSay(llDumpList2String(CurrentUnit, "||")); + if(count==Floors){ + integer NumWings = llGetListLength(Wings); + integer NextWingIndex = (llListFindList(Wings, [CurrentWing]) + 1); + if(NextWingIndex>=NumWings){ + count = Floors; + }else{ + count = 1; + CurrentWing = llList2String(Wings, NextWingIndex); + } + } + } +} + + +//Main Program Logic +/* This section contains the main program logic. (ie: Default State, and all event triggers) */ + +default{ + on_rez(integer params){ + llResetScript(); + } + + state_entry(){ + Initialize(); + } + + touch_start(integer num){ + vector WhereTouched = llDetectedTouchST(0); + key WhoTouched = llDetectedKey(0); + //llOwnerSay("X Vector: "+(string)WhereTouched.x+" Y Vector: "+(string)WhereTouched.y); + if(WhereTouched.x>=0.0597 && WhereTouched.x<=0.3779 && WhereTouched.y>=0.5845 && WhereTouched.y<=0.6212){ + ChangeUnit("Prev", WhoTouched); + }else if(WhereTouched.x>=0.6308 && WhereTouched.x<=0.9434 && WhereTouched.y>=0.5867 && WhereTouched.y<=0.6213){ + ChangeUnit("Next", WhoTouched); + } + } + + listen(integer channel, string sender, key id, string msg){ + if(channel==ComChannel){ // Message comes from Server + list InputData = llParseString2List(msg, ["||"], []); + if(!CheckServerSecurity(llList2String(InputData, 0))){ + DebugMessage("Server Security Code Invalid!\n Closing Com Handle..."); + //llListenRemove(ComHandle); + //state borked; + } + string CMD = llList2String(InputData, 1); + if(CMD=="UNIT"){ // Receiving Configuration for Unit + integer UnitPropCount = llGetListLength(Units); + Units = Units + llList2List(InputData, 2, -1); +// llOwnerSay("Unit Configured:\n"+llDumpList2String(llList2List(Units, UnitPropCount, (UnitPropCount + 8)), ",")); + AnnounceUnitStateChange(llList2List(InputData, 1, -1)); + //llOwnerSay((string)llGetListLength(Units)); + if((llGetListLength(Units) / 8)==(Floors * llGetListLength(Wings))){ + llOwnerSay("Please accept debit permissions..."); + llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); + } + } + }else if(channel==MenuComChannel){ // Message comes from Board Dialog Menu + + } + } + + run_time_permissions(integer perms){ + if(perms & PERMISSION_DEBIT){ + llOwnerSay("Permissions Granted! System Configured!"); + SystemStart(); + } + } + + // DataServer Event Called for Each Line of Config NC. This Loop It was Calls LoadConfig() + dataserver(key query_id, string data){ // Config Notecard Read Function Needs to be Finished + if (query_id == cQueryID){ + if (data != EOF){ + LoadConfig(data); // Process Current Line + ++cLine; // Increment Line Index + cQueryID = llGetNotecardLine(ConfigFile, cLine); // Attempt to Read Next Config Line (Re-Calls DataServer Event) + }else{ // IF EOF (End of Config loop, and on Blank File) + GetServerConfig(); + } + } + } + + changed(integer change){ + if(change & CHANGED_INVENTORY){ + BootMessage = "Inventory Changed Detected, Re-Initializing..."; + llResetScript(); + } + } + + money(key Payor, integer AmountPaid){ + //llOwnerSay((string)CurPayPrice+" "+(string)CurUnitID); + integer OneWeek = CurPayPrice; + integer TwoWeek = (CurPayPrice * 2); + integer ThreeWeek = (CurPayPrice * 3); + integer FourWeek = (CurPayPrice * 4); + integer Expiry; + if(AmountPaid != OneWeek && AmountPaid != TwoWeek && AmountPaid != ThreeWeek && AmountPaid != FourWeek){ // Incorrent Amount Paid + llRegionSayTo(Payor, 0, "You paid an invalid amount! Returning your money..."); + llGiveMoney(Payor, AmountPaid); + return; + }else if(AmountPaid==OneWeek){ + Expiry = (llGetUnixTime() + 604800); + }else if(AmountPaid==TwoWeek){ + Expiry = (llGetUnixTime() + (604800 * 2)); + }else if(AmountPaid==ThreeWeek){ + Expiry = (llGetUnixTime() + (604800 * 3)); + }else if(AmountPaid==FourWeek){ + Expiry = (llGetUnixTime() + (604800 * 4)); + } + llRegionSayTo(Payor, 0, "Thank you for Renting Unit: "+llList2String(CurUnitData, 0)); + list ExpiryList = uUnix2StampLst(Expiry); + integer ExpYear = llList2Integer(ExpiryList, 0) + (CurrentYear - llList2Integer(ExpiryList, 0)); + list Public = [ExpYear] + llList2List(ExpiryList, 1, 2); + llOwnerSay("Pre New Expire: "+llDumpList2String(CurUnitData, "||")); + list NewUnitData = llList2List(CurUnitData, 0, 4) + ["TRUE"] + [(string)Payor] + [Expiry] + llList2List(CurUnitData, 8, -1); + llOwnerSay("New Unit Data: "+llDumpList2String(NewUnitData, "||")); + llMessageLinked(LINK_SET, 0, "red", ""); + integer UnitIndex = llListFindList(Units, [llList2String(NewUnitData, 0)]); + if(UnitIndex==-1){ + llOwnerSay("Error Unit Not Found in List!"); + state borked; + }else{ + list OldUnitData = llList2List(Units, UnitIndex, (UnitIndex + 9)); + llOwnerSay("Old Unit Data: "+llDumpList2String(OldUnitData, "||")); + if(llList2String(OldUnitData, 6)==Payor){ + integer OldExpiry = llList2Integer(NewUnitData, 7); + if(AmountPaid==OneWeek){ + Expiry = (OldExpiry + 604800); + }else if(AmountPaid==TwoWeek){ + Expiry = (OldExpiry + (604800 * 2)); + }else if(AmountPaid==ThreeWeek){ + Expiry = (OldExpiry + (604800 * 3)); + }else if(AmountPaid==FourWeek){ + Expiry = (OldExpiry + (604800 * 4)); + } + } + } + NewUnitData = [] + llList2List(CurUnitData, 0, 4) + ["TRUE"] + [(string)Payor] + [Expiry] + llList2List(CurUnitData, 8, -1); + llOwnerSay("New Unit Data Final: "+llDumpList2String(NewUnitData, "||")); + list Start; + list End; + if(UnitIndex==0){ + Start = []; + }else{ + Start = llList2List(Units, 0, (UnitIndex - 1)); + } + End = llList2List(Units, (UnitIndex + 10), -1); + list NewUnits = Start + NewUnitData + End; + Units = [] + NewUnits; + + // Notify Server of Rented Unit + list SendList = [ "RENTED" ] + NewUnitData; + string SendString = llDumpList2String(SendList, "||"); + DebugMessage("Updating Server..."); + llRegionSay(ComChannel, SendString); + + // Announce Change to Front Door Panels (And Anything Else we later want to listen) + AnnounceUnitStateChange(SendList); + // Update Display Text + //llOwnerSay(llList2String(NewUnitData, 0)); + UpdateUnitInfo(llList2String(NewUnitData, 0), "", Payor); + } + + timer(){ + CheckExpires(); + } +} + +state borked { + state_entry(){ + llInstantMessage(llGetOwner(), llGetObjectName()+" failure!"); + } +} \ No newline at end of file diff --git a/Rental System/Luxuria Domus Rental Server.lsl b/Rental System/Luxuria Domus Rental Server.lsl new file mode 100644 index 00000000..e419935c --- /dev/null +++ b/Rental System/Luxuria Domus Rental Server.lsl @@ -0,0 +1,767 @@ +// Game Server Relay Engine v1.0 +// Created by Tech Guy + + +//Very Keynes - 2008 - 2009 +// +// Version: OpenSimulator Server 0.6.1.7935 (interface version 2) +// +// 2009-01-06, 19:30 GMT +// +//------------------Begin VK-DBMS-VM----------------------------\\ +//--------------------Introduction------------------------------\\ +// +// Very Keynes - DBMS - Virtual Machine +// +// Implements a core set of registers and root functions +// to create and manage multi-table database structures as +// an LSL list. Although intended to under pin higher level +// database management tools such as VK-SQL it is usable as +// a small footprint database facility for system level +// applications. +// +// +// Naming Conventions and Code Style +// +// This Code is intended to be included as a header to user generated +// code. As such it's naming convention was selected so that it would +// minimise the possibility of duplicate names in the user code portion +// of the application. Exposed Functions and Variables are prefixed db. +// +// A full User Guide and Tutorial is availible at this URL: +// +// http://docs.google.com/Doc?id=d79kx35_26df2pbbd8 +// +// +// Table Control Registers +// +integer th_; // Table Handle / Index Pointer +integer tc_; // Columns in Active Table +integer tr_; // Rows in Active Table +integer ts_; // Active Table Start Address +// +list _d_ = []; // Database File +list _i_ = [0]; // Index File +// +// Exposed Variables +// +integer dbIndex; // Active Row Table Pointer +list dbRow; // User Scratch List +string dbError; // System Error String +// +// Temporary / Working Variables +// +integer t_i; +string t_s; +float t_f; +list t_l; +// +// System Functions +// +string dbCreate(string tab, list col) +{ + if(dbOpen(tab)) + { + dbError = tab + " already exists"; + return ""; + } + tc_ = llGetListLength(col); + _i_ += [tab, tc_, 0, 0, 0]; + th_= 0; + dbOpen(tab); + dbInsert(col); + return tab; +} + + +integer dbCol(string col) +{ + return llListFindList(dbGet(0), [_trm(col)]); +} + + +integer dbDelete(integer ptr) +{ + if(ptr > 0 && ptr < tr_) + { + t_i = ts_ + tc_ * ptr; + _d_ = llDeleteSubList(_d_, t_i, t_i + tc_ - 1); + --tr_; + return tr_ - 1; + } + else + { + dbError = (string)ptr + " is outside the Table Bounds"; + return FALSE; + } +} + + +integer dbDrop(string tab) +{ + t_i = llListFindList(_i_, [tab]); + if(-1 != t_i) + { + dbOpen(tab); + _d_ = llDeleteSubList(_d_, ts_, ts_ + tc_ * tr_ - 1); + _i_ = llDeleteSubList(_i_, th_, th_ + 4); + th_= 0; + return TRUE; + } + else + { + dbError = tab + " : Table name not recognised"; + return FALSE; + } +} + + +integer dbExists(list cnd) +{ + for(dbIndex = tr_ - 1 ; dbIndex > 0 ; --dbIndex) + { + if(dbTest(cnd)) return dbIndex; + } + return FALSE; +} + + +list dbGet(integer ptr) +{ + if(ptr < tr_ && ptr >= 0) + { + t_i = ts_ + tc_ * ptr; + return llList2List(_d_, t_i, t_i + tc_ - 1); + } + else + { + dbError = (string) ptr + " is outside the Table Bounds"; + return []; + } +} + + +integer _idx(integer hdl) +{ + return (integer)llListStatistics(6, llList2ListStrided(_i_, 0, hdl, 5)); +} + + +integer dbInsert(list val) +{ + if(llGetListLength(val) == tc_) + { + dbIndex = tr_++; + _d_ = llListInsertList(_d_, val, ts_ + tc_ * dbIndex); + return dbIndex; + } + else + { + dbError = "Insert Failed - too many or too few Columns specified"; + return FALSE; + } +} + + +integer dbOpen(string tab) +{ + if(th_) + { + _i_ = llListReplaceList(_i_, [tr_, dbIndex, tc_ * tr_], th_ + 2, th_ + 4); + } + t_i = llListFindList(_i_, [tab]); + if(-1 == t_i) //if tab does not exist abort + { + dbError = tab + " : Table name not recognised"; + return FALSE; + } + else if(th_ != t_i) + { + th_ = t_i++; + ts_ = _idx(th_); + tc_ = llList2Integer(_i_, t_i++); + tr_ = llList2Integer(_i_, t_i++); + dbIndex = llList2Integer(_i_, t_i); + } + return tr_ - 1; +} + + +integer dbPut(list val) +{ + if(llGetListLength(val) == tc_) + { + t_i = ts_ + tc_ * dbIndex; + _d_ = llListReplaceList(_d_, val, t_i, t_i + tc_ - 1); + return dbIndex; + } + else + { + dbError = "Update Failed - too many or too few Columns specified"; + return FALSE; + } +} + + +integer dbTest(list cnd) +{ + if(llGetListEntryType(cnd,2) >= 3) + { + t_s = llList2String(dbGet(dbIndex), dbCol(llList2String(cnd, 0))); + if ("==" == llList2String(cnd, 1)){t_i = t_s == _trm(llList2String(cnd, 2));} + else if("!=" == llList2String(cnd, 1)){t_i = t_s != _trm(llList2String(cnd, 2));} + else if("~=" == llList2String(cnd, 1)) + {t_i = !(llSubStringIndex(llToLower(t_s), llToLower(_trm(llList2String(cnd, 2)))));} + } + else + { + t_f = llList2Float(dbGet(dbIndex), dbCol(llList2String(cnd, 0))); + t_s = llList2String(cnd, 1); + if ("==" == t_s){t_i = t_f == llList2Float(cnd, 2);} + else if("!=" == t_s){t_i = t_f != llList2Float(cnd, 2);} + else if("<=" == t_s){t_i = t_f <= llList2Float(cnd, 2);} + else if(">=" == t_s){t_i = t_f >= llList2Float(cnd, 2);} + else if("<" == t_s){t_i = t_f < llList2Float(cnd, 2);} + else if(">" == t_s){t_i = t_f > llList2Float(cnd, 2);} + } + if(t_i) return dbIndex; + else return FALSE; +} + + +string _trm(string val) +{ + return llStringTrim(val, STRING_TRIM); +} + + +dbTruncate(string tab) +{ + dbIndex = dbOpen(tab); + while(dbIndex > 0) dbDelete(dbIndex--); +} + + +dbSort(integer dir) +{ + t_i = ts_ + tc_; + _d_ = llListReplaceList(_d_, llListSort(llList2List(_d_, t_i, t_i + tc_ * tr_ - 2), tc_, dir), t_i, t_i + tc_ * tr_ - 2); +} + + +float dbFn(string fn, string col) +{ + t_i = ts_ + tc_; + t_l = llList2List(_d_, t_i, t_i + tc_ * tr_ - 2); + if(dbCol(col) != 0) t_l = llDeleteSubList(t_l, 0, dbCol(col) - 1); + return llListStatistics(llSubStringIndex("ramimaavmedesusqcoge", llGetSubString(llToLower(fn),0,1)) / 2, + llList2ListStrided(t_l, 0, -1, tc_)); +} +// +//--------------------------- End VK-DBMS-VM ---------------------------\\ +// + + +// Configuration + + // Constants +integer ComChannel = -63473670; // Secret Negative Channel for Server Communication +integer UnitComChannel; // Channel Used to Communicate with Furniture inside Unit +list KEYS = [ "5b8c8de4-e142-4905-a28f-d4d00607d3e9", "b9dbc6a4-2ac3-4313-9a7f-7bd1e11edf78", "dbfa0843-7f7f-4ced-83f6-33223ae57639" ]; +list Admins = []; +string EMPTY = ""; +key SecurityKey = "3d7b1a28-f547-4d10-8924-7a2b771739f4"; +float LightHoldLength = 0.1; +string SecureRequest = "TheKeyIs(Mq=h/c2)"; +string cName = ".config"; // Name of Configuration NoteCard + // Off-World Data Communication Constants +key HTTPRequestHandle; // Handle for HTTP Request +string URLBase = "http://api.orbitsystems.ca/api.php"; +list HTTPRequestParams = [ + HTTP_METHOD, "POST", + HTTP_MIMETYPE, "application/x-www-form-urlencoded", + HTTP_BODY_MAXLENGTH, 16384, + HTTP_CUSTOM_HEADER, "CUSKEY", "TheKeyIs(Mq=h/c2)" +]; + + + // Indicator Light Config + float GlowOn = 0.10; + float GlowOff = 0.0; + list ONColorVectors = [<0.0,1.0,0.0>,<1.0,0.5,0.0>,<1.0,0.0,0.0>]; + list ColorNames = ["Green", "Orange", "Red"]; + list OFFColorVectors = [<0.0,0.5,0.0>,<0.5,0.25,0.0>,<0.5,0.0,0.0>]; + integer PWRLIGHT = 2; + integer CFGLIGHT = 3; + integer INLIGHT = 4; + integer OUTLIGHT = 5; + + + + // Variables +integer ComHandle; // Hold Handle to Control Server Com Channel +integer cLine; // Holds Configuration Line Index for Loading Config Loop +key cQueryID; // Holds Current Configuration File Line during Loading Loop +string GameName = ""; +string DBName = "Units"; +integer DBEntries = 0; + + // Switches +integer DebugMode = TRUE; // Are we running in with Debug Messages ON? + // Flags + string OpFlag = ""; + +// User Database Configuration Directives +string UserUploadTimer; + + // Functions + +// Debug Message +DebugMessage(string message){ + if(DebugMode){ + llOwnerSay(message); + } +} + +Initialize(){ + llListenRemove(ComHandle); + llListen(ComChannel, EMPTY, EMPTY, EMPTY); + // UNITID, PRICE, DISCOUNT, MINRENT, MAXRENT, RENTED, RENTERKEY, EXPIRE + string CreatedDB = dbCreate(DBName, ["unitid", "price", "discount", "minrent", "maxrent", "rented", "renterkey", "expire", "prims", "texture"]); + if(CreatedDB==DBName && DebugMode){ + llOwnerSay("Database "+DBName+" Created..."); + } + DebugMessage("Configuring..."); + cQueryID = llGetNotecardLine(cName, cLine); +} + +SystemStart(){ + llOwnerSay("System Online!"); +} + +LightToggle(integer LinkID, integer ISON, string Color){ + if(ISON){ + vector ColorVector = llList2Vector(ONColorVectors, llListFindList(ColorNames, [Color])); + llSetLinkPrimitiveParamsFast(LinkID, [ + PRIM_COLOR, ALL_SIDES, ColorVector, 1.0, + PRIM_GLOW, ALL_SIDES, GlowOn, + PRIM_FULLBRIGHT, ALL_SIDES, TRUE + ]); + }else{ + vector ColorVector = llList2Vector(OFFColorVectors, llListFindList(ColorNames, [Color])); + llSetLinkPrimitiveParamsFast(LinkID, [ + PRIM_COLOR, ALL_SIDES, ColorVector, 1.0, + PRIM_GLOW, ALL_SIDES, GlowOff, + PRIM_FULLBRIGHT, ALL_SIDES, FALSE + ]); + } +} + +// Add Admin (Add provided Legacy Name to Admins List after extrapolating userKey) +AddAdmin(string LegacyName){ + string FName = llList2String(llParseString2List(LegacyName, [" "], []), 0); + string LName = llList2String(llParseString2List(LegacyName, [" "], []), 1); + //DebugMessage("First Name: "+FName+" Last Name: "+LName); + key UserKey = osAvatarName2Key(FName, LName); + if(UserKey!=NULL_KEY){ + Admins = Admins + UserKey; + DebugMessage("Added Admin: "+LegacyName); + }else{ + DebugMessage("Unable to Resolve: "+LegacyName); + } +} + +// Check Security +integer CheckSecurity(key id){ + if(llListFindList(Admins, [id])!=-1){ + return TRUE; + }else{ + return FALSE; + } +} + +LoadConfig(string data){ + LightToggle(CFGLIGHT, TRUE, "Orange"); + if(data!=""){ // If Line is not Empty + // if the line does not begin with a comment + if(llSubStringIndex(data, "#") != 0) + { + // find first equal sign + integer i = llSubStringIndex(data, "="); + + // if line contains equal sign + if(i != -1){ + // get name of name/value pair + string name = llGetSubString(data, 0, i - 1); + + // get value of name/value pair + string value = llGetSubString(data, i + 1, -1); + + // trim name + list temp = llParseString2List(name, [" "], []); + name = llDumpList2String(temp, " "); + + // make name lowercase + name = llToLower(name); + + // trim value + temp = llParseString2List(value, [" "], []); + value = llDumpList2String(temp, " "); + + // Check Key/Value Pairs and Set Switches and Lists + if(name=="debugmode"){ + if(value=="TRUE" || value=="true"){ + DebugMode = TRUE; + DebugMessage("Debug Mode: Enabled!"); + }else if(value=="FALSE" || value=="false"){ + DebugMode = FALSE; + llOwnerSay("Debug Mode: Disabled!"); + } + }else if(name=="comchannel"){ + ComChannel = (integer)value; + if(ComHandle>0){ + DebugMessage("Closing Old Com Channel..."); + llListenRemove(ComHandle); + ComHandle = 0; + } + DebugMessage("Opening Com Channel ("+(string)ComChannel+")..."); + ComHandle = llListen(ComChannel, EMPTY, EMPTY, EMPTY); + if(ComHandle>0){ + DebugMessage("Com Channel Open!"); + } + }else if(name=="securitykey"){ + SecurityKey = (key)value; + if(SecurityKey!=NULL_KEY){ + DebugMessage("Inter Device Communications Key: "+(string)SecurityKey); + }else{ + DebugMessage("Inter Device Communications Key NOT FOUND!"); + } + }else if(name=="unit"){ + list InputData = llParseString2List(value, ["||"], []); + string UnitID = llList2String(InputData, 0); + integer Price = llList2Integer(InputData, 1); + float Discount = llList2Float(InputData, 2); + integer MinRent = llList2Integer(InputData, 3); + integer MaxRent = llList2Integer(InputData, 4); + integer Prims = llList2Integer(InputData, 5); + key Texture = llList2Key(InputData, 6); + DebugMessage("\nNew Unit Details: \nUnit ID: "+UnitID+"\nPrice: "+(string)Price+" /wk\nDiscount: "+(integer)Discount+" %\nMin Rental Time: "+(string)MinRent+" Week(s)\nMax Rental Time: "+(string)MaxRent+" Week(s)"+"\nMax Prims: "+(string)Prims+"\nImg Texture Key: "+(string)Texture); + // UNITID, PRICE, DISCOUNT, MINRENT, MAXRENT, RENTED, RENTERKEY, EXPIRE, PRIMS, Texture + DBEntries = dbInsert([UnitID, Price, Discount, MinRent, MaxRent, "FALSE", NULL_KEY, 0, Prims, Texture]); + //DebugMessage("DBEntries: "+(string)DBEntries); + }else if(name=="admin"){ + AddAdmin(value); + }else if(name=="unitcomchannel"){ + UnitComChannel = (integer)value; + DebugMessage("Unit Com Channel: "+(string)UnitComChannel); + } + LightToggle(CFGLIGHT, FALSE, "Orange"); + }else{ // line does not contain equal sign + llOwnerSay("Configuration could not be read on line " + (string)cLine); + } + } + } +} + +// Register Server with Off-World Database System (Also Sync) +RegisterServer(string cmd, list UnitData){ + if(cmd=="CheckReg"){ + DebugMessage("Registering Server..."); + OpFlag = cmd; + string CmdString = "?"+llStringToBase64("cmd")+"="+llStringToBase64("CheckReg")+"&"+llStringToBase64("Key")+"="+llStringToBase64(SecurityKey); + string URL = URLBase + CmdString; + list SendParams = HTTPRequestParams + ["ServerType", "Rental"]; + HTTPRequestHandle = llHTTPRequest(URL, SendParams, ""); // Send Request to Server to Check and/or Register this Server + }else if(cmd=="Sync"){ + DebugMessage("Syncing..."); + OpFlag = cmd; + string CmdString = "?"+llStringToBase64("cmd")+"="+llStringToBase64(OpFlag)+"&"+llStringToBase64("Key")+"="+llStringToBase64(SecurityKey); + string URL = URLBase + CmdString; + list SendParams = HTTPRequestParams + ["ServerType", "Rental"]; + string DumpString = GetData(); + //llOwnerSay(DumpString); + string EncodedDumpString = llStringToBase64(DumpString); + string MessageBody = "data="+EncodedDumpString; + integer MessageBodyLength = llStringLength(MessageBody); + HTTPRequestHandle = llHTTPRequest(URL, SendParams, MessageBody); // Send Request to Server to Check and/or Register this Server + }else if(cmd=="Update"){ + OpFlag = cmd; + string CmdString = "?"+llStringToBase64("cmd")+"="+llStringToBase64(OpFlag)+"&"+llStringToBase64("Key")+"="+llStringToBase64(SecurityKey); + string URL = URLBase + CmdString; + list SendParams = HTTPRequestParams + ["ServerType", "Rental"]; + string DumpString = llDumpList2String(UnitData, "||"); + //llOwnerSay(DumpString); + string EncodedDumpString = llStringToBase64(DumpString); + string MessageBody = "data="+EncodedDumpString; + integer MessageBodyLength = llStringLength(MessageBody); + HTTPRequestHandle = llHTTPRequest(URL, SendParams, MessageBody); // Send Request to Server to Check and/or Register this Server + } +} + +// Get All Entires out of Database and Return them as String Formatted as such: +// {UnitID}||{Price}||{Discount}||{MinRent}||{MaxRent}||{Rented}||{RenterKey}||{Expire}||{Prims}||{Texture}, +string GetData(){ + dbIndex = 1; + string ReturnString = ""; + for(dbIndex=1;dbIndex<=DBEntries;dbIndex++){ + list CurrentLine = dbGet(dbIndex); + if(llList2String(CurrentLine, 0)==""){ return ReturnString; } + // UNITID, PRICE, DISCOUNT, MINRENT, MAXRENT, RENTED, RENTERKEY, EXPIRE, PRIMS + string UnitID = llList2String(CurrentLine, 0); + string Price = llList2String(CurrentLine, 1); + string Discount = (string)llList2Integer(CurrentLine, 2); + string MinRent = llList2String(CurrentLine, 3); + string MaxRent = llList2String(CurrentLine, 4); + string Rented = llList2String(CurrentLine, 5); + string RenterKey = llList2String(CurrentLine, 6); + string Expire = llList2String(CurrentLine, 7); + string Prims = llList2String(CurrentLine, 8); + string Texture = llList2String(CurrentLine, 9) + ","; + list TempList = [ UnitID, Price, Discount, MinRent, MaxRent, Rented, RenterKey, Expire, Prims, Texture]; + string CompiledString = llDumpList2String(TempList, "||"); + ReturnString = ReturnString + CompiledString; + } + return ReturnString; +} + +// Prep Unit After Rental +PrepUnit(string UnitID, key Renter){ + //llRegionSayTo(Renter, 0, "Setting up your Unit..."); + list SendList = [ SecurityKey, "NR", UnitID, Renter ]; + string SendString = llStringToBase64(llDumpList2String(SendList, "||")); + DebugMessage(SendString); + llRegionSay(ComChannel, SendString); +} + +// Main Program +default{ + on_rez(integer params){ + //llGiveInventory(llGetOwner(), llGetInventoryName(INVENTORY_NOTECARD, 1)); + llResetScript(); + } + + state_entry(){ + LightToggle(PWRLIGHT, TRUE, "Red"); + llSleep(LightHoldLength); + LightToggle(CFGLIGHT, TRUE, "Orange"); + llSleep(LightHoldLength); + LightToggle(CFGLIGHT, FALSE, "Orange"); + LightToggle(INLIGHT, TRUE, "Green"); + llSleep(LightHoldLength); + LightToggle(INLIGHT, FALSE, "Green"); + LightToggle(OUTLIGHT, TRUE, "Green"); + llSleep(LightHoldLength); + LightToggle(OUTLIGHT, FALSE, "Green"); + Initialize(); + } + + dataserver(key query_id, string data){ // Config Notecard Read Function Needs to be Finished + if (query_id == cQueryID){ + if (data != EOF){ + LoadConfig(data); // Process Current Line + ++cLine; // Incrment Line Index + cQueryID = llGetNotecardLine(cName, cLine); // Attempt to Read Next Config Line (Re-Calls DataServer Event) + }else{ // IF EOF (End of Config loop, and on Blank File) + LightToggle(CFGLIGHT, TRUE, "Orange"); + // Check if Server is Registered with Website + RegisterServer("CheckReg", []); + } + } + } + + changed(integer c){ + if(c & CHANGED_INVENTORY){ + llResetScript(); + } + } + + listen(integer chan, string cmd, key id, string data){ + if(DebugMode){ + llOwnerSay("Listen Event Fired!\r"+data); + } + LightToggle(INLIGHT, TRUE, "Green"); + list InputData = llParseString2List(data, ["||"], []); + string CMD = llList2String(InputData, 0); + if(CMD=="GETCONFIG"){ + string UnitID = llList2String(InputData, 1); + DebugMessage("Configuration Data Requested for Unit: "+UnitID); + integer IDLength = llStringLength(UnitID); + string Wing = EMPTY; + string Unit = EMPTY; + integer DBIndex; + if(IDLength==2){ + Wing = llGetSubString(UnitID, 1, 1); + Unit = llGetSubString(UnitID, 0, 0); + }else if(IDLength==3){ + Wing = llGetSubString(UnitID, 2, 2); + Unit = llGetSubString(UnitID, 0, 1); + } + if(llToLower(Wing)=="a"){ + DBIndex = (integer)Unit; + }else if(llToLower(Wing)=="b"){ + DBIndex = ((integer)Unit + (DBEntries / 2)); + }else{ + llOwnerSay("ERROR"); + } + list UnitData = dbGet(DBIndex); + string UnitIDb = llList2String(UnitData, 0); + if(UnitID!=UnitIDb){ + DebugMessage("UnitID: "+UnitID+" UnitIDb: "+UnitIDb); + return; + } + LightToggle(INLIGHT, FALSE, "Green"); + LightToggle(OUTLIGHT, TRUE, "Green"); + string Price = llList2String(UnitData, 1); + string Discount = (string)llList2Integer(UnitData, 2); + string MinRent = llList2String(UnitData, 3); + string MaxRent = llList2String(UnitData, 4); + string Rented = llList2String(UnitData, 5); + string RenterKey = llList2String(UnitData, 6); + string Expire = llList2String(UnitData, 7); + string Prims = llList2String(UnitData, 8); + string Texture = llList2String(UnitData, 9); + list Output = [ SecurityKey, "UNIT", UnitID, Price, Discount, MinRent, MaxRent, Rented, RenterKey, Expire, Prims, Texture]; + string OutputString = llDumpList2String(Output, "||"); + DebugMessage("Sending Config Data: "+OutputString); + llRegionSayTo(id, ComChannel, OutputString); + LightToggle(OUTLIGHT, FALSE, "Green"); + }else if(CMD=="RENTED" || CMD=="AVAIL"){ + list NewUnitData = llList2List(InputData, 1, -1); + string UnitID = llList2String(NewUnitData, 0); + integer IDLength = llStringLength(UnitID); + string Wing = EMPTY; + string Unit = EMPTY; + integer DBIndex; + if(IDLength==2){ + Wing = llGetSubString(UnitID, 1, 1); + Unit = llGetSubString(UnitID, 0, 0); + }else if(IDLength==3){ + Wing = llGetSubString(UnitID, 2, 2); + Unit = llGetSubString(UnitID, 0, 1); + } + if(llToLower(Wing)=="a"){ + DBIndex = (integer)Unit; + }else if(llToLower(Wing)=="b"){ + DBIndex = ((integer)Unit + (DBEntries / 2)); + }else{ + llOwnerSay("ERROR"); + } + + dbIndex = DBIndex; + // UNITID, PRICE, DISCOUNT, MINRENT, MAXRENT, RENTED, RENTERKEY, EXPIRE, PRIMS, Texture + integer NewIndex = dbPut([llList2String(NewUnitData, 0), llList2String(NewUnitData, 1), llList2String(NewUnitData, 2), llList2String(NewUnitData, 3), llList2String(NewUnitData, 4), llList2String(NewUnitData, 5), llList2String(NewUnitData, 6), llList2String(NewUnitData, 7), llList2String(NewUnitData, 8), llList2String(NewUnitData, 9)]); + list UpData = dbGet(DBIndex); + DebugMessage("Updating Remote Server..."); + RegisterServer("Update", UpData); + } + } + + touch_start(integer num){ + if(num>1){ + return; + } + if(!CheckSecurity(llDetectedKey(0))){ + llRegionSayTo(llDetectedKey(0), 0, "You are not authorized!"); + return; + } + DebugMode = !DebugMode; + if(DebugMode){ + DebugMessage("Debug Mode Enabled!"); + DebugMessage("Dumping Database..."); + integer i; + for(i=1;i<=DBEntries;i++){ + list UnitData = dbGet(i); + DebugMessage("DB Entry #: "+(string)i+"\nUnit ID: "+llList2String(UnitData, 0)+"\nPrice: "+llList2String(UnitData, 1)+" /wk\nDiscount: "+(string)llList2Integer(UnitData, 2)+" %\nMin Rent: "+llList2String(UnitData, 3)+"Week(s)\nMax Rent: "+llList2String(UnitData, 4)+"Weeks(s)\nRented: "+llList2String(UnitData, 5)+"\nRenter: "+llKey2Name(llList2Key(UnitData, 6))+"\nExpiry: "+llList2String(UnitData, 7)+"\nMax Prims: "+llList2String(UnitData, 8)+"\nTexture Key: "+llList2String(UnitData, 9)); + } + }else{ + llOwnerSay("Debug Mode Disabled!"); + } + } + + http_response(key request_id, integer status, list metadata, string body) + { + if (request_id != HTTPRequestHandle) return;// exit if unknown + if(OpFlag=="CheckReg"){ + vector COLOR_BLUE = <0.0, 0.0, 1.0>; + float OPAQUE = 1.0; + list OutputData = llCSV2List(body); // Parse Response into List + string InputKey = llBase64ToString(llList2String(OutputData, 1)); + string InputCMD = llBase64ToString(llList2String(OutputData, 0)); + if(InputKey!=SecurityKey){ + llOwnerSay("Invalid Security Key Received from RL Server!\r"+body); + }else{ + if(InputCMD=="ALRDYREGOK"){ // Server Already Registered + if(DebugMode){ + llOwnerSay("Server Already Registered!"); + } + }else if(InputCMD=="REGOK"){ // Server Successfully Registered + if(DebugMode){ + llOwnerSay("Server Successfully Registered!"); + } + }else if(InputCMD=="REGERR"){ // Error Registering Server with Off-World Database + llOwnerSay("Error Registering Server with Database!"); + }else if(InputCMD=="CHECKERR"){ // Error Checking Database for Server Registration + llOwnerSay("Error Checking Database for Server Registration"); + }else{ + llOwnerSay("Response from server not reconignized!"); + } + } + LightToggle(CFGLIGHT, FALSE, "Orange"); + RegisterServer("Sync", []); + }else if(OpFlag=="Sync"){ + list InputData = llParseString2List(body, [":"], []); + string ResponseCode = llList2String(InputData, 0); + if(ResponseCode=="UPDATE"){ // In-Ward Sync + list OffWorldData = llCSV2List(llList2String(InputData, 1)); + if(dbDrop(DBName)){ + string CreatedDB = dbCreate(DBName, ["unitid", "price", "discount", "minrent", "maxrent", "rented", "renterkey", "expire", "prims", "texture"]); + if(CreatedDB==DBName && DebugMode){ + llOwnerSay("Database "+DBName+" Cleared..."); + } + integer i; + for(i=0;i0){ + return; + } + llOwnerSay("Opening Com Channel("+(string)ComChannel+")..."); + ComHandle = llListen(ComChannel, EMPTY, EMPTY, EMPTY); + if(ComHandle>0){ + llOwnerSay("Com Channel Open!"); + } + }else if(llToLower(msg)=="no"){ + llOwnerSay("Please set correct Unit ID in Description Field!\nResetting in 5 minutes..."); + llSetTimerEvent(300.0); + } + }else{ + + } + }else if(channel==ComChannel){ + //llOwnerSay("msg: "+msg); + list InputData = llParseString2List(msg, ["||"], []); + string UnitName = llList2String(InputData, 1); + string Rented = llList2String(InputData, 6); + if(UnitName==UnitID){ + if(Rented=="TRUE"){ + SetState("Rented"); + }else if(Rented=="FALSE"){ + SetState("NotRented"); + } + } + + } + } + + timer(){ + llSetTimerEvent(0.0); + llOwnerSay("Resetting..."); + llResetScript(); + } +} \ No newline at end of file diff --git a/Single Vendor v1.09/Config.txt b/Single Vendor v1.09/Config.txt new file mode 100644 index 00000000..06f0a4e9 --- /dev/null +++ b/Single Vendor v1.09/Config.txt @@ -0,0 +1,50 @@ +# Vendor v1.8 Configuration File +# +# Created by Tech Guy 2014 + + +#DO NOT CHANGE THIS LINE +luna=1251 + +# YOUR CONFIGURATION IS BELOW THIS LINE +# Mark as True if all item will be the same price. +singleprice=true + +# The Single Price of All Items +price=199 + +# Set to True if you wish to use HoverText over your vendor board +hovertext=true + +# The Text for the Hover Text Field if previous option is set to true. If set false this option can be ignored. Set this Option to 'dynamic' to read text from product names +hovertextstring=dynamic + +# Hover Text Color +# Colors to choose from: +# "NAVY", "BLUE", "AQUA", "TEAL", "OLIVE", "GREEN, LIME", "YELLOW", "ORANGE", "RED", "MAROON", "FUCHSIA", "PURPLE", "WHITE", "SILVER", "GRAY", "BLACK" +hovertextcolor=white + +#Hover Text Price Label E.g: "Buy Now" or "Price" This Label preceeds the Price in P$ in the HoverText +hoverpricelabel=Buy Now + +#Loop Product Selction when at end of List (true vs false) +loopselection=true +# Name of InfoCard Given from ! Button +infocard=myinfocard +# Name of Vendor Help Card Given from ? Button +helpcard=vendorhelp +#Should we auto cycle through your products +slideshow=true +# If slideshow is enabled how often should we switch Products (in seconds) +slidetimer=10 +#Enable Profit Sharing (TRUE/FALSE) +profitsharing=TRUE +# UUIDs of ShareHolders, Un-Used lines are ignored. +ShareHolder=Tech Guy||33 +ShareHolder=Zoie Viper||33 +ShareHolder=Sebastian Viper||33 + + + + + diff --git a/Single Vendor v1.09/Vendor Engine v1.09.lsl b/Single Vendor v1.09/Vendor Engine v1.09.lsl new file mode 100644 index 00000000..de8b63a8 --- /dev/null +++ b/Single Vendor v1.09/Vendor Engine v1.09.lsl @@ -0,0 +1,729 @@ + // Hard-Coded Variables +string cName = ".config"; // Name of Configuration NoteCard +integer BufferFace = 3; // Face to Preload the Next Texture Given the Last Direction used. LOL "BUFFER FACE!!!" +integer DisplayFace = 1; // Face to Display Product +integer DisplayPrimID = 2; // Link number of Prim used to Display and Buffer Textures +integer DHandleChannel = -18006; // Dialog Handle Channel +float DHandleTimeOut = 60.0; + // Color Vectors +list colorsVectors = [<0.000, 0.122, 0.247>, <0.000, 0.455, 0.851>, <0.498, 0.859, 1.000>, <0.224, 0.800, 0.800>, <0.239, 0.600, 0.439>, <0.180, 0.800, 0.251>, <0.004, 1.000, 0.439>, <1.000, 0.863, 0.000>, <1.000, 0.522, 0.106>, <1.000, 0.255, 0.212>, <0.522, 0.078, 0.294>, <0.941, 0.071, 0.745>, <0.694, 0.051, 0.788>, <1.000, 1.000, 1.000>, <0.867, 0.867, 0.867>, <0.667, 0.667, 0.667>, <0.000, 0.000, 0.000>]; + // List of Names for Colors +list colors = ["NAVY", "BLUE", "AQUA", "TEAL", "OLIVE", "GREEN", "LIME", "YELLOW", "ORANGE", "RED", "MAROON", "FUCHSIA", "PURPLE", "WHITE", "SILVER", "GRAY", "BLACK"]; + + + // Empty Variales to be filled by script +key user; // UUID of Customer Avatar +string mode = ""; +list prodBoxes; // List that will contain Product Box Names +list prodNC; // List that will contain Product Notecard Names +list prodImages; // List that will contain Product Images for Display on main Board. +list prodPrices; // List that will contain Product Prices of Configured to read prices from box description. +integer NumProds; // Hold Total NUmber of Products +integer prodIndex; // Product Index Storage Variable (Changes with Current viewed Product) +string GiftRecipientID; // Hold Key of User object will be gifted too. +integer cLine; // Holds Configuration Line Index for Loading Config Loop +key cQueryID; // Holds Current Configuration File Line during Loading Loop +string NavDirection = "up"; // Will Hold Direction of users surfing through vendor, (up vs down) +integer SlideCount = 0; // Hold Product ID If SlideShow Mode is turned on. +integer MoneyPerm; // Holds Script Money Permissions Mask +integer price; // Hold Price for Final Money Event Call + +// Share Holders Configuration Variables +integer ProfitSharing = FALSE; +list ShareHolders = []; +float SharePercentage = 0.0; +integer NumShareHolders = 0; +list ShareHoldersCut = []; +integer TotalShareHolderPercent = 0; + + // Handles +integer DListener; // Main Dialog Listener Handle + + // Initially Coded but flexible Switches +integer SinglePrice = TRUE; // True if All Items use One Uniform Price +integer SPrice; // Holds Price obtained from Config file (If previous swich is TRUE) +integer PriceInDesc = FALSE; // True if price can be found in description of each box in inventory + +integer HoverText = TRUE; // Enable HoverText By Default +integer TextFromNames = FALSE; // Should Hover Text be based on Currently viewed product. +string HTextString = "Vendor Hover Text"; // Default Vendor Hover Text +vector HTextColor; // Default Vendor Hover Text Color Vector +string HTextColorString; // Hold Name of Currently Selected Hover Text Color +string HTextPriceLabel; // Hover Text Price Label Holder + +integer LoopProducts = TRUE; // True if we want to cycle product list upon reaching the end. +string InfoCard = ""; // Name of InfoCard NC +string VendorHelpCard = ""; // Name of Vendor Help NC + +string ResetReason = "Refresh"; +float SlideTimer = 10.0; +float ResetTimer = 600.0; +integer SlideShow = TRUE; +integer CheckConfig(string NCtoCheck){ + integer ConfigFileCheck = llGetInventoryType(NCtoCheck); + if(ConfigFileCheck == INVENTORY_NOTECARD){ // File Exists and is a NoteCard + return TRUE; + }else{ // File Exists but is of different Type + return FALSE; + } +} + +LoadConfig(string data){ + if(data!=""){ // If Line is not Empty + // if the line does not begin with a comment + if(llSubStringIndex(data, "#") != 0) + { + // find first equal sign + integer i = llSubStringIndex(data, "="); + + // if line contains equal sign + if(i != -1){ + // get name of name/value pair + string name = llGetSubString(data, 0, i - 1); + + // get value of name/value pair + string value = llGetSubString(data, i + 1, -1); + + // trim name + list temp = llParseString2List(name, [" "], []); + name = llDumpList2String(temp, " "); + + // make name lowercase + name = llToLower(name); + + // trim value + temp = llParseString2List(value, [" "], []); + value = llDumpList2String(temp, " "); + + // Check Key/Value Pairs and Set Switches and Lists + if(name == "luna"){ // Found Luna Directive + if(value=="1251"){ // Check Value and Continue + integer luna = TRUE; // Luna Directive Marked TRUE; + }else{ // Incorrect Value Break Vendor and wait for inventory change + llOwnerSay("Configuration file Error! Please reload from Example File contained in vendor. Consult Documentation."); + state broken; + } + }else if(name == "singleprice" && value!=""){ + value = llToLower(value); + if(value=="true"){ + SinglePrice = TRUE; + llOwnerSay("Single Price Configuration..."); + }else{ + SinglePrice = FALSE; + } + }else if(name == "price" && value!=""){ + if(SinglePrice){ + SPrice = (integer)value; + llOwnerSay("Single Price: "+value); + } + }else if(name=="hovertext"){ + value = llToLower(value); + if(value=="true"){ + HoverText = TRUE; + llOwnerSay("Hover Text: Enabled"); + }else{ + HoverText = FALSE; + llOwnerSay("Hover Text: Disabled"); + } + }else if(name=="hovertextstring"){ + if(value==llToLower(value)){ + TextFromNames = TRUE; + llOwnerSay("Dynamic HoverText Set..."); + }else{ + TextFromNames = FALSE; + HTextString = value; + llOwnerSay("Staic HoverText: "+value); + } + }else if(name=="slideshow"){ + value = llToLower(value); + if(value=="true"){ + SlideShow = TRUE; + llOwnerSay("SlideShow Mode: Enabled"); + }else{ + SlideShow = FALSE; + llOwnerSay("SlideShow Mode: Disabled"); + } + }else if(name=="hovertextcolor"){ + if(HoverText){ + value = llToUpper(value); + integer cIndex; + integer lLength = llGetListLength(colors); + for(cIndex=0;cIndexListLength){ + llOwnerSay("\nShare Holder '"+FName+" "+LName+"' Added!\nThier UUID: "+llList2String(ShareHolders, NumShareHolders)+"\nShare Holder Cut: "+llList2String(ShareHoldersCut, llListFindList(ShareHoldersCut, [HisCut]))+"%"); + NumShareHolders++; + TotalShareHolderPercent = TotalShareHolderPercent + (integer)HisCut; + if(TotalShareHolderPercent>100){ + ProfitSharing = FALSE; + llOwnerSay("ERROR! Total ShareHolder Percentage is Greater than 100%!\nProfit Sharing Disabled!"); + } + } + }else if(name=="shareholder" && !ProfitSharing){ + + }else{ + llOwnerSay("Unknown configuration value: " + name + " on line " + (string)cLine); + } + }else{ // line does not contain equal sign + llOwnerSay("Configuration could not be read on line " + (string)cLine); + } + } + } +} + +CheckPerms(string Name, integer InvType){ + integer permCode = llGetInventoryPermMask(Name, MASK_NEXT); + if(InvType==INVENTORY_OBJECT){ + if(~permCode & PERM_COPY){ + llOwnerSay("Item: "+Name+" is not marked as copy, your object will be lost from vendor inventory on purchase.\n Please Mark as Copy to avoid this issue."); + } + if(permCode & PERM_TRANSFER){ + llOwnerSay("Item: "+Name+" is marked as TRANSFER, Customers will be able to resell this product."); + } + }else if(InvType==INVENTORY_NOTECARD){ + if(~permCode & PERM_COPY){ + llOwnerSay("Item: "+Name+" is not marked as copy, your object will be lost from vendor inventory on purchase.\n Please Mark as Copy to avoid this issue."); + } + if(permCode & PERM_TRANSFER){ + llOwnerSay("Item: "+Name+" is marked as TRANSFER, Customers will be able to resell this product."); + } + } +} + +ShareProfits(integer Income){ + integer i; + for(i=0;i<=llGetListLength(ShareHolders)-1;i++){ // For Each Share Holder in the List + string ShareHolderID = llList2String(ShareHolders, i); + float HisCut = (float)Income * (llList2Float(ShareHoldersCut, i) / 100); + integer PayHim = (integer)HisCut; + string Name = osKey2Name((key)ShareHolderID); + llGiveMoney(ShareHolderID, PayHim); + } +} + +LoadInventory(){ // Load Invectory into prodBoxes & prodImages Lists + integer i; + NumProds = llGetInventoryNumber(INVENTORY_OBJECT); + if(NumProds<=0){ + llOwnerSay("No Products Found! Please place your products inside the vendors 'Content' Tab"); + state broken; + }else{ + llOwnerSay((string)NumProds+" Found!"); + } + for(i=0;i<=NumProds-1;i++){ + //Get Product Box By Name and Checks it's Permissions + string objName = llGetInventoryName(INVENTORY_OBJECT, i); + CheckPerms(objName, INVENTORY_OBJECT); + prodBoxes += objName; + + //Get Product Texture by Name and Check It's Permissions + string TextureName = llGetInventoryName(INVENTORY_TEXTURE, i); + CheckPerms(TextureName, INVENTORY_TEXTURE); + prodImages += llGetInventoryKey(llGetInventoryName(INVENTORY_TEXTURE, i)); + + // Get Product Notecards by Name and Check Their Permissions + string NoteName = llGetInventoryName(INVENTORY_NOTECARD, i); + if(NoteName==".config" || NoteName==InfoCard || NoteName == VendorHelpCard){ + i++; + NoteName = llGetInventoryName(INVENTORY_NOTECARD, i); + if(NoteName == ".config" || NoteName == InfoCard || NoteName == VendorHelpCard){ + i++; + NoteName = llGetInventoryName(INVENTORY_NOTECARD, i); + if(NoteName == ".config" || NoteName == InfoCard || NoteName == VendorHelpCard){ + i++; + NoteName = llGetInventoryName(INVENTORY_NOTECARD, i); + if(NoteName == ".config" || NoteName == InfoCard || NoteName == VendorHelpCard){ + i=i-3; + llOwnerSay("Unable to Find Matching Notecard to Found Product: "+llList2String(prodBoxes, i)+"\nPlease consult documentation..."); + state broken; + }else{ + CheckPerms(NoteName, INVENTORY_NOTECARD); + prodNC += llGetInventoryName(INVENTORY_NOTECARD, i); + i = i-3; + } + }else{ + CheckPerms(NoteName, INVENTORY_NOTECARD); + prodNC += llGetInventoryName(INVENTORY_NOTECARD, i); + i = i-2; + } + }else{ + CheckPerms(NoteName, INVENTORY_NOTECARD); + prodNC += llGetInventoryName(INVENTORY_NOTECARD, i); + i--; + } + }else{ + CheckPerms(NoteName, INVENTORY_NOTECARD); + prodNC += llGetInventoryName(INVENTORY_NOTECARD, i); + } + + // Set All Prices in List to 9999 + prodPrices += 9999; + if(llList2String(prodBoxes, i)!="" && llList2String(prodImages, i)!=""){ + llOwnerSay("Found Item: "+llList2String(prodBoxes, i)); + llOwnerSay("Found Texture: "+llList2String(prodImages, i)); + llOwnerSay("Found NoteCard: "+llList2String(prodNC, i)); + }else{ + llOwnerSay("ERROR: Could not find Matching Texture for Product: "+llList2String(prodBoxes, i)); + } + } + llOwnerSay(NumProds+" Different Products Successfully Loaded!"); + Init(); +} + +Init(){ + if(!SinglePrice){ + llOwnerSay("Starting Vendor...\nVendor is in Custom Price Mode. See Documentation for help setting prices in this mode.\nAll Prices set to P$ 9999"); + }else{ + llOwnerSay("Starting Vendor in Single Price Mode..."); + } + if(HoverText){ + if(TextFromNames){ + if(SinglePrice){ + llSetText(llList2String(prodBoxes, prodIndex)+"\n"+HTextPriceLabel+": P$ "+SPrice, HTextColor, 1.0); + }else{ + llSetText(llList2String(prodBoxes, prodIndex)+"\n"+HTextPriceLabel+": P$ "+llList2Integer(prodPrices, prodIndex), HTextColor, 1.0); + } + }else{ + llSetText(HTextString, HTextColor, 1.0); + } + }else{ + llSetText("", HTextColor, 1.0); + } + state running; +} + +DisplayProduct(integer ProdID, string Direction){ + if(Direction=="up"){ + if(TextFromNames){ + if(HoverText){ + if(SinglePrice){ + llSetText(llList2String(prodBoxes, ProdID)+"\n"+HTextPriceLabel+": P$ "+SPrice, HTextColor, 1.0); + }else{ + llSetText(llList2String(prodBoxes, ProdID)+"\n"+HTextPriceLabel+": P$ "+llList2Integer(prodPrices, ProdID), HTextColor, 1.0); + } + } + } + llSetLinkPrimitiveParamsFast(DisplayPrimID, [PRIM_TEXTURE, DisplayFace, llList2String(prodImages, prodIndex), <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0]); + llSetLinkPrimitiveParamsFast(DisplayPrimID, [PRIM_TEXTURE, BufferFace, llList2String(prodImages, prodIndex+1), <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0]); + }else if(Direction=="down"){ + if(TextFromNames){ + if(HoverText){ + if(SinglePrice){ + llSetText(llList2String(prodBoxes, ProdID)+"\n"+HTextPriceLabel+": P$ "+SPrice, HTextColor, 1.0); + }else{ + llSetText(llList2String(prodBoxes, ProdID)+"\n"+HTextPriceLabel+": P$ "+llList2Integer(prodPrices, ProdID), HTextColor, 1.0); + } + } + } + llSetLinkPrimitiveParamsFast(DisplayPrimID, [PRIM_TEXTURE, DisplayFace, llList2String(prodImages, prodIndex), <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0]); + llSetLinkPrimitiveParamsFast(DisplayPrimID, [PRIM_TEXTURE, BufferFace, llList2String(prodImages, prodIndex-1), <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0]); + } +} + +default{ + on_rez(integer start_param){ + llResetScript(); + } + + state_entry(){ + llSetLinkPrimitiveParamsFast(DisplayPrimID, [PRIM_TEXTURE, DisplayFace, TEXTURE_BLANK, <1.0, 1.0, 1.0>, ZERO_VECTOR,0.0]); + llSetText("",<1.0,1.0,1.0>,1.0); + llOwnerSay("Searching for Configuration File..."); + // Check for Config NoteCard + integer ConfigFound = CheckConfig(cName); + if(ConfigFound==TRUE){ // Configuration Notecard Was Found + llOwnerSay("Configuration File Found!"); // Tell User File was found and allow script to proceed + }else{ // Config File was not found, Notify User and Switch to Broken State. + llOwnerSay("Configuration File NOT Found or is Incorrect FileType!\nPlease copy the contents of NoteCard EXAMPLE.config to a Notecard Named .config\nSee Documentation for further details."); + state broken; // Switch to Broken State and wait for inventory change. + } + llOwnerSay("Configuring..."); + cQueryID = llGetNotecardLine(cName, cLine); + } + dataserver(key query_id, string data){ // Config Notecard Read Function Needs to be Finished + if (query_id == cQueryID){ + if (data != EOF){ + LoadConfig(data); // Process Current Line + ++cLine; // Incrment Line Index + cQueryID = llGetNotecardLine(cName, cLine); // Attempt to Read Next Config Line (Re-Calls DataServer Event) + }else{ // IF EOF (End of Config loop, and on Blank File) + llOwnerSay("Please accept Debit Permissions..."); + llRequestPermissions(llGetOwner(), PERMISSION_DEBIT); + } + } + } + + run_time_permissions(integer perm) + { + MoneyPerm = perm; + if(MoneyPerm & PERMISSION_DEBIT){ + llOwnerSay("Debit Permissions OK"); + llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]); + llOwnerSay("Configuration Loaded!\nLoading Inventory..."); + LoadInventory(); + } + } +} + +state broken{ + state_entry(){ + llOwnerSay("Vendor Offline"); + } + + changed(integer change){ + if(change && change == CHANGED_INVENTORY){ + llOwnerSay("Inventory Modification Detected, Resetting..."); + llResetScript(); + } + } +} + +state running{ + state_entry(){ + if(SinglePrice){ + llOwnerSay("Vendor Online!"); + if(SlideShow){ + ResetReason = "NextSlide"; + llSetTimerEvent(SlideTimer); + } + }else{ + llOwnerSay("Vendor Online! Please Remember to Set Product Prices!\n Consult Documentation for Help."); + } + llSetLinkPrimitiveParamsFast(DisplayPrimID, [PRIM_TEXTURE, DisplayFace, llList2String(prodImages, prodIndex), <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0]); + llSetLinkPrimitiveParamsFast(DisplayPrimID, [PRIM_TEXTURE, BufferFace, llList2String(prodImages, prodIndex+1), <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0]); + } + + link_message(integer sender_num, integer num, string message, key id) + { + // Admin Dialog + if(message=="admin" && id==llGetOwner() && !SinglePrice){ + llSetTimerEvent(0); + DListener = llListen(DHandleChannel, "", id, ""); + llDialog(id, "What would you like to do?", ["Change Price", "Cancel"], DHandleChannel); + ResetReason = "Dialog"; + llSetTimerEvent(DHandleTimeOut); + mode = "admin"; + }else if(message=="admin"){ + if(llList2String(prodNC, prodIndex)==""){ + llSay(0, "There is not NoteCard Associated with this product to give you."); + return; + } + llGiveInventory(id, llList2String(prodNC, prodIndex)); + } + if(message=="next"){ + ResetReason = "NextSlide"; + llSetTimerEvent(60); + if(prodIndex==0){ + prodIndex++; + NavDirection = "up"; + DisplayProduct(prodIndex, NavDirection); + }else if(prodIndex==NumProds-1){ + if(LoopProducts){ + prodIndex = 0; + NavDirection = "up"; + DisplayProduct(prodIndex, NavDirection); + }else{ + llSay(0, "End of product list reached!"); + } + }else if(prodIndexprice){ + llSay(0, "You paid too much, Refunding Difference..."); + integer amtDiff = amount-price; + llGiveMoney(user, amtDiff); + llGiveInventory(user, llList2String(prodBoxes, prodIndex)); + ResetReason = "OrderRefresh"; + llSay(0, "Order Successful! Please accept your new item..."); + llSetTimerEvent(0); + llSetTimerEvent(15); + }else if(amount==price){ + llSay(0, "Thank You, Please accept your new item..."); + llGiveInventory(user, llList2String(prodBoxes, prodIndex)); + ResetReason = "OrderRefresh"; + if(ProfitSharing){ + ShareProfits(amount); + } + llSetTimerEvent(0); + llSetTimerEvent(15); + } + } + } +} \ No newline at end of file diff --git a/Street Lights/Street Light Command Receiver.lsl b/Street Lights/Street Light Command Receiver.lsl new file mode 100644 index 00000000..d9fb30ed --- /dev/null +++ b/Street Lights/Street Light Command Receiver.lsl @@ -0,0 +1,135 @@ +// Street Light Command Receiver v1.0 +// Created by Tech Guy of IO 2015 + +// Configuration + + // Constants + integer ComChannel = -8000; + string EMPTY = ""; + list LightFaces = [2, 3]; + list Poles = [1, 4]; + + // Input Message Reference IDS + integer STATE = 0; + integer LIGHTCOLOR = 1; + integer WHITECOLOR = 2; + integer INTENSITY = 3; + integer RADIUS = 4; + integer FALLOFF = 5; + integer POLECOLOR = 6; + + // Light Parameters + vector LightColor = <1.0,1.0,0.0>; // Yellow + vector WhiteColor = <1.0,1.0,1.0>; // White + float Intensity = 1.0; + float Radius = 20.0; + float FallOff = 0.5; + float GlowON = 0.10; + float GlowOFF = 0.0; + // Light Pole Parameters + vector PoleColor = <1.0,1.0,0.851>; + float Alpha = 1.0; // Alpha Used with Color Parameters + + // Variables + integer LightState = FALSE; + integer ComHandle; + // Switches + integer DebugMode = FALSE; + // Flags + + // Menus + +// Functions + +Initialize(){ + llOwnerSay("Initializing..."); + ComChannel = (integer)llGetObjectDesc(); + DebugMessage("Com Channel: "+(string)ComChannel); + llListenRemove(ComHandle); + llSleep(0.1); + ComHandle = llListen(ComChannel, EMPTY, EMPTY, EMPTY); +} + +ProcessMessage(string msg){ + list IncomingProperties = llParseString2List(msg, ["||"], []); + string tempstate = llList2String(IncomingProperties, STATE); + if(tempstate=="TRUE"){ + LightState = TRUE; + }else{ + LightState = FALSE; + } + DebugMessage("Light State: "+(string)LightState); + LightColor = llList2Vector(IncomingProperties, LIGHTCOLOR); + DebugMessage("Light Color: "+(string)LightColor); + WhiteColor = llList2Vector(IncomingProperties, WHITECOLOR); + DebugMessage("White Color: "+(string)WhiteColor); + Intensity = llList2Float(IncomingProperties, INTENSITY); + DebugMessage("Radius: "+(string)Radius); + Radius = llList2Float(IncomingProperties, RADIUS); + DebugMessage("Fall Off: "+(string)FallOff); + FallOff = llList2Float(IncomingProperties, FALLOFF); + DebugMessage("Pole Color: "+(string)PoleColor); + PoleColor = llList2Vector(IncomingProperties, POLECOLOR); + LightSwitch(LightState); +} + +LightSwitch(integer Mode){ + integer i; + if(Mode){ + DebugMessage("Turning Light On..."); + for(i=0;i,<1.0,0.5,0.0>,<1.0,0.0,0.0>]; + list ColorNames = ["Green", "Orange", "Red"]; + list OFFColorVectors = [<0.0,0.5,0.0>,<0.5,0.25,0.0>,<0.5,0.0,0.0>]; + integer PWRLIGHT = 2; + integer CFGLIGHT = 3; + integer INLIGHT = 4; + integer OUTLIGHT = 5; + + // Variables +integer cLine; // Holds Configuration Line Index for Loading Config Loop +key cQueryID; // Holds Current Configuration File Line during Loading Loop +integer lightsOn = FALSE; +string PropertiesString; // Hold Compiled String of Light Properties and Colors +float HoldTimer; // Length of Timer before rerunning Sky Check after a manual light mode change. + // Light Parameters + vector LightColor = <1.0,1.0,0.0>; // Yellow + vector WhiteColor = <1.0,1.0,1.0>; // White + float Intensity = 1.0; + float Radius = 20.0; + float FallOff = 0.5; + + // Light Pole Parameters + vector PoleColor = <1.0,1.0,0.851>; + float Alpha = 0.0; // Alpha Used with Color Parameters + + // Switches +integer DebugMode = FALSE; // Are we running in with Debug Messages ON? + // Flags + +// Configuration Directives +float CheckTimer = 30.0; // Frequency of Sun Angle Check Routine + + // Functions + +Initialize(){ + llSleep(LightHoldLength); + llListenRemove(ComHandle); + llListenRemove(MenuComChannel); + llSleep(0.5); + ComHandle = llListen(ServerComChannel, EMPTY, EMPTY, EMPTY); + MenuComChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); + DebugMessage(llGetObjectName()+" Server Online"); + llOwnerSay("Configuring..."); + cQueryID = llGetNotecardLine(cName, cLine); +} + +LightToggle(integer LinkID, integer ISON, string Color){ + if(ISON){ + vector ColorVector = llList2Vector(ONColorVectors, llListFindList(ColorNames, [Color])); + llSetLinkPrimitiveParamsFast(LinkID, [ + PRIM_COLOR, ALL_SIDES, ColorVector, 1.0, + PRIM_GLOW, ALL_SIDES, GlowOn, + PRIM_FULLBRIGHT, ALL_SIDES, TRUE + ]); + }else{ + vector ColorVector = llList2Vector(OFFColorVectors, llListFindList(ColorNames, [Color])); + llSetLinkPrimitiveParamsFast(LinkID, [ + PRIM_COLOR, ALL_SIDES, ColorVector, 1.0, + PRIM_GLOW, ALL_SIDES, GlowOff, + PRIM_FULLBRIGHT, ALL_SIDES, FALSE + ]); + } +} + +LoadConfig(string data){ + LightToggle(CFGLIGHT, TRUE, "Orange"); + if(data!=""){ // If Line is not Empty + // if the line does not begin with a comment + if(llSubStringIndex(data, "#") != 0) + { + // find first equal sign + integer i = llSubStringIndex(data, "="); + + // if line contains equal sign + if(i != -1){ + // get name of name/value pair + string name = llGetSubString(data, 0, i - 1); + + // get value of name/value pair + string value = llGetSubString(data, i + 1, -1); + + // trim name + list temp = llParseString2List(name, [" "], []); + name = llDumpList2String(temp, " "); + + // make name lowercase + name = llToLower(name); + + // trim value + temp = llParseString2List(value, [" "], []); + value = llDumpList2String(temp, " "); + + // Check Key/Value Pairs and Set Switches and Lists + if(name=="debugmode"){ + if(value=="TRUE" || value=="true"){ + DebugMode = TRUE; + llOwnerSay("Debug Mode: Enabled!"); + }else if(value=="FALSE" || value=="false"){ + DebugMode = FALSE; + llOwnerSay("Debug Mode: Disabled!"); + } + }else if(name=="lightcolor"){ // Set Color of Light during On State + LightColor = (vector)value; + DebugMessage("Light Color: "+(string)LightColor); + }else if(name=="whitecolor"){ + WhiteColor = (vector)value; + DebugMessage("White Color: "+(string)WhiteColor); + }else if(name=="intensity"){ + Intensity = (float)value; + DebugMessage("Light Intensity: "+(string)Intensity); + }else if(name=="radius"){ + Radius = (float)value; + DebugMessage("Light Radius: "+(string)Radius); + }else if(name=="falloff"){ + FallOff = (float)value; + DebugMessage("Light FallOff: "+(string)FallOff); + }else if(name=="polecolor"){ + PoleColor = (vector)value; + DebugMessage("Pole Color: "+(string)PoleColor); + }else if(name=="user"){ + AuthedUsers = AuthedUsers + [value]; + DebugMessage("New Machine Authed User: "+value); + }else if(name=="servercomchannel"){ + ServerComChannel = (integer)value; + DebugMessage("Server Com Channel: "+(string)ServerComChannel); + }else if(name=="checktimer"){ + CheckTimer = (float)value; + DebugMessage("Check Timer: "+(string)CheckTimer); + }else if(name=="holdtimer"){ + HoldTimer = (float)value; + DebugMessage("Hold Timer: "+(string)HoldTimer); + } + LightToggle(CFGLIGHT, FALSE, "Orange"); + }else{ // line does not contain equal sign + llOwnerSay("Configuration could not be read on line " + (string)cLine); + } + } + } +} + +// Check Sun Angle Routine (If Below Horizon, Toggle Lights) +CheckSun() +{ + vector sun = llGetSunDirection(); + integer turnLightsOn = (sun.z < 0); + if(turnLightsOn != lightsOn) + { + DebugMessage("Sun Position Changed..."); + lightsOn = turnLightsOn; + MessageLights(lightsOn); // Send Message to Lights + } +} + +// Check if Light Should be on/off and send appropriate message +MessageLights(integer LightState){ + string StateMessage; + if(LightState==TRUE){ + DebugMessage("SunSet Detected, Messaging Lights..."); + StateMessage = "TRUE"; + }else if(LightState==FALSE){ + DebugMessage("SunRise Detected, Messaging Lights..."); + StateMessage = "FALSE"; + } + string SendString = StateMessage + "||" + PropertiesString; + llRegionSay(ServerComChannel, SendString); + DebugMessage("Sending String: "+SendString+"\rOn Channel: "+(string)ServerComChannel); +} + +DebugMessage(string msg){ + if(DebugMode){ + llOwnerSay(msg); + } +} + +CompileProperties(){ + DebugMessage("Compiling Properties String..."); + list Properties = [LightColor, WhiteColor, Intensity, Radius, FallOff, PoleColor]; + PropertiesString = llDumpList2String(Properties, "||"); + DebugMessage("Properties String:\r"+PropertiesString); +} + +// Main Program +default{ + on_rez(integer params){ + llResetScript(); + } + + state_entry(){ + LightToggle(PWRLIGHT, TRUE, "Red"); + llSleep(LightHoldLength); + LightToggle(INLIGHT, TRUE, "Green"); + llSleep(LightHoldLength); + LightToggle(INLIGHT, FALSE, "Green"); + LightToggle(OUTLIGHT, TRUE, "Green"); + Initialize(); + } + + dataserver(key query_id, string data){ // Config Notecard Read Function Needs to be Finished + if (query_id == cQueryID){ + if (data != EOF){ + LoadConfig(data); // Process Current Line + ++cLine; // Incrment Line Index + cQueryID = llGetNotecardLine(cName, cLine); // Attempt to Read Next Config Line (Re-Calls DataServer Event) + }else{ // IF EOF (End of Config loop, and on Blank File) + LightToggle(CFGLIGHT, TRUE, "Green"); + llSleep(LightHoldLength); + LightToggle(CFGLIGHT, FALSE, "Green"); + CompileProperties(); + // CHECK HERE + llSetTimerEvent(CheckTimer); + } + } + } + + touch(integer num){ + if(num>1){ + return; + } + llSetTimerEvent(HoldTimer); + if(lightsOn){ + DebugMessage("Turning Lights OFF for "+(string)CheckTimer+" Seconds!"); + MessageLights(FALSE); + lightsOn = FALSE; + }else{ + DebugMessage("Turning Lights ON for "+(string)CheckTimer+" Seconds!"); + MessageLights(TRUE); + lightsOn = TRUE; + } + } + + timer(){ + llSetTimerEvent(CheckTimer); + if(DebugMode){ + llOwnerSay("Checking Sun Angle..."); + } + CheckSun(); + } + + changed(integer c){ + if(c & CHANGED_INVENTORY){ + llResetScript(); + } + } +} \ No newline at end of file diff --git a/SwingingDoor/LICENSE.txt b/SwingingDoor/LICENSE.txt new file mode 100644 index 00000000..d6a93266 --- /dev/null +++ b/SwingingDoor/LICENSE.txt @@ -0,0 +1,340 @@ +GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {description} + Copyright (C) {year} {fullname} + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + diff --git a/SwingingDoor/SwingingDoor-v1.1.lsl b/SwingingDoor/SwingingDoor-v1.1.lsl new file mode 100644 index 00000000..a8e1f01a --- /dev/null +++ b/SwingingDoor/SwingingDoor-v1.1.lsl @@ -0,0 +1,127 @@ +// Smooth Swinging Door Script v1.0 by Tech Guy + + +// Configuration +string SwingDirection = ""; // Inward vs Outward +string SwingMessage = "I do not know which way to swing.\nPlease enter either Inward or Outward (Case-Sensitive) into my description, Thanks"; + +// Variables +float MoveTimer = 2.5; +vector test; // Input Vector to Convert to Rotation +rotation rot; // Rotation Amount to Move +integer TotalTouched = 0; // Amount of Times Touched + +// Switches +integer IsOpen = FALSE; + +// Configuration Values Placeholders +float DoorCloseTimeOut = 0; +key nrofnamesoncard; +integer nrofnames; +list names; +list keynameoncard; +string nameoncard; +string storedname; + +Initialize(){ + SwingDirection = llGetObjectDesc(); + if(SwingDirection==""){ + llOwnerSay(SwingMessage); + }else if(SwingDirection=="Inward"){ + test.x = 0; + test.y = 0; + test.z = 0.5 * PI; + }else if(SwingDirection=="Outward"){ + test.x = 0; + test.y = 0; + test.z = -0.5 * PI; + }else{ + llOwnerSay(SwingMessage); + } + llOwnerSay("Startup state reading whitelist notecard"); + nrofnamesoncard = llGetNumberOfNotecardLines("whitelist"); +} + +OpenDoor(){ + rot = llEuler2Rot(test); + llSetKeyframedMotion([rot, 2.5],[KFM_DATA, KFM_ROTATION, KFM_MODE, KFM_FORWARD]); +} + +CloseDoor(){ + rot = llEuler2Rot(test); + llSetKeyframedMotion([rot, 2.5],[KFM_DATA, KFM_ROTATION, KFM_MODE, KFM_REVERSE]); +} + +default{ + + on_rez(integer params){ + llResetScript(); + } + + state_entry(){ + Initialize(); + } + + touch(integer num){ + TotalTouched = TotalTouched + num; + if(TotalTouched>1){ + return; + }else if(llList2String(names, 0)!="" && llListFindList(names, [llDetectedName(0)])==-1){ + llSay(0, "You are not allowed in!"); + }else{ + if(IsOpen){ + llSetTimerEvent(0); + CloseDoor(); + }else{ + OpenDoor(); + llSetTimerEvent(DoorCloseTimeOut); + } + IsOpen = !IsOpen; + } + } + + touch_end(integer num){ + TotalTouched = 0; + } + + timer(){ + llSetTimerEvent(0); + IsOpen = FALSE; + CloseDoor(); + } + + dataserver (key queryid, string data){ + + if (queryid == nrofnamesoncard) + { + nrofnames = (integer) data; + integer i; + for (i=0;i < nrofnames;i++){ + keynameoncard += llGetNotecardLine("whitelist", i); + } + } else + { + integer listlength; + listlength = llGetListLength(keynameoncard); + integer j; + for(j=0;j