Covey Rez Pro Holodeck

From Fire And Ice Grid
Jump to navigation Jump to search

The Covey Rez Pro Holodeck system can be used as a basic Pack and Rez tool; however, it is capable of much more. Full instruction videos are on Manwa Pastorelli's YouTube Channel

Get Your Copy at Covey Stores on the Fire And Ice Grid

LSL scripts also available on Manwa Pastorelli's GitHub

  • Create Rez Sets (scene switching)
  • Control Items individually
  • Full Inbound And Outbound API
  • Relative and Absolute positioning
  • Nested Rez Systems.
  • Built for OpenSim and designed to be left out permanently without lag
  • Multiple owners on a sim without interference
  • Non-Destructive (Uses notecards instead of the description field)
  • No-Copy Items protection


Covey Rez Pro Holodeck - Rez Sets

This system can record and rez sets of items. For example, you might have different sets of furniture for a room. With the Covey Rez Pro system, you can easily and quickly switch between them. Entire regions are possible with the correct opensim.ini settings. You also can rez and de-rez individual items. Additionally, nested rez boxes are possible. For example, you could have one rez box which contains 10 rez boxes. Each one can be rezzed and then automatically moved into place. Then you could rez all the items from it, a set of items or a single item. Please see our Making And Using Rez Sets video for more.

Covey Rez Pro Holodeck - API

There is a full Inbound and outbound A.P.I. which will allow a multitude of other functions such as using it as the rezzing add-on for a vendor. It also allows automated collection and repositioning of sim vehicles without the need to use temp rez as is the usual case now. Everything can be automatic and triggered by other objects in a sim. So, it can act as a full scene switcher / Holodeck.

Relative And Absolute Positioning

There are two rezzing modes; relative (items will move around if the box moves) and absolute (return the items to their original position on the sim). The system supports SIM’s of any size and will allow you to rez all the way up to 10 km high. Underground movement is possible as well if your Open Sim server settings allow it. Breaking rez sets by moving them outside the boundaries of a sim is not possible with the Covey Rez Pro Holodeck.

Covey Rez Pro Holodeck - Designed For Opensim

Low Lag Design

Covey Rez Pro Holodeck's design is specific to opensim. It makes use of OSSL to reduce the burden on regions. Usually, rez systems run a timer to detect movement of the rez box. So does this system, but it can be turned off. The memory requirements are absolutely minimum; meaning there should be no adverse effect on your regions. Listeners only get activated when required.

Script Reset Protection

In opensimulator turning scripts off in the estate tools will cause a script reset when they are enabled again. However, in Second Life this does not happen. Most rez systems in opensim originate from Second Life. The Covey Rez Pro will not lose position data or settings after a script reset.

Multiple Rez systems at one time.

The Covey Rez Pro Holodeck supports multiple systems on one sim. They can have the same or different owners. The only restriction is that only one item per avatar may record at one time. The system ensures this is the case for you.

Convenient recording modes

Convenient recording modes allow you to automatically pick items up if your Open Sim grid allows it. Or if it doesn’t there is a manual mode as well which supports testing items to see which ones you have recorded.

Non Destructive (Uses note cards instead of the description field)

The system is NON-DESTRUCTIVE for your items. Many items use the object description field for their own purposes. Most rez systems either store item positions in the description field or in script memory. The description field method will break items that already use it. The Covey Rez Pro Holodeck writes to notecards instead; avoiding the issue entirely.

No-Copy item protection

Like all rez systems packing and rezzing no-copy items can easily end up with you permanently losing the item. Covey Rez system pro protects you against this by detecting it and refusing to record the item. Of course, you get notified. When you are packing items you also have protection against dropping a script into the same item twice. Should you do this, the duplicate script will be detected and removed.

Video Tutorials

Script On Github

LSL And OSSL Script Library On GitHub

Licence

 1 BSD 3-Clause License
 2 Copyright (c) 2020, Sara Payne
 3 All rights reserved.
 4 Redistribution and use in source and binary forms, with or without
 5 modification, are permitted provided that the following conditions are met:
 6 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
 7 2. Redistributions in binary form must reproduce the above copyright notice,
 8    this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
 9 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
11 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
13 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
14 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
15 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
16 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
17 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
18 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
19 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Control Script

   1 /*
   2 Covey Rez Pro System - Control Script  
   3 =====================================
   4 --------------------------------------------------------------------------
   5 Do not adjust settings below this line unless you know what you are doing!
   6 --------------------------------------------------------------------------
   7 */  
   8  
   9 //coms system
  10 integer itemsComsChannel = -83654730; 
  11 integer rezBoxComsChannel = -83654729;
  12 integer rezBoxComsChannelListen;
  13 integer rezBoxChannel = -234576914; //stores the rez box to rez box coms
  14 integer rezBoxChannelListen; // used to turn the listener on and off
  15 integer mainMenuChannel; //global integer for menu channel 
  16 integer mainMenuChannelListen;//clobal control integer for turning menu listen on and off
  17 integer dynamicMenuChannel; //global integer for dynamic menu channel
  18 integer dynamicMenuChannelListen;//clobal control integer for turning menu listen on and off
  19 integer textBoxChannel; //global integer for dynamic menu channel
  20 integer textBoxChannelListen;//lobal control integer for turning menu listen on and off
  21 integer apiRegionChannelIn;//global integer for the api channel inbound
  22 integer apiRegionChannelOut;//global integer for the api channel out;
  23 integer apiRegionChannelListen; //global control for the api listener. 
  24 integer allowPosRecording;//true means box talks to position requests, false it does not.
  25 
  26 //instuction processing
  27 string confirmationMenuType; //used to tell the method what we are confirming
  28 string rezDerezMode; //string which tells the method to rez or derez specified item
  29 integer chatFeedback = TRUE; //used to decide if feedback is given in local chat
  30 integer displayHoverText = FALSE; // used to decide if hover text information is displayed
  31 integer apiLinkedMessage; //on/off control for the linked message api inbound and outbound
  32 integer apiRegionSay; //on/off status for the listener and output in regionsay
  33 integer recallMenu; // set to true when instruction from menu set, fals when its from the api, if true the menu gets called after
  34 integer relativePos = FALSE; // if true items rez and move relative to the rez box, if false rez in original sim position and rotation
  35 vector currentPos; //stores the current position of the rez box
  36 rotation currentRot; //stores the current rotation of the rez box
  37 integer rezBoxSetNo; //stores the set number for items rezzed by the box, avoids cross talk with multiple rez box's
  38 integer itemsRezzed = FALSE; //True means the box has items rezzed, false means nothing is rezzed from this box
  39 integer rexBoxPhantom; //used to define and control the phantom status
  40 integer rexBoxAlpha; //used to define and control the alpha status
  41 string textBoxMessageType;//used to set the type of message being processed by the text box. 
  42 integer autoPickup = FALSE; // defines if auto pickup is on or off, gets passed to the items script
  43 integer underGroundMovement = FALSE; // defines if the system will try and move items under ground. Enable this only in sims which allow underground movement. 
  44 list itemPositions; //used as a temp store to calc the average angle between the rez box and the items rezzed
  45 integer dialogMenu = TRUE; //use to control if dialogmenus are active
  46 integer timerCount; //used to turn off the relative mode timer
  47   
  48 //dynamic menu for individual rezzing of items
  49 list dynamicMenuButtonNumbers;//dynamic menu button nynbers generated from the nanes list;
  50 list reservedButtons = ["Back", "MainMenu", "Next"]; // permanant buttons on the dynamic menu
  51 list tempMenuButtons; //used to store temp menu entries.This is the list which gets displayed in the dialog statement.
  52 integer menuLength; //used to store the length of the menu being worked on
  53 integer currentPageNumber; //used to store the current page number
  54 integer numOfPages; //used to store the total number of pages in this menu
  55 integer dynamicButtonsPerPage; //the number of spaces left after the reserved buttons
  56 integer reservedButtonsPerPage; //number of reserved buttoons per page
  57 string pageMessage; //used to set the page message in the dynamic menu
  58 integer inventoryType; //sets the inventory type for use in text box and dynamic menu responses
  59 
  60 integer ChkIsVec (string inputString)
  61 {   //returns a true bool if the supplied string can be typecasted to a vector successfully 
  62     integer isVec;
  63     vector chkVec = (vector)inputString;
  64     string startProcess = llStringTrim ((inputString), STRING_TRIM);
  65     integer startIndex = (llSubStringIndex(startProcess, "<")+1);
  66     integer endIndex = (llSubStringIndex(startProcess, ">")-1);
  67     startProcess = llGetSubString(startProcess, startIndex, endIndex); 
  68     list stringParts = llCSV2List(startProcess); 
  69     string strX =  llStringTrim( (llList2String(stringParts,0)), STRING_TRIM); 
  70     string strY =  llStringTrim( (llList2String(stringParts,1)), STRING_TRIM); 
  71     string strZ =  llStringTrim( (llList2String(stringParts,2)), STRING_TRIM); 
  72     float fltX = (float) strX;
  73     float fltY = (float) strY;
  74     float fltZ = (float) strZ;
  75     vector reformedVec = <fltX, fltY, fltZ>;
  76     if (inputString == "") isVec  = FALSE;
  77     else if ((chkVec - reformedVec) == <0,0,0>) isVec = TRUE;
  78     else isVec  = FALSE;
  79     return isVec;
  80 }//close check is vector
  81 
  82 integer CheckMoveLimits(vector targetPos)
  83 {// check the ground height where the item is to be rezzed and make sure its not under ground. Then check its not trying to move off sim or above the cieling height for rezzing. 
  84     integer moveIsValid;
  85     float GroundHeight = llGround(targetPos-llGetPos() ); //get ground height where item is to be moved to
  86     vector simSizeVec = osGetRegionSize(); //gets the region size as sa vector
  87     integer simSize = (integer)simSizeVec.x;    //converts vec to int
  88     if ((GroundHeight < targetPos.z) &&  (targetPos.z < 10000) && (targetPos.y < simSize) && (targetPos.x < simSize)) moveIsValid = TRUE; // if inside sim limits set move is valid to true
  89     else moveIsValid = FALSE; //set move is valid to false
  90     return moveIsValid;
  91 }//close check rez limits
  92 
  93 integer contains(string haystack, string needle) 
  94 {   //returns true if a needle is found inside the heystack 
  95     return ~llSubStringIndex(haystack, needle); //returns integer
  96 }// close contains
  97 
  98 SetUpListeners()
  99 {//sets the coms channel and the random menu channel then turns the listeners on.
 100     mainMenuChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); //generates random main menu channel
 101     mainMenuChannelListen = llListen(mainMenuChannel, "", NULL_KEY, "");//sets up main menu listen integer
 102     rezBoxChannelListen = llListen(rezBoxComsChannel, "", NULL_KEY, "");//sets up coms channel listen integer
 103     dynamicMenuChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); //generates random dynamic menu channel
 104     dynamicMenuChannelListen = llListen(dynamicMenuChannel, "", NULL_KEY, "");//sets up dynamic menu listen integer
 105     textBoxChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); //generates random dynamic menu channel
 106     textBoxChannelListen = llListen(textBoxChannel, "", NULL_KEY, "");//sets up dynamic menu listen integer
 107     rezBoxChannelListen = llListen(rezBoxChannel, "", NULL_KEY, "");
 108     rezBoxComsChannelListen = llListen(rezBoxComsChannel, "", NULL_KEY, "");
 109     llListenControl (mainMenuChannelListen, TRUE); //turns on listeners for main menu channel
 110     llListenControl (dynamicMenuChannelListen, FALSE); //turns off listeners for dynamic menu channel
 111     llListenControl (textBoxChannelListen, FALSE); //turns off listeners for dynamic menu channel
 112     llListenControl (rezBoxChannelListen, TRUE); // turns on listeners for the rezbox channel 
 113     llListenControl (rezBoxComsChannelListen, TRUE);
 114     SetupApiListeners();
 115 }//close set up listeners
 116 
 117 SetupApiListeners()
 118 {   //sets up the api listeners
 119     apiRegionChannelIn = rezBoxSetNo;
 120     apiRegionChannelOut = rezBoxSetNo *-1;
 121     apiRegionChannelListen = llListen(apiRegionChannelIn, "", NULL_KEY, "");//sets up coms channel listen integer
 122     if (apiRegionSay) llListenControl (apiRegionChannelListen, TRUE); // turns on listeners for the rezbox channel 
 123     else llListenControl (apiRegionChannelListen, FALSE); // turns off listeners for the rezbox channel 
 124 }//close set up api listeners
 125 
 126 string GenUpdatePosDataString()
 127 {   //makes the string sent to items for positons
 128     string data = (string)currentPos + "," +  (string)currentRot + "," + (string)relativePos + "," + (string)autoPickup + "," + (string)underGroundMovement;
 129     return data; 
 130 }//close gen position data string
 131 
 132 MessageItems(string which, string instruction, string data, key UUID)
 133 {   //sends a message to all items or a single item depending on the "which" string
 134     string toSend = (string)rezBoxSetNo + "," + instruction + ":" + data;
 135     if (which == "All") llRegionSay(itemsComsChannel, toSend); //send message to all items
 136     else if (which == "SingleItem") llRegionSayTo(UUID, itemsComsChannel, toSend); //send message to specific item
 137 }//closwe message items
 138 
 139 MessageRezBoxs(string instruction, string data)
 140 {   //sends messages to other rez boxs on the sim
 141     string toSend = instruction + "," + data;
 142     llRegionSay(rezBoxChannel, toSend);
 143 }//close message rez box's
 144  
 145 MessageFeedback(string instruction, string data)
 146 {   //sends feedback through the api and local chat if enabled. 
 147     string toSend = instruction + "," + data;
 148     if (apiLinkedMessage) llMessageLinked(LINK_ALL_OTHERS, (apiRegionChannelOut), toSend, "" );
 149     if (apiRegionSay) llRegionSay((apiRegionChannelOut), toSend);
 150     if (chatFeedback) llOwnerSay(instruction + ": " + data);
 151 } //close send feedback. 
 152 
 153 MessageRezScript (string message, string message2)
 154 {   //sends a linked message to the rez script
 155     integer num = 10000;
 156     llMessageLinked(LINK_THIS, num, message, message2);
 157 }//close send linked message to rez script
 158 
 159 MainDialogMenu()
 160 { //displays the main menu and turns off unrequired listeners and clears un-needed lists if present.
 161     list MainMenuList = ["Rez/DeRez", "Finalise", "RezMode", "PosRecMenu", "InfoDisplay", "ApiControls", "ReTexure", "Done"]; //main menu items list
 162     llListenControl (dynamicMenuChannelListen, FALSE); //turns off listeners for dynamic menu channel
 163     llListenControl (textBoxChannelListen, FALSE); //turns on listeners for dynamic menu channel
 164     string pageMessage = "";
 165     dynamicMenuButtonNumbers = []; //clears the dynamic numbers list
 166     llDialog(llGetOwner(), "Please Make your selection", MainMenuList , mainMenuChannel);  
 167 }//close display main menu
 168 
 169 ApiDialogMenu()
 170 {   //displays the api menu
 171     string line0 = "Please Choose From The Following: \n\n";
 172     string line1 =  "RegionOn = Turn on the API listener and RegionSay messages \n" + 
 173                     "RegionOff = Turn off the API listener and RegionSay messages \n" + 
 174                     "LinkedOn = Turns on processing and sending of API Linked Messages \n" +
 175                     "LinkedOff = Turns off the processing and sending of API linked messages \n" + 
 176                     "ShowBoxNum = Shows the rez box number in local chat"; 
 177     string menuMessage = line0 + line1;
 178     list apiMenuList = ["RegionOn", "RegionOff", "LinkedOn", "LinkedOff", "ShowBoxNum", "MainMenu"];
 179     llDialog(llGetOwner(), menuMessage, apiMenuList, mainMenuChannel);
 180 }//close display api menu
 181 
 182 SingleItemsDialogMenu() 
 183 { //displays the single items dialog menu
 184     string line0 = "Please Choose From The Following: \n\n";
 185     string line1 =  "RezItemList = choose item to rez using the menu" + " \n" + 
 186                     "DelItemList = choose item to de-rez from menu" + " \n" + 
 187                     "RezName = Type in the name of the item to rez" + " \n" +
 188                     "DelName = Type in the name of the item to de-rez" + " \n" + 
 189                     "ListItems = See box contents in local chat";
 190     string menuMessage = line0+line1;
 191     list SingleItemsMenuList = ["RezItemList", "DelItemList", "RezName", "DelName", "ListItems", "MainMenu"];
 192     llDialog(llGetOwner(), menuMessage, SingleItemsMenuList , mainMenuChannel);  
 193 }///close single items dialog menu
 194 
 195 RezSetsDialogMenu()
 196 {   //displays the rez sets menu to the user
 197     string line0 = "Please Choose From The Following: \n\n";
 198     string line1 =  "RezSetList = choose rez set to rez from menu" + " \n" + 
 199                     "DelSetList = choose res set to de-rez from menu" + " \n" + 
 200                     "RezSetName = Type in the name of the rez set to rez" + " \n" +
 201                     "DelSetName = Type in the name of the rez set to de-rez" + " \n" + 
 202                     "MakeRezSet = Make a rez set from inventory" + " \n" +
 203                     "ListSets = See rez sets in local chat";
 204     string menuMessage = line0+line1;
 205     list rezSetMenuList = ["RezSetList", "DelSetList", "RezSetName", "DelSetName", "MakeRezSet", "ListSets", "MainMenu"];
 206     llDialog(llGetOwner(), menuMessage, rezSetMenuList , mainMenuChannel);  
 207 }//close rez sets menu
 208 
 209 RezDeRezMenuDialog()
 210 {   //displays the rez/derez menu to the user 
 211     string line0 = "Please Choose From The Following: \n\n";
 212     string line1 =  "RezAll = Rez All Items" + " \n" + 
 213                     "DeRezAll = De-Rez All Items" +  " \n" + 
 214                     "RezSets = Rez Sets Menu" + " \n" +
 215                     "SingleItems = Single Items Menu" + "\n" + 
 216                     "ForceUpdate = Force items to update their positions" + "\n" + 
 217                     "SlowRezAll = Rez all items slowly";
 218     string menuMessage = line0 + line1;
 219     list rezDerezMenuList = ["RezAll", "DeRezAll", "RezSets", "SingleItems", "ForceUpdate", "SlowRezAll", "MainMenu"];
 220     llDialog(llGetOwner(), menuMessage, rezDerezMenuList, mainMenuChannel);
 221 }//close rez/derez menu
 222 
 223 RezModeDialogMenu() 
 224 {//call res mode menu
 225     string line0 = "Please Choose From The Following: \n\n";
 226     string line1 =  "Absolute = Return items to their original location" + "\n" + 
 227                     "Relative = Move items in relation to the rez box position" + " \n" +
 228                     "AutoPickup = Put items into your inventory automatically" + " \n" + 
 229                     "ManPickup = Pick up items yourself after recording" + " \n" + 
 230                     "UndrGrndOn = Allow items to be placed under ground" + " \n" + 
 231                     "UndrGrndOff = Do not allow items to be placed underground" + " \n" + 
 232                     "TestRecOn = Test recorded status on" + " \n" + 
 233                     "TestRecOff = Test recorded status off" ;
 234     string menuMessage = line0 + line1;
 235     list RezModeList = ["Absolute", "Relative", "AutoPickup", "ManPickup", "UndrGrndOn", "UndrGrndOff", "TestRecOn", "TestRecOff", "MainMenu"]; //Rez mode items list. 
 236     llDialog (llGetOwner(), menuMessage, RezModeList, mainMenuChannel); 
 237 }//close call rez mode menu
 238 
 239 PosRecordDialogMenu()
 240 {//call pos record menu
 241     string line0 = "Please Choose From The Following: \n\n";
 242     string line1 =  "RecOn = Turn on recording" + " \n" + 
 243                     "RecOff =Turn off recording" + " \n" + 
 244                     "AllowRePos = Prepares RezBox to change start position" + " \n" +
 245                     "SetRecPos = Sets the current position as start point" + "\n" +
 246                     "SetBoxPos = Sets the box to a given position on the sim" + " \n" + 
 247                     "SetBoxRot = Sets the rotation of the box on the sim" + " \n" +
 248                     "PrepReRecrd = Prepares itemns so you can record by manually resetting the scripts" + " \n" + 
 249                     "ReRecAll = Re Record the items rezzed" + " \n" + 
 250                     "PrepBoxExch = Configures rezzed items to pickup and drop into a fresh rez box";              
 251     list PositionRecordingMenu = ["RecOn", "RecOff", "AllowRePos", "SetRecPos", "SetBoxPos", "SetBoxRot", "PrepReRecrd", "ReRecAll", "PrepBoxExch", "MainMenu"]; //list of recording menu buttons
 252     string RePositionAllowed;
 253     string menuMessage = line0 + line1;
 254     llDialog (llGetOwner(), menuMessage, PositionRecordingMenu, mainMenuChannel);
 255 }//close call position record menu
 256 
 257 InfoDisplayDialogMenu()
 258 {   //displays the info displaymenu
 259     string line0 = "Please Choose From The Following: \n\n";
 260     string line1 =  "ChatOn = Turns on feedback in local chat" + " \n" + 
 261                     "ChatOff = Turns off feed back in local chat" + " \n" + 
 262                     "TextSetting = Displays Settings in HoverText" + " \n" + 
 263                     "TextContent = Displays Contents in HoverText" + " \n" + 
 264                     "TextOff = Turns off hover text information" + "\n" + 
 265                     "AplhaOn =  Makes the rez box invisible" + " \n" + 
 266                     "AlphaOff = Makes the rez box visible" + " \n" + 
 267                     "PhantomOn = Make the rez box phantom" + " \n" + 
 268                     "PhantomOff = Make the rez box solid";    
 269     list infoDisplayMenu = ["ChatOn", "ChatOff", "TextSetting", "TextOff", "TextContent", "AplhaOn", "AlphaOff", "PhantomOn", "PhantomOff", "MainMenu"]; //defines the button list
 270     string menuMessage = line0 + line1;
 271     llDialog (llGetOwner(), menuMessage, infoDisplayMenu, mainMenuChannel);
 272 }//close display infoDisplayMenu 
 273 
 274 ConfirmationDialogueMenu()
 275 { //displays yes no confirmation dialog menu
 276     list confirmationMenu = ["Yes", "No"]; //defines the button list
 277     string dialogMessage; //defines the message string
 278     if (confirmationMenuType == "DelBoxInventoryObjects") dialogMessage = "Would you like to automatically remove items currently in the rez box?"; 
 279     else if (confirmationMenuType == "AutoFixBoxRotationForRecording" )  dialogMessage = "Rez box mustbe rotated to <0,0,0> for recroding.  \n Currently it is not. \n\n Would you like the p     position setting automatically for you? \n\n Please note this will also de-rez any rezzed item you have";
 280     llDialog (llGetOwner(), dialogMessage, confirmationMenu, mainMenuChannel); //sends menu to the user
 281 }//close display confirmation dialog menu
 282 
 283 TextBoxMenu (string instuctionType, string message)
 284 {   //displays the text box dialog to the user
 285     llListenControl (textBoxChannelListen, TRUE);
 286     textBoxMessageType = instuctionType;
 287     llTextBox(llGetOwner(), message, textBoxChannel );
 288 }//close text box dialog menu
 289 
 290 ProcessItemMessage(key listenRecievedKey, string listenRecievedMessage)
 291 {//break down the message into a list and proccess then send response to item
 292     list itemsInstructions = llCSV2List(listenRecievedMessage); //turn the recieved message into a list from comma seperated values
 293     string recievedInstruction = llList2String(itemsInstructions, 0); //define the recieved instruction from list
 294     if ((recievedInstruction == "OrigRezBoxPositionRequest") && allowPosRecording)
 295     { // do this if the instruction from the item is an original position request and we have recording turned on.      
 296         if (llGetRot() != <0.00000, 0.00000, 0.00000, 1.00000>)  
 297         {   //come here if the roation of the box is not a zero vector
 298             confirmationMenuType = "AutoFixBoxRotationForRecording"; //set the confirmation type
 299             ConfirmationDialogueMenu(); //send confirmation to user
 300         } //close if rotation is wrong
 301         //if the box is not rotated correctly ask if they would like it autofixing
 302         else
 303         {   //come here if the box is rotated corrrectly
 304             RecordCurrentPosRot(); // set the current pos
 305             string data = GenUpdatePosDataString();
 306             MessageItems("SingleItem", "RezBoxData", data, listenRecievedKey);
 307             //send string RezBoxData , current position rotation and rez box set number back to item as comma seperated values             
 308         }// close else box is rotated correctly
 309     }//close if original position request   
 310     else if (recievedInstruction == "RezedFromBox" )
 311     {//do this is the instruction says item was just rezzed from a rez box
 312         integer RecievedBoxNumber = (integer)llList2Integer(itemsInstructions, 1);//record the box number the item says it belongs to
 313         if (RecievedBoxNumber == rezBoxSetNo) //check the number is the same as this box number
 314         {//get current position and rotation then send back to item with instuction rez at the start
 315             RecordCurrentPosRot(); 
 316             string data = GenUpdatePosDataString();
 317             MessageItems("SingleItem", "Rez", data, listenRecievedKey);
 318             // send rez instruction back to the item along with the box number, position and rotation as well as Rez Mode as comma seperated values. 
 319         }//close box number check
 320     }//close if rezzed from box instruction
 321     else if (recievedInstruction == "ItemPosition")
 322     {   //come here if item is reporting its position for arror positioning
 323         vector toAdd = llList2Vector (itemsInstructions, 1);
 324         itemPositions += toAdd;
 325     }//close if instruction is item positions
 326 }//close process item message
 327 
 328 ProcessRezBoxMessage(key id, string listenRecievedMessage)
 329 {//process messages from other rez box's
 330     list itemsInstructions = llCSV2List(listenRecievedMessage); //turn the recieved message into a list from comma seperated values
 331     string recievedInstruction = llList2String(itemsInstructions, 0); //define the recieved instruction from list
 332     string data = llList2String(itemsInstructions, 1);
 333     if (recievedInstruction == "Recording" && data =="On") 
 334     {   //come here if another box sends a recording on signal
 335         if (allowPosRecording)
 336         {   //if recording is currently on come here
 337             if (chatFeedback) llOwnerSay("Another rez box you own has turned on recording, disabling recording on this box"); //send upate to user if chatFeedback enabled
 338             Recording("Off"); //turns off recording in this box
 339         }//close if recording was enabled
 340     } //close if instruction is turn off recording
 341 }//close process box message
 342 
 343 ProcessMainMenuResponse(key id, string listenRecievedMessage)
 344 {// process menu responses and act accordingly. 
 345     recallMenu = TRUE;
 346     //Itens From all or multiple menus
 347     if (listenRecievedMessage == "MainMenu") MainDialogMenu();
 348     else if (listenRecievedMessage == "Yes") ProcessYesComfirmation();
 349     else if (listenRecievedMessage == "No") ProcessNoConfirmation();
 350     //Main Menu
 351     else if (listenRecievedMessage == "Rez/DeRez") RezDeRezMenuDialog();
 352     else if (listenRecievedMessage == "PosRecMenu") PosRecordDialogMenu();
 353     else if (listenRecievedMessage == "InfoDisplay") InfoDisplayDialogMenu();
 354     else if (listenRecievedMessage == "Finalise") FinaliseItems();
 355     else if (listenRecievedMessage == "ApiControls") ApiDialogMenu();
 356     else if (listenRecievedMessage == "RezMode") RezModeDialogMenu();
 357     else if (listenRecievedMessage == "ReTexure") ApplyShapeTexture(0); 
 358     //Rez / DeRez Menu
 359     else if (listenRecievedMessage == "RezAll") RezItems();
 360     else if (listenRecievedMessage == "DeRezAll") DeRezItems();
 361     else if (listenRecievedMessage == "RezSets") RezSetsDialogMenu();
 362     else if (listenRecievedMessage == "SingleItems") SingleItemsDialogMenu();
 363     else if (listenRecievedMessage == "ForceUpdate") ForceUpdateItemPositons();
 364     else if (listenRecievedMessage == "SlowRezAll") SlowRezAll();
 365     //Positioning Menu
 366     else if (listenRecievedMessage == "Absolute") PositioningMode("Absolute");
 367     else if (listenRecievedMessage == "Relative") PositioningMode("Relative");
 368     else if (listenRecievedMessage == "AutoPickup") ItemPickup("Auto");
 369     else if (listenRecievedMessage == "ManPickup") ItemPickup("Manual");
 370     else if (listenRecievedMessage == "UndrGrndOn") UnderGroundMovement ("On");
 371     else if (listenRecievedMessage == "UndrGrndOff") UnderGroundMovement ("Off");
 372     else if (listenRecievedMessage == "TestRecOn") TestRecordedItems("On");
 373     else if (listenRecievedMessage == "TestRecOff") TestRecordedItems("Off"); 
 374     //Record Mode Menu
 375     else if (listenRecievedMessage == "RecOn") ChkBoxPosForRecording();
 376     else if (listenRecievedMessage == "RecOff") Recording("Off");
 377     else if (listenRecievedMessage == "AllowRePos") AllowBoxReposition();
 378     else if (listenRecievedMessage == "SetRecPos") RecordCurrentPosRot();
 379     else if (listenRecievedMessage == "SetBoxPos") SetBoxPosRotFromMenu("Position");
 380     else if (listenRecievedMessage == "SetBoxRot") SetBoxPosRotFromMenu("Rotation");
 381     else if (listenRecievedMessage == "ReRecAll") ReRecordAllItems();
 382     else if (listenRecievedMessage == "PrepReRecrd") PrepReRecord();
 383     else if (listenRecievedMessage == "PrepBoxExch") PrepItemBoxExchange();
 384     //Info Display Menu
 385     else if (listenRecievedMessage == "ChatOn") ChatFeedBack("On");
 386     else if (listenRecievedMessage == "ChatOff") ChatFeedBack("Off");
 387     else if (listenRecievedMessage == "TextSetting") HoverTextInfo("Settings");
 388     else if (listenRecievedMessage == "TextContent") HoverTextInfo("Contents");
 389     else if (listenRecievedMessage == "TextOff") HoverTextInfo("Off");
 390     else if (listenRecievedMessage == "AplhaOn") RezBoxAlpha("On");
 391     else if (listenRecievedMessage == "AlphaOff") RezBoxAlpha("Off");
 392     else if (listenRecievedMessage == "PhantomOn") RexBoxPhantom("On");
 393     else if (listenRecievedMessage == "PhantomOff") RexBoxPhantom("Off"); 
 394     //Api Controls Menu
 395     else if (listenRecievedMessage == "RegionOn") ApiRegionSay("On");
 396     else if (listenRecievedMessage == "RegionOff") ApiRegionSay("Off");
 397     else if (listenRecievedMessage == "LinkedOn") ApiLinkedMessage("On");
 398     else if (listenRecievedMessage == "LinkedOff") ApiLinkedMessage("Off");
 399     else if (listenRecievedMessage == "ShowBoxNum") DisplayBoxNumber();
 400     //Single Items Menu
 401     else if (listenRecievedMessage == "RezItemList") RemoveRezListItems("RezItems", INVENTORY_OBJECT);
 402     else if (listenRecievedMessage == "DelItemList") RemoveRezListItems("RemItems", INVENTORY_OBJECT);
 403     else if (listenRecievedMessage == "RezName") RemoveRezByName("RezItems", INVENTORY_OBJECT);
 404     else if (listenRecievedMessage == "DelName") RemoveRezByName("RemItems", INVENTORY_OBJECT);
 405     else if (listenRecievedMessage == "ListItems") RezBoxListToChat(INVENTORY_OBJECT);
 406     //RezSets Menu
 407     else if (listenRecievedMessage == "RezSetList") RemoveRezListItems("RezItems", INVENTORY_NOTECARD);
 408     else if (listenRecievedMessage == "DelSetList") RemoveRezListItems("RemItems", INVENTORY_NOTECARD);
 409     else if (listenRecievedMessage == "RezSetName") RemoveRezByName("RezItems", INVENTORY_NOTECARD);
 410     else if (listenRecievedMessage == "DelSetName") RemoveRezByName("RemItems", INVENTORY_NOTECARD);
 411     else if (listenRecievedMessage == "MakeRezSet") MakeRexSetNane();
 412     else if (listenRecievedMessage == "ListSets") RezBoxListToChat(INVENTORY_NOTECARD);   
 413 }//close process menu responses
 414 
 415 ProcessTextBoxResponse(key id, string message)
 416 {   //processews the response from the text box and actions accordingly
 417     recallMenu = TRUE;
 418     if (textBoxMessageType == "RemRezItems")
 419     {   //come here if the text box message type is Remove or Rez items
 420         //GenDynamicButtonsNamesList(inventoryType);
 421         if(llGetInventoryType(message) == inventoryType )
 422         {   //come her if the name given exists in the rez box
 423             string itemToAction = message;
 424             if (inventoryType == INVENTORY_OBJECT)
 425             {
 426                 RezDeRezIndividualItem(itemToAction);
 427                 itemsRezzed = TRUE;
 428                 if (recallMenu) MainDialogMenu(); 
 429             }
 430             else if (inventoryType == INVENTORY_NOTECARD)
 431             {
 432                 RezDeRezSet(message);
 433             }    
 434         }// close if the item exists in the rez box
 435         else 
 436         {   //named item doesn't existn send error message and go back to the single items menu
 437             if (chatFeedback) llOwnerSay("Sorry that name does not exist, please try again");
 438             if (recallMenu) SingleItemsDialogMenu();
 439         }// close if item doesn't exist
 440     }//close if text box message type is rem/rez items
 441     else if (textBoxMessageType == "NewRezSetName") MakeRezSet(message);
 442     else if (textBoxMessageType == "BoxPosition" ) RezBoxPos(message);
 443     else if (textBoxMessageType == "BoxRotation") RezBoxRot(message);     
 444 }//close process text box response
 445 
 446 ProcessNoConfirmation()
 447 {   //processes no responses to the confirmation menu
 448     if (confirmationMenuType == "AutoFixBoxRotationForRecording")
 449     {   //come here fi the menu was called due to auto fix rotation request
 450         string message  = "Recording not enabled, pleased manually fix the position and try again";
 451         list buttons = ["Ok"];
 452         if (chatFeedback) llOwnerSay (message);
 453         Recording("Off");
 454         llDialog (llGetOwner(), message, buttons, mainMenuChannel);//send an ok dialog to provide a warning
 455     }//close if confirmation type is auto fix recording
 456     else MainDialogMenu(); //otherwise send the main menu dialog
 457 }//close process no confirmation
 458 
 459 ProcessYesComfirmation()
 460 {//pprocess yes confirmation from dialog menu
 461 if (confirmationMenuType == "DelBoxInventoryObjects")DelInventoryObjects();
 462 if (confirmationMenuType == "AutoFixBoxRotationForRecording") 
 463     {   //come here if confirmation type is fix rotation for recording
 464         if (itemsRezzed) DeRezItems();
 465         vector vecRotDeg = llRot2Euler(llGetRot())*RAD_TO_DEG;
 466         if (chatFeedback) llOwnerSay("Box rotation before fix was: " + (string)vecRotDeg);
 467         SetBoxRotationForRecording();
 468         Recording("On");
 469     } //close if convermation type is auto fix recording
 470 }//close process yes confirmation
 471 
 472 ProcessApiMessage(string message)
 473 {   //process the api message and acts on the instruction
 474     // string arrives in the format Level0Command,Level1Command
 475     list instructions = llCSV2List(message);
 476     string instruction = llList2String(instructions,0);
 477     string data = llList2String(instructions,1);
 478     recallMenu = FALSE; 
 479     if (instruction == "RezItems") RezItems();
 480     else if (instruction == "DeRezItems") DeRezItems();
 481     else if (instruction == "FinaliseItems") FinaliseItems();
 482     else if (instruction == "PositioningMode") PositioningMode(data);
 483     else if (instruction == "Recording")
 484     {
 485         if (data == "On") ChkBoxPosForRecording();
 486         else if (data == "Off") Recording(data);
 487     }
 488     else if (instruction == "BoxRePos") AllowBoxReposition();
 489     else if (instruction == "SetBoxPos") RecordCurrentPosRot();
 490     else if (instruction == "ReRecordAllItems") ReRecordAllItems();
 491     else if (instruction == "RezSingleItem")
 492     {
 493         rezDerezMode = "RezItems";
 494         RezDeRezIndividualItem(data);
 495     }
 496     else if (instruction == "DeRezIndividualItem")
 497     {
 498         rezDerezMode = "RemItems";
 499         RezDeRezIndividualItem(data);
 500     }
 501     else if (instruction == "RezRezSet") 
 502     {
 503         rezDerezMode = "RezItems";
 504         RezDeRezSet(data);
 505     }
 506     else if (instruction == "DeRezRezSet")
 507     {
 508         rezDerezMode = "RemItems";
 509         RezDeRezSet(data);
 510     }
 511     else if (instruction == "HoverTextInfo") HoverTextInfo(data);
 512     else if (instruction == "ChatFeedback") ChatFeedBack(data);
 513     else if (instruction == "ApiRegionSay") ApiRegionSay(data);
 514     else if (instruction == "ApiLinkedMessage") ApiLinkedMessage(data);
 515     else if (instruction == "RezBoxRot") RezBoxRot(data);
 516     else if (instruction == "RezBoxPos") RezBoxPos(data);
 517     else if (instruction == "DisplayBoxNumber") DisplayBoxNumber();
 518     else if (instruction == "RexBoxPhantom") RexBoxPhantom(data);
 519     else if (instruction == "RezBoxAlpha") RezBoxAlpha(data);
 520     else if (instruction == "AllowBoxReposition") AllowBoxReposition;
 521     else if (instruction == "ItemPickup") ItemPickup(data);
 522     else if (instruction == "UnderGroundMovement") UnderGroundMovement (data);
 523     else if (instruction == "PrepItemBoxExchange") PrepItemBoxExchange();
 524     else if (instruction == "MakeRezSet") MakeRezSet(data);
 525     else if (instruction == "ReRecordAllItems") ReRecordAllItems();
 526     else if (instruction == "PrepReRecord") PrepReRecord();
 527     else if (instruction == "UnderGroundMovement") UnderGroundMovement(data);
 528     else if (instruction == "ItemPickup") ItemPickup(data);
 529     else if (instruction == "MakeRezSet") MakeRezSet(data); 
 530     else if (instruction == "DialogMenuStatus" ) DialogMenuStatus(data);
 531     else if (instruction == "ForceUpdateItemPositons") ForceUpdateItemPositons();
 532 }//close process api message
 533     
 534 ProcessDynamicMenuResponse(key id, string message)
 535 { // processes responses to the listen event
 536     if (message == llList2String(reservedButtons, 0))
 537     {
 538         -- currentPageNumber; // button in this example is back so subtract 1 from the page number 
 539         DialogueMenu(dynamicMenuButtonNumbers); //call the menu again
 540     }
 541     else if (message == llList2String(reservedButtons, 1)) MainDialogMenu();
 542     else if (message == llList2String(reservedButtons, 2) )
 543     {
 544         ++ currentPageNumber; //button in this example is Next to add 1 to the page number and call the menu again
 545         DialogueMenu(dynamicMenuButtonNumbers); //call the menu again
 546     }
 547     else 
 548     {   // come here if pressed button is not in the reserved list
 549         if(~llListFindList(dynamicMenuButtonNumbers, (list)message))
 550         {   //come her if the button pressed is in the dynamic buttons list
 551             integer buttonIndex = (integer)message;
 552             string itemToAction = llGetInventoryName( inventoryType, buttonIndex );//sets the name of the item to rez/derez
 553             if (inventoryType == INVENTORY_OBJECT)
 554             {   //if the menu is displaying inventory objects
 555                 RezDeRezIndividualItem(itemToAction);
 556                 itemsRezzed = TRUE;
 557                 if (recallMenu) MainDialogMenu();
 558             }//close if displaying inventory notecards
 559             else if (inventoryType == INVENTORY_NOTECARD)
 560             {   //if the menu is displaying notecards
 561                 RezDeRezSet(itemToAction);
 562             }//close if inventory is displaying notecards
 563         }//close if item actually exists. 
 564         else if (chatFeedback) llOwnerSay ("Debug: Unknown button pressed");  //this shoud never happen!
 565     }//close else this is a dynamic button response
 566 }// close process messages from the listen event
 567 
 568 DialogMenuStatus(string status)
 569 {   //turns the dialog menu on an off
 570     if (status == "Off") dialogMenu = FALSE;
 571     else if (status == "On") dialogMenu = TRUE;
 572     MessageFeedback("DialogMenuStatus", status);
 573 }//close dialog menu status
 574 
 575 integer ChkSlowRezCardExists()
 576 {   //returns a true if the card is found
 577     integer exists;
 578     if (llGetInventoryType("SlowRes-AutoGen") == INVENTORY_NOTECARD) exists = TRUE;
 579     else exists = FALSE;
 580     return exists;
 581 }//close chkj for slow rez card
 582 
 583 SlowRezAll()
 584 {   //makes a rez set containing all itmes then uses rez-set to rez them as its much slower
 585     MakeRezSet("SlowRes-AutoGen"); //makes the set containing all items
 586     integer slowRezCardExists = FALSE; //sets the integer as false to begin the checking loop
 587     while (!slowRezCardExists)
 588     {   //holds the system in the loop untill notecard generation has finished
 589         slowRezCardExists = ChkSlowRezCardExists(); //call the check on each loop
 590     }//close the loop
 591     rezDerezMode = "RezItems"; //sets the mode to rez so items rez when the next method is called
 592     RezDeRezSet("SlowRes-AutoGen");//calls the rez rezset method
 593 }//close slow rez all. 
 594 
 595 RezDeRezSet(string notecardName)
 596 {   //come here to rez or de-rez a notecard list
 597     if (rezDerezMode == "RezSet") rezDerezMode = "RezItems";
 598     else if (rezDerezMode == "RemoveSet") rezDerezMode = "RemItems";
 599     if (llGetInventoryType (notecardName) == INVENTORY_NOTECARD)
 600     {   //come here if the named notecard exists
 601         integer notecardLength = osGetNumberOfNotecardLines(notecardName);
 602         integer lineIndex;
 603         for (lineIndex = 0; lineIndex < notecardLength; ++ lineIndex)
 604         {
 605             string currentLine = llStringTrim(osGetNotecardLine(notecardName, lineIndex), STRING_TRIM);
 606             string firstChar = llGetSubString(currentLine, 0, 0);
 607             integer equalsIndex = llSubStringIndex(currentLine, "=");
 608             string instruction = llToLower (llStringTrim(llGetSubString(currentLine, 0, equalsIndex-1), STRING_TRIM));
 609             string itemName = llStringTrim(llGetSubString(currentLine, equalsIndex+1, -1), STRING_TRIM);
 610             if (currentLine != "" && firstChar != "#" && equalsIndex != -1  && instruction == "itemname")
 611             {   // if the lines not blank, doesn't begin with a #, contains an equals sign and has intstruction itemname do this
 612                 RezDeRezIndividualItem(itemName);
 613             }
 614         }//close loop through notecard
 615     }//close if notecard exists
 616     else 
 617     {   //come here if the notecard is not found
 618         if (chatFeedback) llOwnerSay("Notecard: " + notecardName + "not found, please try again" );
 619         if (recallMenu) RezSetsDialogMenu();
 620     }//close if notecard not found
 621 }//close RezDeRezSet
 622 
 623 TestRecordedItems(string instruction)
 624 {   //sends test recorded itens in manual pickup mode to test positon
 625     MessageItems("All", "TestRecordedItems",instruction, "");
 626     MessageFeedback("TestRecordedItems", instruction);
 627     if (recallMenu) RezModeDialogMenu();
 628 }//close test recored items positon
 629 
 630 ForceUpdateItemPositons()
 631 {   //sends message to items to update their positions if they are out of place
 632     MessageItems("All", "RezCheck", "autoPickup", "");
 633     MessageFeedback("ForceUpdateItemPositons", "");
 634 }//close force update item positions
 635 
 636 RezDeRezIndividualItem(string name)
 637 {   //rezes an individual item
 638     if (rezDerezMode == "RezItems")
 639     {   //come here if the instruction is rez item
 640         integer typeOfInventory = llGetInventoryType(name);
 641         if (typeOfInventory == INVENTORY_OBJECT)
 642         {   //come here if the item exists in the inventory
 643             llListenControl (rezBoxComsChannel, TRUE); //turns on listeners for coms channel
 644             string RezInstruction = "RezSingleItem" + "," + (string)rezBoxSetNo;
 645             MessageRezScript (RezInstruction, name);
 646             if (chatFeedback) MessageItems("All", "ChatFeeback", "On", "");
 647             else MessageItems("All", "ChatFeeback", "Off", "");
 648             MessageFeedback("RezedSingleItem", name);
 649         }//close if item exists in the inventory
 650         else 
 651         {   //come here if the item does not exist in the inventory
 652             if (chatFeedback) llOwnerSay("Sorry no object with that name exists in the inventory, did you forget to add it to the box?");
 653         }//close if item doesn't exist in the inventory
 654     }// close if single items mode is rez 
 655     else if (rezDerezMode == "RemItems")
 656     {   //come here if the instrructions is de-rez item
 657         MessageItems("All", "DeRezSingleItem", name, "");
 658         MessageFeedback("DeRezedSingleItem", name);
 659     }// close if single items mode is remove
 660     if (recallMenu) RezDeRezMenuDialog();
 661 }// close rez individual item
 662 
 663 MakeRexSetNane()
 664 {   //sents a text box dialog to the user asking for the rez set name
 665     string message = "Please enter a name for the Rez Set Notecard";
 666     string instructionType = "NewRezSetName";
 667     TextBoxMenu (instructionType, message);
 668 }//close send text box dialog to the user asking for a rez set name.
 669 
 670 MakeRezSet(string name)
 671 {   //loops through the inventory objevts and generates a notecard listing all the names
 672     integer notecardIndex;
 673     list inventoryObjects = [];
 674     for (notecardIndex = 0; notecardIndex < llGetInventoryNumber(INVENTORY_OBJECT); notecardIndex++)
 675     {
 676         string instruction = "itemname";
 677         string objectName = llGetInventoryName(INVENTORY_OBJECT, notecardIndex);
 678         string toAdd = instruction + "=" +objectName;
 679         inventoryObjects += toAdd;
 680     }
 681     if (llGetInventoryType(name) == INVENTORY_NOTECARD) llRemoveInventory(name);
 682     osMakeNotecard(name, inventoryObjects);
 683     MessageFeedback("MakeRezSet", name);
 684     if (recallMenu) RezSetsDialogMenu();
 685 }// close make rez set notecard
 686 
 687 UnderGroundMovement (string data)
 688 {   //enables/disables underground movement 
 689     if (data == "On") underGroundMovement = TRUE;
 690     else if (data == "Off") underGroundMovement = FALSE;
 691     MessageItems("All", "UnderGroundMovement", data, "");
 692     MessageFeedback("UnderGroundMovement", data);
 693     if (underGroundMovement) SeriousWarning();
 694     else  
 695         {
 696             if (recallMenu) RezModeDialogMenu();
 697         }
 698     if (displayHoverText) HoverTextInfo("Settings");
 699 }//close enable or disable under ground movement
 700 
 701 SeriousWarning()
 702 {   //gives a serious warning about potential sim destroying movement
 703     list buttons = ["Ok"];
 704     string message = "Restoring to underground positions may fail. It may also permanantly corrupt your sim. It is STRONGLY recomended that you attach another link as the root object which is above ground height. If you do not have an OAR to restore this region DO! NOT! restore items to this position! ";
 705     llOwnerSay (message);
 706     llDialog (llGetOwner(), message, buttons, mainMenuChannel);
 707     autoPickup = FALSE;
 708 } //close serious warning
 709 
 710 ItemPickup(string data)
 711 {   //set item pickup mode based on data
 712     if (data == "Auto") autoPickup = TRUE;
 713     else if (data == "Manual") autoPickup = FALSE;
 714     if (displayHoverText) HoverTextInfo("Settings");
 715     //if (chatFeedback) llOwnerSay("ItemPickup: " + data);
 716     if (recallMenu) RezModeDialogMenu();
 717     MessageItems("All", "ItemPickup", data, "");
 718     MessageFeedback("ItemPickup", data);
 719 }//close set pickup mode 
 720 
 721 ChatFeedBack(string instruction)
 722 {   //turns the chat feedback on or off based on the instruction
 723     if (instruction == "On")
 724     {   //come here if instruction is turn chat on
 725         chatFeedback = TRUE;
 726         if (displayHoverText) HoverTextInfo("Settings");       
 727     }//close chat on
 728     else if (instruction == "Off")
 729     {   //come here if instruction ius chat off
 730         if (displayHoverText) HoverTextInfo("Off");
 731         chatFeedback = FALSE;        
 732     }//close chat off
 733     //if  (chatFeedback) llOwnerSay("ChatFeedBack: " + instruction);
 734     MessageRezScript ("ChatFeedBack", instruction);
 735     MessageFeedback("ChatFeedBack", instruction);
 736     Settings("Save");
 737 }//close chat feedback
 738 
 739 HoverTextInfo(string instruction)
 740 {   //sets the hover text info or removes it
 741     string displayText;
 742     if  (instruction == "Off") 
 743     {   //turn thover text off and notify
 744         displayHoverText = FALSE;
 745         displayText = "";
 746     }//close turn off hover text
 747     else if (instruction == "Settings")
 748     {
 749         displayHoverText = TRUE;
 750         string chatFeedbackMode;
 751         if (chatFeedback) chatFeedbackMode = "On";
 752         else chatFeedbackMode = "Off";
 753         string positionMode;
 754         if (relativePos) positionMode = "Relative";
 755         else positionMode = "Absolute";
 756         string pickupMode;
 757         if (autoPickup) pickupMode = "Auto";
 758         else pickupMode = "Manual";
 759         string underGround;
 760         if (underGroundMovement) underGround = "On";
 761         else underGround = "Off";
 762         string recordingMode;
 763         if (allowPosRecording) recordingMode = "On";
 764         else recordingMode = "Off";
 765         string apiLinkedMode;
 766         if (apiLinkedMessage) apiLinkedMode = "On";
 767         else apiLinkedMode = "Off";
 768         string apiRegionMode;
 769         if (apiRegionSay) apiRegionMode = "On";
 770         else apiRegionMode = "Off";        
 771         string line0 = "Name: " + llGetObjectName() + "\n \n ";
 772         string line1 = "Positioning Mode: " + positionMode + "\n ";
 773         string line2 = "Pickup Mode: " + pickupMode + "\n ";
 774         string line3 = "Under Ground Movement: " + underGround + "\n ";
 775         string line4 = "Position Recording: " + recordingMode + "\n ";
 776         string line5 = "Chat Feedback:  " + chatFeedbackMode + "\n ";
 777         string line6 = "Api LinkedMessages: " +  apiLinkedMode + "\n ";
 778         string line7 = "Api RegionSay: " + apiRegionMode + "\n\n ";
 779         displayText = line0 + line1 + line2 + line3 + line4 + line5 + line6 + line7;
 780     }
 781     else if (instruction == "Contents")
 782     {
 783         displayHoverText = TRUE;
 784         string line8 = "This box contains: " + "\n "; 
 785         displayText = line8; //combine the above lines
 786         list inventoryTypes = [ INVENTORY_ALL, "Inventory Total: ", 
 787                                 INVENTORY_TEXTURE, "Textures: ", 
 788                                 INVENTORY_SOUND, "Sounds: ", 
 789                                 INVENTORY_LANDMARK, "Landmarks: ", 
 790                                 INVENTORY_CLOTHING, "Clothing Items: ",
 791                                 INVENTORY_OBJECT, "Objects: ",
 792                                 INVENTORY_NOTECARD, "Notecards: ", 
 793                                 INVENTORY_SCRIPT, "Scripts: ",
 794                                 INVENTORY_BODYPART, "Body Parts: ", 
 795                                 INVENTORY_ANIMATION, "Animations: ",
 796                                 INVENTORY_GESTURE, "Guestures: "
 797                                ];
 798         integer i;
 799         for (i = 0; i < llGetListLength(inventoryTypes); i = i+2)
 800         {   //loops through the types string adding found items to the display text
 801             integer itemTypeCount = llGetInventoryNumber(llList2Integer(inventoryTypes,i));
 802             if (itemTypeCount > 0)
 803             {   //if there are items if this kind found, add the information to the display info
 804                 string dataToAdd = llList2String(inventoryTypes, (i+1)) + (string)itemTypeCount + "\n ";
 805                 displayText += dataToAdd;   
 806             }//close if items of this type found
 807         }//close loop through types     
 808     }
 809     llSetText(displayText, <1,1,0>, 1.0);
 810     MessageFeedback("HoverTextInfo", instruction);
 811 } //close hover text info
 812 
 813 PrepItemBoxExchange()
 814 {   //sends a message to the itesm telling them to prepare for a rez box exchange
 815     MessageItems("All", "PrepItemBoxExchange", "", ""); 
 816     MessageFeedback("PrepItemBoxExchange", "");
 817     if (recallMenu) PosRecordDialogMenu();
 818 }//close prep item for box exchange
 819 
 820 RezBoxAlpha(string status)
 821 {   //sets alpha of rez box links/faces if the coulour change will not break anything
 822     if (status == "On") rexBoxAlpha = TRUE; //sets alpha status on
 823     else if (status == "Off") rexBoxAlpha = FALSE; //sets alpha status off
 824     integer numOfPrims = llGetNumberOfPrims();
 825     integer startIndex;
 826     if (numOfPrims == 1) startIndex = 0; //single link item
 827     else startIndex = 1; //multi link item
 828     integer linkIndex;
 829     for (linkIndex = startIndex; linkIndex < numOfPrims; ++ linkIndex)
 830     {   //loops through the linkset setting the alpha on all sides of each link appropriately
 831         llSetAlpha( (float)(!rexBoxAlpha), ALL_SIDES); //inverses the alpha above to set on the faces
 832     }//close loop through all links
 833     MessageFeedback("RezBoxAlpha", status);
 834     Settings("Save"); //update description
 835     if (recallMenu) InfoDisplayDialogMenu();
 836 }//close rez box alpha
 837 
 838 RexBoxPhantom (string status)
 839 {   //sets linkset phantom based on input integer
 840     if (status == "On") rexBoxPhantom = TRUE;
 841     else if (status == "Off") rexBoxPhantom = FALSE;
 842     llSetLinkPrimitiveParamsFast(LINK_SET, [PRIM_PHANTOM, rexBoxPhantom]);
 843     MessageFeedback("RexBoxPhantom", status);
 844     Settings("Save");
 845     if (recallMenu) InfoDisplayDialogMenu();
 846 }//close rez box phantom
 847 
 848 SetBoxPosRotFromMenu(string instruction)
 849 {   //come here if enter a pos / rot for the rez bots is called from the menu
 850     if (instruction == "Position") TextBoxMenu ("BoxPosition", "Please enter position vector <x,y,z>");
 851     else if (instruction == "Rotation") TextBoxMenu ("BoxRotation","Please enter rotation vector in degrees <x,y,z>");
 852 }// set box pos/rot from menu
 853 
 854 RezBoxRot(string vecDegRot)
 855 {// adjusts the box rotation to the supplied rot assuming its possible
 856     integer isVec = ChkIsVec (vecDegRot);
 857     if (isVec)
 858     {   //come here if a valid vector was supplied
 859         vector vecDegTarget = (vector)vecDegRot;
 860         vector vecDegCurRot = llRot2Euler(llGetRot())*RAD_TO_DEG;
 861         rotation targetRot = llEuler2Rot(vecDegTarget*DEG_TO_RAD);
 862         llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_ROTATION, targetRot]); //sets the rotation of our item
 863         MessageFeedback("RezBoxRot", (string)vecDegRot);
 864         if (recallMenu) InfoDisplayDialogMenu();
 865     }//close if a valid vectore was supplied
 866     else 
 867     {   //come here if the data supplied is not a valid eulear rotation vector
 868         if (chatFeedback) llOwnerSay("The supplied rotation not a euler vector. Please fix this and try again. ");
 869     }//close if not supplied with a valid vector. 
 870 }//close set rez box rotation
 871 
 872 RezBoxPos(string vecPos)
 873 {   //moves the rez box to a supplied positon 
 874     vector currentPos = llGetPos();
 875     integer isVec = ChkIsVec (vecPos);
 876     if (isVec) 
 877     {   //come here if a valid vector was supplied
 878         vector targetVec = (vector)vecPos;
 879         integer moveIsPossible = CheckMoveLimits(targetVec);
 880         if (moveIsPossible)
 881         {   //come here if the target pos is valid for this sim
 882             MoveRezBox(targetVec); //perform the move
 883             MessageFeedback("RezBoxPos", vecPos);
 884         }//close if target position is valid for this sim
 885         else 
 886         {   //come here if the api is attempting to move the box outside the sim limits
 887             if (chatFeedback) llOwnerSay("The position supplied was a valid vector but it is outside the rez limits for this sim. Please check and try again.");
 888         }//close if attempting to move the box outside the sim limits
 889     }//close if valid vector supplied
 890     else
 891     {   //come here if the supplied string could not be turned into a vector
 892         if (chatFeedback) llOwnerSay("The supplied information is not a vector. Please fix this and try again. ");
 893     }//close if not a vector
 894     if (recallMenu) InfoDisplayDialogMenu();
 895 }//close rez box position 
 896 
 897 MoveRezBox(vector positon)
 898 //Moving using this method allows sim wide movement and exact positioning however it can only move in increments of upto 10m so we work in stages
 899 {//performs the movement of the object to its final position and rotation
 900 if (positon.z < 4096)
 901     { // if the position is under 4096m high use the low resources method of moving.
 902         llSetRegionPos(positon);
 903         if (llGetPos() != positon) llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_POSITION, positon]); //sets tpositions
 904     } //close if end pos is under 4096m
 905 else
 906     {   //come here if the target 4096m or higher in z
 907         float distanceFromTarget = llVecDist(llGetPos(), positon);
 908         while (distanceFromTarget >= 10)
 909         { //keep looping untill we are less than 10m away from target
 910             llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_POSITION, positon]);
 911             distanceFromTarget = llVecDist(llGetPos(), positon);
 912         }//close while distance from target is over 10m
 913         llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_POSITION, positon]); //set the target one last time to finish the movement
 914     }//close if the target height is over 4096m
 915 }//close start move
 916 
 917 RemoveRezByName(string mode, integer invType)
 918 {//removes items by name from the rezed items
 919     inventoryType = invType;
 920     rezDerezMode = mode;
 921     TextBoxMenu ("RemRezItems", "Please enter the name of the item to rez or remove");
 922 } //close remove by name
 923 
 924 RemoveRezListItems(string mode, integer invType)
 925 {//generate and calls the dynamic menu
 926     inventoryType = invType;
 927     rezDerezMode = mode;
 928     llListenControl (dynamicMenuChannelListen, TRUE); //turns on listeners for dynamic menu channel
 929     GenDynamicButtonsNamesList(inventoryType);
 930     DialogueMenu(dynamicMenuButtonNumbers);
 931 }//close dynamic menu
 932 
 933 RezBoxListToChat(integer invType)
 934 { // loop through the box contents dumping the output to chat
 935     inventoryType = invType;
 936     integer i;
 937     for (i=0; i < llGetInventoryNumber(inventoryType); ++i)
 938     {   //loops through all objects in the inventory
 939         if (chatFeedback) llOwnerSay(llGetInventoryName(inventoryType,i)); //says the current object name in chat if chatFeedback enabled
 940     }//close loop through inventory objects
 941     if (recallMenu) 
 942         {
 943             if (inventoryType == INVENTORY_NOTECARD) RezSetsDialogMenu(); //send rez sets menu to user again
 944             else if (inventoryType == INVENTORY_OBJECT) SingleItemsDialogMenu(); //send single items menu to the user again
 945         }
 946 } // close list bix cintents in chat
 947 
 948 DelInventoryObjects()
 949 {//removes all obects from the inventory
 950     integer z;
 951     string objectName;
 952     integer itemsNumber = llGetInventoryNumber(INVENTORY_OBJECT);
 953     for (z = itemsNumber; z >= 0; --z)
 954     {   //loops throug all objevts in the inventory in reverse order
 955         objectName = llGetInventoryName(INVENTORY_OBJECT, z); //gets the name of the current index
 956         llRemoveInventory(objectName); //deletes the current object
 957     }//close looop through inventory items
 958     MessageFeedback("DelInventoryObjects", "");
 959     if (chatFeedback)llOwnerSay ("Rez box items removed ready to add the re-recorded items");  
 960 }//close remove inventory objects
 961 
 962 PrepReRecord()
 963 {   //prepares the rez box and items for re-recording of all items
 964     ChkBoxPosForRecording();
 965     RecordCurrentPosRot();
 966     confirmationMenuType = "DelBoxInventoryObjects"; //sets confirmatio menu type
 967     MessageItems("All", "PrepReRecord", "TRUE", ""); //sends message to items telling them to prepare to re-record
 968     MessageFeedback("PrepReRecord", "");
 969 }//close prepare re-recording of items
 970 
 971 ReRecordAllItems()
 972 {// sends message tto all items via region say and sends delte itens dialog
 973     PrepReRecord();
 974     integer inventoryCount = llGetInventoryNumber(INVENTORY_OBJECT );
 975     if (inventoryCount > 100)
 976     {   //come here if there are less than 100 items in the box to re-record
 977         string message =    "You have more than 100 items in the rez box. Pickup Mode being set to manual. You will need to pick these items up manually.";
 978         if (chatFeedback) llOwnerSay(message);
 979         ItemPickup("Manual");
 980     }//close if there are more than 100 items in the box
 981     MessageItems("All", "ReRecordAllItems", "TRUE", ""); //sends message to items telling them to re-record
 982     MessageFeedback("ReRecordAllItems", "TRUE");
 983     ConfirmationDialogueMenu(); //sends the confirmation dialog to the user
 984     itemsRezzed = FALSE; //sets items to not rezzed 
 985 }//close Re-Record Items
 986 
 987 AllowBoxReposition()
 988 { // turns on position recording
 989     MessageFeedback("AllowBoxReposition", "TRUE");
 990     PositioningMode("Absolute");
 991     if (recallMenu) PosRecordDialogMenu();
 992 }//close turn on position recording
 993 
 994 ApiRegionSay(string instruction)
 995 {   //turns the region api on/off based on the instruction
 996     if (instruction == "On") apiRegionSay = TRUE;
 997     else if (instruction == "Off") apiRegionSay = FALSE;
 998     if (apiRegionSay) llListenControl (apiRegionChannelListen, TRUE); // turns on listeners for the rezbox channel 
 999     else llListenControl (apiRegionChannelListen, FALSE); // turns off listeners for the rezbox channel 
1000     MessageFeedback("ApiRegionSay", instruction);
1001     if(displayHoverText) HoverTextInfo("Settings");
1002     Settings("Save");
1003     if (recallMenu) ApiDialogMenu();
1004 }//close turn region api on/off
1005 
1006 ApiLinkedMessage (string instruction)
1007 {   //turns the linked message api on/off based on the instruction
1008     if (instruction == "On") apiLinkedMessage = TRUE;
1009     else if (instruction == "Off") apiLinkedMessage = FALSE;
1010     MessageFeedback("ApiLinkedMessage", instruction);
1011     Settings("Save");
1012     if(displayHoverText) HoverTextInfo("Settings");
1013     if (recallMenu) ApiDialogMenu(); 
1014 }//close api linked message on/off
1015 
1016 DisplayBoxNumber()
1017 {   //displays the box number in local if chat feed back is on
1018     MessageFeedback("DisplayBoxNumber", (string)rezBoxSetNo);
1019     if (recallMenu) MainDialogMenu();
1020     llRegionSay(rezBoxChannel, "BoxNumber: " + (string)rezBoxSetNo );
1021 }//close display box number in local
1022 
1023 RecordCurrentPosRot()
1024 {//gets and stores the position and rotation of the rez box
1025     currentPos = llGetPos(); //saves the current position
1026     currentRot = llGetRot(); //saves the current rotation
1027 }//close record position and rotation
1028 
1029 RezItems() 
1030 {//send linked message to rezzor script to avoid issues with forced sleep time from rezzing
1031 if (!itemsRezzed)
1032     {   //come here if items are not rezzed
1033         integer objectsInBox = llGetInventoryNumber (INVENTORY_OBJECT);
1034         if (objectsInBox == 0 ) 
1035         {   // comw here if no objects exist
1036             if (chatFeedback) llOwnerSay("There is nothing to rez. Did you forget to put your items into the rez box?");
1037         }   //close if no objects exist
1038         else
1039         {   //come here if there are objects to rez
1040             llListenControl (rezBoxComsChannel, TRUE); //turns on listeners for coms channel so we can hear rezed items
1041             MessageFeedback("RezItems", "TRUE");
1042             string RezInstruction = "RezItems" + "," + (string)rezBoxSetNo; //sets the comma seperated values message to be sent to the rez script
1043             MessageRezScript (RezInstruction, ""); //sends message to rez script
1044             itemsRezzed = TRUE; // sets the items rezzed tracker to true
1045             if (relativePos) StartRelativeModeTimer();
1046             Settings("Save");//update the description incase of region restart 
1047         }// close if we have objects to rez
1048     }//close if items not rezzed
1049 else if (itemsRezzed)
1050     {   //come here if we already have items rezzed
1051         if (chatFeedback) llOwnerSay( "\n" + "Sorry items are already rezzed, aborting to avoid duplicate prims in the same place. " + "\n" + 
1052                     "If you have manually removed items or done it individually please press derez and try again");
1053         if (recallMenu) MainDialogMenu();
1054     }//close if items already rezed
1055     if (chatFeedback) MessageItems("All", "ChatFeeback", "On", "");
1056     else MessageItems("All", "ChatFeeback", "Off", "");
1057     if (recallMenu) RezDeRezMenuDialog();
1058 }//close rez items
1059 
1060 FinaliseItems()
1061 {// do this if finalise button is pressed
1062     MessageItems("All", "FinaliseItems", "", "");
1063     MessageFeedback("FinaliseItems", "TRUE");
1064     itemsRezzed = FALSE;// sets the items rezzed tracker to no items rezzed
1065     llSetTimerEvent(0); //stop the timer as we no longer need to track the relation between the rez box and the items.
1066     if (recallMenu) MainDialogMenu();
1067     Settings("Save");//update the description incase of region restart
1068 }//close finalise button pressed
1069 
1070 DeRezItems()
1071 {//do this if the de-rez button is pressed
1072     MessageItems("All", "DeRezItems", "", "");
1073     MessageFeedback("DeRezItems", "All");
1074     itemsRezzed = FALSE;// sets the items rezzed tracker to no items rezzed
1075     if (!allowPosRecording) llListenControl (rezBoxComsChannel, FALSE); //turns off listeners for coms channel, no need for it with nothing rezzed. and recording being turned off. 
1076     llSetTimerEvent(0); // turn the timer off if its runing as there are no longer any items to track
1077     Settings("Save");//update the description incase of region restart
1078     if (recallMenu) RezDeRezMenuDialog();
1079 }//close de-rez items
1080 
1081 PositioningMode(string mode)
1082 {   //sets the positioning mode based on the supplied mode
1083     if (mode == "Relative") relativePos = TRUE; //turns on relative mode
1084     else if (mode == "Absolute") relativePos = FALSE; //turns on absolute mode
1085     Settings("Save");//update the description incase of region restart
1086     MessageFeedback("PositioningMode", mode);
1087     if (recallMenu) RezModeDialogMenu() ; //calls the main menu if called from a menu
1088     if (displayHoverText) HoverTextInfo("Settings");
1089     if (relativePos) StartRelativeModeTimer();
1090     else llSetTimerEvent(0);
1091 }//close set position mode
1092 
1093 ChkBoxPosForRecording()
1094 {// checks to see if the boxs rotation <0,0,0>, if it is turn on recording, if not send confirmation for auto fix
1095     if (llGetRot() == <0.00000, 0.00000, 0.00000, 1.00000>)  Recording("On"); //turns recording on if box is correctly rotated
1096     else 
1097     {   //come here if the box has been rotated and needs adjusting for recording
1098         confirmationMenuType = "AutoFixBoxRotationForRecording"; //sets the confirmation dialog type
1099         ConfirmationDialogueMenu(); //sends confirmation dialog to the user
1100     }//close ele box position is incorrect for recroding
1101 }// close check box position for recording
1102 
1103 SetBoxRotationForRecording()
1104 {//sets the position of the box to <0,0,0> ready for recording
1105     llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_ROTATION, <0.00000, 0.00000, 0.00000, 1.00000>]); //set the rotation of the box to <0,0,0>
1106     if (chatFeedback) llOwnerSay("The rotation of this item has been set to <0,0,0>. Please do not adjust the rotation while recording item positions. RezBox Ready To Record Item Positions" );//send message to the owner around box position and recording status
1107 }//close set box rotation for recording
1108 
1109 GenTempMenuList(list inputList)
1110 { // generates the temp menu buttons (the ones for the current page)
1111     tempMenuButtons = []; //makes sure the list is blank before we start
1112     integer firstIndex = currentPageNumber*dynamicButtonsPerPage; //uses the page number to work out the start index in the menu buttons list
1113     integer lastIndex = firstIndex + dynamicButtonsPerPage-1; // calculates the last index in the menu buttons list
1114     if (lastIndex >= llGetListLength(inputList)) lastIndex = llGetListLength(inputList) -1; //don't add extra blank buttons for no good reason
1115     integer i; 
1116     for ( i = firstIndex; i <= lastIndex; ++ i)
1117     {   // adds each of the index is the range calculated to the temp buttons list
1118         tempMenuButtons += llList2String(inputList,i); 
1119     }//close loop through range of indexed buttons
1120     AddReservedButtonsToTempMenu(); //adds the reserved buttons to the temp buttons list
1121     GenMenuPageMessage(firstIndex, lastIndex); 
1122 } //close generate temp menu list
1123 
1124 GenMenuPageMessage(integer firstIndex, integer lastIndex)
1125 {   //generates the string to display on the menu page
1126     pageMessage = "You are viewing page " + (string)(currentPageNumber+1) + " of " + (string)(numOfPages) + "\n" ;
1127     integer i;
1128     for (i = firstIndex; i <= lastIndex; ++i)
1129     {   //loops through button items adding them to the page message
1130         pageMessage += "\n";
1131         pageMessage += (string)i ;
1132         pageMessage += "  " ;
1133         pageMessage += llGetInventoryName( inventoryType, i );  
1134     }//close loop through button items
1135 }//close generate menu string
1136 
1137 AddReservedButtonsToTempMenu()
1138 { // loops through the reserved buttons and adds them to the temp list
1139     integer i;
1140     for (i = 0; i < llGetListLength(reservedButtons); ++i)
1141     {   //loops through the reserved buttons adding them to the temp list
1142         tempMenuButtons += llList2String (reservedButtons, i); //adds the current button to the reserved list
1143     }// close loop through reserved buttons list
1144 }//close add reserved buttons to temp list
1145 
1146 DialogueMenu(list inputList)
1147 { //displays a big list of buttons dynamially over many pages
1148     numOfPages = CalcPagesInMenu(inputList);
1149     menuLength = llGetListLength (inputList);
1150     if ( currentPageNumber >= numOfPages) currentPageNumber = 0; // these two lines make sure the page number never goes out of range;
1151     else if (currentPageNumber < 0) currentPageNumber = numOfPages-1; //counting starts from 0 so the last page is 1 less than the total number of pages 
1152     GenTempMenuList(inputList); //gen list and pass the menu to process from   
1153     llDialog(llGetOwner(), pageMessage, tempMenuButtons, dynamicMenuChannel); //display the current page in the dialog
1154 }// close display dialogue menu
1155  
1156 GenDynamicButtonsNamesList(integer invType)
1157 {   //loops through the prims contents and adds the name of each OBJECT to the list and then sorts the list
1158     inventoryType = invType;
1159     integer i;
1160     for (i = 0; i < llGetInventoryNumber(inventoryType); ++i)
1161     {   //gets the name of each object and adds it to the list
1162         dynamicMenuButtonNumbers += (string)i;
1163     }
1164 } //close generate dynamic nanes list
1165 
1166 integer CalcPagesInMenu(list inputList)
1167 { // works out the total number of pages needed allowing two buttons for forwards and backwards
1168     reservedButtonsPerPage = llGetListLength(reservedButtons); // how many button spaces per page we need to reserve
1169     dynamicButtonsPerPage = 12-reservedButtonsPerPage;  //subtract the reserve from the total availible of 12
1170     numOfPages = (integer)(llGetListLength(inputList) /dynamicButtonsPerPage); // 2 buttons for next and back with 1p per page and an extra page for any remainders
1171     if (menuLength%dynamicButtonsPerPage > 0) ++numOfPages; //if there is any remainder after dividing the number of buttons by 10 addd on another page
1172     return numOfPages; //returns the number of pages
1173 }//close calculate pages in menu
1174 
1175 ApplyShapeTexture(float rotationRAD)
1176 {   //sets the shape of the box and textures it rotating the arrow to the specified position
1177     llSetLinkPrimitiveParamsFast(LINK_THIS, 
1178             [   
1179                 PRIM_TYPE, PRIM_TYPE_CYLINDER, PRIM_HOLE_DEFAULT, <0.00, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>,  
1180                 PRIM_TEXTURE, ALL_SIDES, "1a1eef4d-2c98-4947-a9bd-34c6a49650fb", <2,1,0>, <0,0,0>, 0,
1181                 PRIM_COLOR, 2, <0,0,0>, 1
1182             ]); //sets the shape to cylinder and adds the covey texture to all sides setting the repeat to 2 in x
1183     string sDynamicID = "";                          // not implemented yet
1184     string sContentType = "vector";                  // vector = text/lines,etc.  image = texture only
1185     string sData = "";                               // Storage for our drawing commands
1186     string sExtraParams = "width:512,height:256";    // optional parameters in the following format: [param]:[value],[param]:[value]
1187     integer iTimer = 0;                              // timer is not implemented yet, leave @ 0
1188     integer iAlpha = 100;                            // 0 = 100% Alpha, 255 = 100% Solid
1189     // draw a rectangle
1190     sData = osSetPenSize(sData, 3);                   // Set the pen width to 3 pixels
1191     sData = osSetPenColor(sData, "Black");             // Set the pen color to red
1192     sData = osMovePen(sData, 0, 0);                 // Upper left corner at <28,78>
1193     sData = osDrawFilledRectangle(sData, 512, 256);   // 200 pixels by 100 pixels
1194     // setup text to go in the drawn box
1195     sData = osMovePen(sData, 50, 5);                 // place pen @ X,Y coordinates 
1196     sData = osSetFontName(sData, "Arial");            // Set the Fontname to use
1197     sData = osSetFontSize(sData, 20);                 // Set the Font Size in pixels
1198     sData = osSetPenColor(sData, "White");           // Set the pen color to Green
1199     sData = osDrawText(sData, llGetObjectName()); // The text to write
1200     osSetDynamicTextureDataBlend( sDynamicID, sContentType, sData, sExtraParams, iTimer, iAlpha ); // Now draw it out
1201     llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, 0, "21f88ff4-8277-4f9d-a5ec-bee61fd08ea8", <-1,1,0>, <0,0,0>, rotationRAD]); //sets the arrow texture
1202     itemPositions = [];//clear the list to keep memory useage to a min. 
1203     if (recallMenu) MainDialogMenu();
1204 }//close apply shape texture
1205 
1206 Settings(string instruction)
1207 {   //saves or loads the settings based on the instruction
1208     if (instruction == "Save")
1209     {   //come here if instruction is Save
1210         llSetObjectDesc(    (string)rezBoxSetNo + "," + 
1211                             (string)itemsRezzed + "," + 
1212                             (string)relativePos + "," + 
1213                             (string)chatFeedback + "," + 
1214                             (string)displayHoverText + "," + 
1215                             (string)apiLinkedMessage + "," + 
1216                             (string)apiRegionSay + "," + 
1217                             (string)rexBoxPhantom + "," + 
1218                             (string)rexBoxAlpha + "," +
1219                             (string)autoPickup + "," +
1220                             (string)underGroundMovement + "," +
1221                             (string)dialogMenu);
1222                         
1223     }//close save settins to object description
1224     else if (instruction == "Load")
1225     {   //come here if instruction is load
1226         string desc = llGetObjectDesc();
1227         list objectDescription = llCSV2List(desc); //retrieves the object descriptions and converts it to a list
1228         rezBoxSetNo = llList2Integer(objectDescription, 0); //if description exists get the description and turn it back into an integer 
1229         itemsRezzed = llList2Integer(objectDescription, 1); //retrive and save items rezzd true or false
1230         relativePos = llList2Integer(objectDescription, 2); // retrive and save relative pos mode 
1231         chatFeedback = llList2Integer(objectDescription, 3); //retrieve and set chat feedback
1232         displayHoverText = llList2Integer(objectDescription, 4); //retrieves and sets hover text. Hover text is persistent so no need to re-apply here
1233         apiLinkedMessage = llList2Integer(objectDescription, 5); //retrieves and sets the api Linked message status
1234         apiRegionSay = llList2Integer (objectDescription, 6); //retrieves and sets the api regionsay status. 
1235         rexBoxPhantom = llList2Integer (objectDescription, 7);//retrieves and sets the rez box phantom bool
1236         rexBoxAlpha = llList2Integer (objectDescription, 8); //retrieves and sets the rez box alpha bool
1237         autoPickup = llList2Integer (objectDescription, 9); //retrieves and sets the auto pickup variable
1238         underGroundMovement = llList2Integer (objectDescription, 10); //retrieves and sets the underground movement variable
1239         dialogMenu = llList2Integer(objectDescription, 11); //retrieves and sets the dialog menu status
1240         apiRegionChannelIn = rezBoxSetNo; //defines the api inbound channel
1241         apiRegionChannelOut = rezBoxSetNo *-1; //defines the api outbound channel
1242         if (itemsRezzed && relativePos) StartRelativeModeTimer(); //if items are rezzed turn turn on trimer to update position 
1243         else llSetTimerEvent(0);//if nothings rezzed or we are in absolute mode make sure the timers turned off. 
1244         if (chatFeedback) ChatFeedBack("On"); // turns chat feedback on
1245         else ChatFeedBack("Off"); // turns chat feedback off        
1246     }//close load settings
1247 }//close settings, 
1248 
1249 StartRelativeModeTimer()
1250 {   //sets the timer count to 0 and starts the timer
1251     timerCount = 0;
1252     llSetTimerEvent(0.1);
1253 }//close start relative mode timer
1254 
1255 Recording(string instruction)
1256 {   //turns recording on or off based on the instruction
1257     if (instruction == "On")
1258     {   //come here if recording instruction is on
1259         allowPosRecording = TRUE; // if the turn on button is pressed in the Recording menu, set the inter to true (on)
1260         MessageRezBoxs("Recording", "On"); //sends message to other rez box's on the sim so they turn recording off
1261         llListenControl (rezBoxChannelListen, TRUE); // turn listening for other rez box on incase recording is enabled on another
1262         llListenControl (rezBoxComsChannelListen, TRUE);//turns on the coms cahannel listener
1263     }//close turn recording on
1264     else if (instruction == "Off")
1265     {   //come here if instruction is off
1266         allowPosRecording = FALSE; // if the turn on button is pressed in the Recording menu, set the inter to false (off)
1267         llListenControl (rezBoxChannelListen, FALSE); //turn off the listener for other rez box's as recording is already now off
1268     }//close turn recording offf
1269     //MessageItems("All", "Recording", instruction, ""); //sends message to all items
1270     MessageFeedback("Recording", instruction); //sends feedback for the instruction
1271     MessageItems("All","Recording", instruction, "");
1272     if (displayHoverText) HoverTextInfo("Settings"); //sends hover text update if needed
1273     if (recallMenu) MainDialogMenu(); //calls the main menu if called from the menu
1274 }//close turn recording on and off
1275 
1276 CheckForDesc()
1277 {//checks to see if a rez box set number is stored in the description, if found it restores and saves it. If no description is present, generate a new box number and save. 
1278     if (llGetObjectDesc() == "")
1279         {//do this if the description is blank
1280             rezBoxSetNo = (integer)(llFrand(-1000000000.0) - 1000000000.0); //generate a new random box set number and save
1281             apiRegionChannelIn = rezBoxSetNo;
1282             apiRegionChannelOut = rezBoxSetNo * -1;
1283             Settings("Save"); //store this number in the rez box description for the future.
1284         }//close if descriptoin is blank    
1285     else Settings("Load");
1286 }//close check for items and description
1287 
1288 CheckForItems()
1289 {//checks to see if there are items in the rez box when its rezzed or the script is started
1290     integer InventoryObjects = llGetInventoryNumber(INVENTORY_OBJECT);
1291     if (!InventoryObjects)
1292     {//do this if no objects found
1293         SetBoxRotationForRecording(); //sets the rotation to <0,0,0>
1294         RezModeDialogMenu(); //sends the rez mode menu to the user
1295         Recording("On"); //turns recording on
1296     }//close if no items in the invnetory
1297     else
1298     {//do this if items are found in the inventory
1299         Recording("Off"); //turns recording off
1300         if (chatFeedback) llOwnerSay("Rez Box contains items already, Position recording is disabled. You can turn it back on in the menu."); //advise the owner of status
1301     }//close if item has objects in when rezzed or script dropped
1302 }//close check for items in rez box when first starting up or being rezzed
1303 
1304 CheckForExistingScript()
1305 {   //checks to see if another copy of this script alreayd exists, if it does remove it. 
1306     string name = llGetScriptName(); // gets the current script name
1307     integer length = llStringLength(name); // how many charcters are in this script name
1308     string lastTwoChars = llGetSubString(name, -2 ,-1); // finds the last two characters in the name
1309     if (lastTwoChars == " 1" ) 
1310     {   // come here if the name ends with a space then the number 1 (like its been auto adjusted due to a duplicate name already existing)
1311         string mainScriptName = llGetSubString(name, 0,length-3); //get the script name without the space and 1 at the end
1312         integer check = llGetInventoryType(mainScriptName); //gets the inventory type of an item with name minus the tail if it exists
1313         if (check == INVENTORY_SCRIPT) 
1314         {   //come here if a script matching the name without the tail exists come here
1315             llRemoveInventory(mainScriptName); //remove the old script
1316             llOwnerSay("Duplicate script detected and removed");
1317         }//close if duplicate exists
1318     }//close if this script name ends in " 1"
1319     integer numScripts = llGetInventoryNumber(INVENTORY_SCRIPT); //get the number of scripts in the item after the above check
1320     if ( numScripts > 1)
1321     {   //come here if there are still multiple scripts in the item
1322         integer scriptIndex;
1323         for (scriptIndex = numScripts-1; scriptIndex >=0; --scriptIndex)
1324         {   //loop through all scripts in this object in reverse order so if removing we don't get adujust index issues 
1325             string currentScriptName = llGetInventoryName(INVENTORY_SCRIPT, scriptIndex); //gets the name of the current script index
1326             if (currentScriptName != name)
1327             {   //come here if we are not checking this script!. (Dont remove this script)
1328                 integer isDuplicate = contains(currentScriptName, name); 
1329                 //returns true if the name of this script is contained inside the name of the script we are checking
1330                 //eg this script is "MainScript" and the script we are checking is "MainScript 1"
1331                 if (isDuplicate) 
1332                 {   //come here if the found script is a duplicate of this script
1333                     llRemoveInventory(currentScriptName); //remove the duplicate script
1334                     llOwnerSay("Duplicate script detected and removed");
1335                 }//close if script is a duplicte
1336             }//close if we are dealing with a script other than this script 
1337         }//close loop through scripts in the object
1338     }//close if we still have more than 1 script in the objevt 
1339 }//close check for existing script
1340 
1341 default
1342 {    
1343     changed(integer change)
1344     {// if the region has restarted set Box number from description
1345      //if the owner has changed reset the script. 
1346         if (change & CHANGED_REGION_START) CheckForDesc();//if region has been restarted set the box number from the description
1347         if (change & CHANGED_OWNER) llResetScript();//if we hace changed owners ensure the script is reset. 
1348         if (change & CHANGED_INVENTORY)
1349         {   //come here if display hover text is turned on
1350             if (displayHoverText) HoverTextInfo("Contents");
1351         }//close if inventory has changed
1352     }//close changed event
1353     
1354     on_rez (integer rezCount)
1355     {//check the script is in the root prim, ensure its rotated to 0,0,0 and then act accordingly.
1356         llResetScript();
1357     }//close on rez
1358     
1359     state_entry()
1360     {//this is done when the script starts, sets up listeners, records the current position and rotation as well as setting a new set number. 
1361         CheckForExistingScript();
1362         CheckForDesc(); // call check rez box's descriptoin for previously saved set number
1363         SetUpListeners(); //cal set up listeners
1364         CheckForItems(); //call check for items in the inventory
1365         RecordCurrentPosRot(); //call record position and rotation
1366         dynamicMenuButtonNumbers = []; //clears the dynamic numbers list
1367         currentPageNumber = 0; //sets the page number to 0 when the script is frist run 
1368     }//close state entry
1369     
1370     touch_start(integer dont_care)
1371     { //detecs touches and checks to see if its the owner, then launches the main menu if it is. 
1372         if (llDetectedKey(0) == llGetOwner() && dialogMenu) MainDialogMenu();
1373         //if the rez box is touched, check its the owner and popup the menu, ignore anyone else
1374     }//close touch start
1375     
1376     listen(integer channel, string name, key id, string message)
1377     {//listens on the set channels, then depending on the heard channel sends the message for processing. 
1378         if (llGetOwner() == llGetOwnerKey(id) && id != llGetKey())
1379         {
1380             if (channel == rezBoxComsChannel) 
1381                 {
1382                     ProcessItemMessage(id, message);//if messages heard on coms channel call the process items messages
1383                 }
1384             else if (channel == mainMenuChannel) ProcessMainMenuResponse(id, message); //if coms heard on the menu channel (menu button pressed) pass to process menu response
1385             else if (channel == rezBoxChannel) 
1386             {
1387                 ProcessRezBoxMessage(id, message);
1388             }
1389             else if (channel == dynamicMenuChannel) ProcessDynamicMenuResponse(id, message);
1390             else if (channel == textBoxChannel) ProcessTextBoxResponse(id, message);
1391             else if (channel == apiRegionChannelIn) ProcessApiMessage(message);
1392         } //close if sending object is owned by the same person
1393     }//close listen 
1394     
1395     link_message(integer sender_num, integer num, string msg, key msg2)
1396     { // listens for messages from other scripts in this object
1397         if (num == rezBoxSetNo && apiLinkedMessage)
1398         {   //only process if the number matches the one above
1399             ProcessApiMessage(msg);
1400         }//close if number matches
1401     }//close linked messages
1402     
1403     timer()
1404     {//check position and rotation of the rezzer box while items are rezzed
1405         ++timerCount;
1406         if (!itemsRezzed) llSetTimerEvent(0); //should never happen but if we get here and nothings rezzed stop the timmer.
1407         if ((llGetPos() != currentPos) || (llGetRot() != currentRot)) //check to see if we have moved or rotated
1408         {//do this if the rez box has moved
1409             currentPos = llGetPos(); //saves new position
1410             currentRot = llGetRot(); //saves new rotation
1411             string data = GenUpdatePosDataString();
1412             //string data = (string)currentPos + "," +  (string)currentRot + "," + (string)relativePos + "," + (string)autoPickup;
1413             timerCount = 0;
1414             MessageItems("All", "UpdatePosRot", data, "");
1415         }//close if box has moved
1416         if (timerCount >= 18000)
1417         {   //more than 30 mins has elapsed since items were rezzed or items were moved. 
1418             //Set absolute positioning and send warning if feedback is on
1419             MessageFeedback("RelativeModeTimeOut", "SetAbsoluteMode");
1420             PositioningMode("Absolute");
1421         }//close if timer count is more than 30 mins. 
1422     }//close timer
1423     
1424 }//close default state
1425 
1426 /*
1427 Covey Rez Pro System - Control Script
1428 =====================================
1429 Full instructions in the accompanying notecard
1430 *//*

Items Script

  1 /*
  2 Covey Rez Pro System  - Items Script
  3 ====================================   
  4 --------------------------------------------------------------------------
  5 Do not adjust settings below this line unless you know what you are doing!
  6 -------------------------------------------------------------------------- 
  7 */   
  8 integer simSize; //integer derived from getsimsize vector to store the size of the sim. 
  9 integer recordingAllowed = FALSE; //used to determine if the menu is turned on. If recording is disabled the menu couldn't do anything anyway
 10 integer autoPickup = TRUE; //if this is TRUE and a record position is requested items will attach to the avatar afterwards
 11 integer phantomFixDone = FALSE;
 12 integer underGroundMovement = FALSE; // if set to true, items will attempt to move underground
 13 integer relativePos = TRUE;  // turned on or off. If relative rez mode then this is TRUE. If its absolute this is FALSE
 14 integer phantom = FALSE; // used to store the phantom status of the object when recorded
 15 vector originalPos; //this items original position when recorded
 16 rotation originalRot; //this items original rotation when recorded
 17 vector relativeMove; //displacement vector for this item relative to the rez box
 18 rotation relativeRot; //rotation of this item relative to the rez box
 19 vector origRezBoxPos; //orinal rez box position when item was recorded
 20 rotation origRezBoxRot; //original rez box rotation when item was recorded
 21 vector newRezBoxPos; //new position sent from rez box
 22 rotation newRezBoxRot; //new rot sent from rez box
 23 vector endPos; //end position after movement
 24 rotation endRot; //end rotation after movement
 25 integer rezBoxSetNumber; //rez box set number
 26 integer stopForRezLimit = FALSE;
 27 integer rezBoxComsChannel = -83654729;
 28 integer itemsComsChannel = -83654730;
 29 integer itemsComsChannelListen;
 30 
 31 integer mainMenuChannel; //menu channel
 32 integer mainMenuChannelListen; //listener switch for the menu channel
 33 integer seriousWarning = FALSE; //serious warning flag, auto pickup will be disabled if this is set
 34 key rezBoxUUID;
 35 
 36 SetUpListeners()
 37 {   //sets up all the listeners 
 38     mainMenuChannel = (integer)(llFrand(-1000000000.0) - 1000000000.0); 
 39     mainMenuChannelListen = llListen(mainMenuChannel, "", NULL_KEY, ""); 
 40     itemsComsChannelListen = llListen(itemsComsChannel, "", NULL_KEY, ""); 
 41     llListenControl (itemsComsChannelListen, TRUE); 
 42     llListenControl (mainMenuChannelListen, FALSE); 
 43 }//close setup listeners
 44 
 45 ProcessRezBoxMessage(key listenRecievedKey, string listenRecievedMessage)
 46 {   //processes all messages from rez box's
 47     integer colonSeperator = llSubStringIndex(listenRecievedMessage, ":"); 
 48     string numberInstruction = llGetSubString(listenRecievedMessage, 0, colonSeperator-1); 
 49     string data = llGetSubString (listenRecievedMessage, colonSeperator+1, -1 ); 
 50     list rezBoxInstructions = llCSV2List(numberInstruction); 
 51     integer recievedRezBoxSetNumber = llList2Integer(rezBoxInstructions, 0);
 52     string instructionType = llList2String(rezBoxInstructions,1); 
 53     if (instructionType == "RezBoxData") RezBoxData(data); //no known rez box at this point...
 54     else if (instructionType == "TestRecordedItems") TestRecorded(data);
 55     else
 56     {   //come here for everything except rez box data
 57         if (recievedRezBoxSetNumber == rezBoxSetNumber)
 58         {   //come here if the rez box number given matches our rez box
 59             if (instructionType == "DeRezItems") llDie(); 
 60             else if (instructionType == "FinaliseItems") FinaliseItems(); 
 61             else if (instructionType == "Rez") 
 62                 {
 63                     MoveIntoPositon(data); 
 64                 }
 65             else if (instructionType == "PrepReRecord") PrepReRecord(); 
 66             else if (instructionType == "UpdatePosRot") MoveIntoPositon(data); 
 67             else if (instructionType == "ReRecordAllItems") ReRecordAllItems();
 68             else if (instructionType == "DeRezSingleItem") DeRezSingleItem(data); 
 69             else if (instructionType == "Recording") MenuOnOff(data);
 70             else if (instructionType == "ItemPickup") ItemPickup(data);
 71             else if (instructionType == "UnderGroundMovement") UnderGroundMovement(data);
 72             else if (instructionType == "PrepItemBoxExchange") PrepItemBoxExchange();
 73             else if (instructionType == "ItemPositionRequest") SendPositionToRezBox(listenRecievedKey);
 74             else if (instructionType == "RezCheck") RezPosCheck();
 75         }//close if rez box number matches the one provided by the rez box
 76     }//close if instruction is not rez box data
 77 }//close process rez box message
 78 
 79 TestRecorded(string data)
 80 {   //moves itens up 500m if test recorded is On
 81     //moves them back to the original position if test record is off
 82     integer extrasCardType = llGetInventoryType(".ExtraInfo");
 83     if (extrasCardType == INVENTORY_NONE) 
 84     {   //because we can't check a box number at this stage we filter by the presence of the extras card
 85         //if not extras card exists this is a fresh set not one rezzed from the box (excluding later prep re-record)
 86         if (data == "On") 
 87         {   //turns on testing flag and moves items up 500m
 88             endPos =  originalPos + <0,0, 500>; //sets the testing possition
 89             endRot =  originalRot;//sets the rotation
 90         }//close send testing positions and flag
 91         else if (data == "Off") 
 92         {   //sets the testing flag to off and the move position to the original pos
 93             endPos =  originalPos; //sets the end position to the original position
 94             endRot =  originalRot;//sets the rotation
 95         }//close if data is off
 96         StartMove("Testing"); //moves the items to the set position
 97     } //close if extras card does not exist
 98 }//close test record 
 99 
100 integer contains(string haystack, string needle) 
101 {   //returns true if a needle is found inside the heystack 
102     return ~llSubStringIndex(haystack, needle); //returns integer
103 }// close contains
104  
105 CheckForExistingScript()
106 {   //checks to see if another copy of this script alreayd exists, if it does remove it. 
107     string name = llGetScriptName(); // gets the current script name
108     integer length = llStringLength(name); // how many charcters are in this script name
109     string lastTwoChars = llGetSubString(name, -2 ,-1); // finds the last two characters in the name
110     if (lastTwoChars == " 1" ) 
111     {   // come here if the name ends with a space then the number 1 (like its been auto adjusted due to a duplicate name already existing)
112         string mainScriptName = llGetSubString(name, 0,length-3); //get the script name without the space and 1 at the end
113         integer check = llGetInventoryType(mainScriptName); //gets the inventory type of an item with name minus the tail if it exists
114         if (check == INVENTORY_SCRIPT) 
115         {   //come here if a script matching the name without the tail exists come here
116             llRemoveInventory(mainScriptName); //remove the old script
117             llOwnerSay("Duplicate script detected and removed");
118         }//close if duplicate exists
119     }//close if this script name ends in " 1"
120     integer numScripts = llGetInventoryNumber(INVENTORY_SCRIPT); //get the number of scripts in the item after the above check
121     if ( numScripts > 1)
122     {   //come here if there are still multiple scripts in the item
123         integer scriptIndex;
124         for (scriptIndex = numScripts-1; scriptIndex >=0; --scriptIndex)
125         {   //loop through all scripts in this object in reverse order so if removing we don't get adujust index issues 
126             string currentScriptName = llGetInventoryName(INVENTORY_SCRIPT, scriptIndex); //gets the name of the current script index
127             if (currentScriptName != name)
128             {   //come here if we are not checking this script!. (Dont remove this script)
129                 integer isDuplicate = contains(currentScriptName, name); 
130                 //returns true if the name of this script is contained inside the name of the script we are checking
131                 //eg this script is "MainScript" and the script we are checking is "MainScript 1"
132                 if (isDuplicate) 
133                 {   //come here if the found script is a duplicate of this script
134                     llRemoveInventory(currentScriptName); //remove the duplicate script
135                     llOwnerSay("Duplicate script detected and removed");
136                 }//close if script is a duplicte
137             }//close if we are dealing with a script other than this script 
138         }//close loop through scripts in the object
139     }//close if we still have more than 1 script in the objevt 
140 }//close check for existing script
141 
142 MenuOnOff(string instruction)
143 {   //turns the menu on and off based on the instruction
144     if (instruction == "On")
145     {   //turns the menu on
146         recordingAllowed = TRUE;
147         llListenControl (mainMenuChannelListen, TRUE); 
148     }//close turn on menu
149     else if (instruction == "Off")
150     {   //turns the menu off
151         recordingAllowed = FALSE;
152         llListenControl (mainMenuChannelListen, FALSE); 
153     }//close turn off menu
154 }//close menu on and off
155 
156 SetPosInfo()
157 {   //sets the original item information ready for saving
158     originalPos = llGetPos(); //gets the position
159     originalRot = llGetRot(); //gets the rotation
160     list objectPhantomDetails = llGetObjectDetails(llGetKey(), [PRIM_PHANTOM]); //checks the itens phantom status
161     integer phantom = llGetStatus(STATUS_PHANTOM); //stores the phantom status
162     float GroundHeight = llGround(originalPos); //checks the ground height at items positon
163     if (originalPos.z < GroundHeight) SeriousWarning(); //sends a warning if item is below ground
164     else seriousWarning = FALSE; // ensures warning flag is turned off incase this is a re-record
165     llRegionSay(rezBoxComsChannel, "OrigRezBoxPositionRequest" + "," + (string)llGetKey() + "," + (string)llGetOwner()); //messages the rez box
166 }//close set pos info
167 
168 SendPositionToRezBox(key rezBoxUUID)
169 {   //send the current position to the requesting rez box
170     string itemPos = (string)llGetPos();
171     llRegionSayTo(rezBoxUUID, rezBoxComsChannel, "ItemPosition" + "," + itemPos); 
172 }//close send position to rez box. 
173  
174 SeriousWarning()
175 {   //issues a warning in chat and dialog menu and turns off auot pickup
176     list buttons = ["Ok"]; // buttons in menu
177     string message = "Restoring to this position may fail. It may also permanantly corrupt your sim. It is STRONGLY recomended that you attach another link as the root object which is above ground height. If you do not have an OAR to restore this region DO! NOT! restore items to this position! Auto pickup disabled to give you time to fix this. "; //message to send
178     llOwnerSay (message); // warning in local chat
179     llDialog (llGetOwner(), message, buttons, mainMenuChannel); //warning dialog menu
180     autoPickup = FALSE; //turns off auto pickup
181     seriousWarning = TRUE; //sets serious warning flag
182 } //close serious warning
183 
184 CheckSettingsCardExists()
185 {   //checks to see if settings card exists before attaching or telling the user the item is ready to pickup   
186     if (seriousWarning) autoPickup = FALSE; //ensures that if serious warning is flagged auto pickup is disabled
187     integer check = llGetInventoryType(".SavedSettings"); //gets the inventory type of the settings card
188     if (check == INVENTORY_NONE) CheckSettingsCardExists(); //if the item doesn't exist check again
189     else 
190     {   //come here if the settings card is found
191         if (autoPickup) AttachToAvatar();  //if auto pickup is enabled attaches item to the avatar
192         else llOwnerSay("All positions and rotations have been saved in a notecard inside the items inventory. Please now take this item to your inventory and then drop it into the Rez Box. "); // if auto pickup is disabled, sends message to user saying item is ready to pickup
193     }//close if settings card exists 
194 }//close check if settings card exists
195 
196 CheckExtrasCardExists()
197 {   //checks to see if extras card exists. If it does this is not a first rez from the box
198     integer check = llGetInventoryType(".ExtraInfo");
199     if (check == INVENTORY_NOTECARD)
200     {   //come here if the extras card exists (not first rez from box)
201         MenuOnOff("Off"); // turns off the menu
202         ReadConfigCards(".ExtraInfo"); //reads the extras card
203     }//close if settings card exists
204     else 
205     {   //this is the first rez from the box, enables the update menu
206         MenuOnOff("On"); //turns on the menu
207     }//
208 }//close check if extras card exists
209 
210 AttachToAvatar()
211 {   //force attaches item to avatar then calls detach
212     osForceAttachToAvatar(ATTACH_CHEST); //force attaches to avatar
213     DetachFromAvatar(); //detaches from avatar
214 }//close attach to avatar
215 
216 DetachFromAvatar()
217 {   //detaches the item from the avatar if its attached
218     integer attached = llGetAttached(); //gets attacment status
219     if (attached) llRequestPermissions(llGetOwner(), PERMISSION_ATTACH ); //if attached calls detach
220     else AttachToAvatar(); //if we are not already attached, calls attach again as we should be attached now!
221 }//close detach fromn avatar
222 
223 RezBoxData(string data)
224 {   //process rez box data sent from rez box and stores it   
225     list information = llCSV2List (data); 
226     origRezBoxPos = llList2Vector(information, 0);
227     origRezBoxRot = llList2Rot(information,1);
228     relativePos = llList2Integer(information, 2);
229     autoPickup = llList2Integer(information, 3);
230     underGroundMovement = llList2Integer(information, 4); 
231     relativeMove = origRezBoxPos-originalPos; //calculates the relative move
232     relativeRot = origRezBoxRot/originalRot; //calcuates the relative rotation
233     if (seriousWarning) autoPickup = FALSE; //ensures if underground no auto pickup is allowed
234     SaveSettings(); //saves the settings card
235 }//close rez box data
236 
237 FinaliseItems()
238 {   //removes settings and scripts
239     PrepReRecord(); //removes settings cards
240     llRemoveInventory(llGetScriptName()); //removes the script
241 }//close finalise items
242 
243 ReRecordAllItems()
244 {   //removes the settings cards and resets the script (like dropping a script in a fresh item)
245     PrepReRecord(); // removes settings cards
246     llResetScript(); //reset the script
247 }//close re-record items
248 
249 DeRezSingleItem(string name)
250 {   // if this object name matches the one sent, remove this object   
251     if (name == llGetObjectName() ) llDie(); 
252 }//close de-rez single item
253 
254 ItemPickup(string data)
255 {   //if auto pickup is changed by the box update according in this objevt
256     //this will be over written if we are in a serious warning state
257     if (data == "Auto") autoPickup = TRUE;
258     else if (data == "Manual") autoPickup = FALSE;
259 }//close item pickup mode
260 
261 CalcFinalPosRot()
262 {   //calculates the position to move this iten to
263     if (relativePos) 
264     {   //come here if relative positioning is enabled
265         endPos = newRezBoxPos - relativeMove*newRezBoxRot; 
266         endRot = originalRot * newRezBoxRot; 
267     }//close if relative positioning
268     else
269     {   //come here if absolute positioning is enabled
270         endPos = originalPos; 
271         endRot = originalRot; 
272     }//close if absolute positioning
273     CheckRezLimits(); //ensure we are allowed to move to the calculated place
274 }//close check final pos/rot
275 
276 CheckRezLimits()
277 {   //checks to make sure that moving to the requested position is possible
278     float GroundHeight = llGround(endPos-llGetPos() ); //checks the ground height at the target position
279     if (!underGroundMovement)
280     {   //come here if underground movement is turned off, do checks including ground position
281         if ((GroundHeight < endPos.z) &&  (endPos.z < 10000) && (endPos.y < simSize) && (endPos.x < simSize)) 
282         {   // if target position is inside the sim bround, above ground and less than 10km high
283             StartMove("Normal"); //starts the movement
284         }//close if movement is not trying to go under ground
285         else 
286         {   //sends warning that includes ground height check
287             stopForRezLimit = TRUE;
288             llOwnerSay ("Sorry i can not move there its outside the allowed rez limits." + " \n" + 
289                 "Attempted Rez Position = " + (string)endPos + " (x,y,z)" + "\n" + 
290                 "Rez Limits are " + (string)simSize + " in both the X and Y axis. Then in Z you can not rez over 10km or below ground" );
291         }//close if movement would go outside the limits
292     }//close if underground movement is off
293     else
294     {   //underground movement is enabled, do checks without ground position
295         if ((endPos.z < 10000) && (endPos.y < simSize) && (endPos.x < simSize)) 
296         {   //if the target position is inside the sim broundies and below 10km high 
297             StartMove("Normal"); //starts movement
298         }//close if inside rez limits
299         else  
300         {   //send warning but don't mention ground as underground movemnt is on
301             stopForRezLimit = TRUE;
302             llOwnerSay ("Sorry i can not move there its outside the allowed rez limits." + " \n" + 
303             "Attempted Rez Position = " + (string)endPos + " (x,y,z)" + "\n" + 
304             "Rez Limits are " + (string)simSize + " in both the X and Y axis. Then in Z you can not rez over 10km." );
305         }//close else outside rez limits
306     }//close if underground movement is on
307 }//close check rez limits
308 
309 StartMove(string moveReason)
310 {   //moves the object into position
311     llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_ROTATION, endRot]); //rotates the object to desired roation
312     if (endPos.z < 4096)
313     {   //if end position is less than 4096m high use set region position to save sim resources 
314         llSetRegionPos(endPos); //moves the item close to final target
315         if (llGetPos() != endPos) llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_POSITION, endPos]); //finishes the movement making it exact
316     }//close if final position is under 4096, high 
317     else
318     {   //final position is above 4096m, set region pos will fail so we must do a loop with set primitive parans fast
319         float distanceFromTarget = llVecDist(llGetPos(), endPos); //caclulate how far we are from the end position
320         while (distanceFromTarget >= 10)
321         {   //if we are more than 10m from the target come here 
322             llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_POSITION, endPos]); //moves the item towards its target by upto 10m
323             distanceFromTarget = llVecDist(llGetPos(), endPos); //calculates the distance from target again now. 
324         }
325         llSetLinkPrimitiveParamsFast(llGetLinkNumber(), [PRIM_POSITION, endPos]); // sets the final position as its less than 10m away
326     }//close if final position is above 4096m high
327     if (seriousWarning) autoPickup = FALSE; //ensures auto pickup is disabled if serious warning is flagged
328     if (moveReason != "Testing") 
329     {
330         SaveExtraInfoCard(); //saves the extra info settings card incase of script resets unless testing mode is on. 
331         integer timeSpan = random_integer(10, 30);
332         if (!stopForRezLimit) llSetTimerEvent((float)timeSpan);
333     }
334     
335 }//close move item into place
336 
337 integer random_integer(integer min, integer max)
338 {
339     return min + (integer)(llFrand(max - min + 1));
340 }
341 
342 SetPhantomStatus()
343 {   //Works around phantom bug after attachment, forces the phantom status to its opposite setting and back again
344     if (!phantom) 
345     {   // if the item was originally solid, set it phantom and then back to solid
346         llSetStatus (PRIM_PHANTOM, TRUE); //sets status to phantom
347         llSetStatus (PRIM_PHANTOM, FALSE); //sets status to solid
348         phantomFixDone = TRUE;
349         SaveExtraInfoCard();
350     }    //close if original status of the item was solid
351 }//close set phanton status. 
352 
353 SaveSettings()
354 {   //saves the settings card
355     if (llGetInventoryType(".SavedSettings") == INVENTORY_NOTECARD) llRemoveInventory(".SavedSettings"); //if a card already exists remove it
356     list savedSettings = [originalPos, originalRot, origRezBoxPos, origRezBoxRot, relativePos, autoPickup, underGroundMovement, phantom, phantomFixDone]; //makes the list to save
357     osMakeNotecard(".SavedSettings", savedSettings); //writes the settings notecard
358     CheckSettingsCardExists(); //checks to make sure the card is written
359 }//close save settings
360 
361 SaveExtraInfoCard()
362 {   //saves the extra info card, used to restore the settings if the script is reset
363     if (seriousWarning) autoPickup = FALSE; //ensures if we are in a serious warning state that auto pickup is disabled
364     list settingsToSave = [rezBoxSetNumber, recordingAllowed, relativePos, autoPickup, underGroundMovement, phantom, phantomFixDone]; //makes list to save
365     if (llGetInventoryType(".ExtraInfo") == INVENTORY_NOTECARD) llRemoveInventory(".ExtraInfo"); //if an extra info card already exists remove it
366     osMakeNotecard(".ExtraInfo", settingsToSave); //saves the new card
367 }//close save extra info card
368 
369 ProcessMenuResponse(key listenRecievedKey, string listenRecievedMessage)
370 {   // processes response to the menu 
371     if (llGetOwnerKey(listenRecievedKey) == llGetOwner()) 
372     {   //come here if the user is the owner
373         if (listenRecievedMessage == "Update") SetPosInfo();  //updates the position information for this item
374     }//close if its the owner trying to use this item
375 }//close process menu response
376 
377 SetsimSize()
378 {   //gets the size of the current region
379     vector simSizeVec = osGetRegionSize(); //get sim size vector
380     simSize = (integer)simSizeVec.x; // save integer from vector
381 }//close set sim size
382 
383 PrepReRecord()
384 {   //remove the settings cards   
385     llRemoveInventory(".ExtraInfo"); 
386     llRemoveInventory(".SavedSettings"); 
387 }//close prep re-record
388 
389 MoveIntoPositon(string data)
390 {   //process a move to given position request from the box   
391     list information = llCSV2List (data); 
392     newRezBoxPos = llList2Vector(information, 0);
393     newRezBoxRot = llList2Rot(information, 1);
394     relativePos = llList2Integer(information, 2);
395     autoPickup = llList2Integer(information, 3);
396     underGroundMovement = llList2Integer(information, 4);
397     if (seriousWarning) autoPickup = FALSE;
398     CalcFinalPosRot(); //calculate the new position based on the supplied information
399 }//close move into position
400 
401 PrepItemBoxExchange()
402 {   //removes the exta info card allowing an item to be moved between rez boxes
403     llRemoveInventory(".ExtraInfo");
404     llOwnerSay("Is Ready to be picked up and transfered to a new box");
405 }//close prep item for box exchange
406 
407 UnderGroundMovement(string data)
408 {   //turn undergrond movement on or off based on the rez box instruction
409     if (data == "On") underGroundMovement = TRUE; //turn on underground movement
410     else if (data == "Off")underGroundMovement = FALSE; //turn off underground movement
411     if (seriousWarning) autoPickup = FALSE; // if we are in a serious warning state ensure auto pickup is off
412     SaveExtraInfoCard();//save the extra info card
413 }//close underground movement
414 
415 ReadConfigCards(string notecardName)
416 {   //reads and processes the settings cards   
417     integer notecardNameType = llGetInventoryType(notecardName); //gets the item type for the requested name
418     if (notecardNameType == INVENTORY_NOTECARD)
419     {   //come here if the requested notecard exists
420         integer notecardLength = osGetNumberOfNotecardLines(notecardName); //get the length of the notecard
421         list notecardContents = []; //define contents list and ensure its empty.
422         integer lineIndex;
423         for (lineIndex = 0; lineIndex < notecardLength; ++lineIndex)
424         {   //loops through the notecard line by line
425             notecardContents += osGetNotecardLine(notecardName, lineIndex); //add each line found to the list
426             //don't care about extra lines added at the end by osMakeNotecard as they are ignored later
427             //notecards saved by a script, so don't check for user errors
428         }//close loop through notecard
429         if (notecardName == ".ExtraInfo")
430         {   //come here if we are processing the extra info card (scripts have been reset while the iten is rezzed from the box)
431             //protection against scripts being disabled at estate level and then re-enabled
432             rezBoxSetNumber = llList2Integer(notecardContents,0);
433             recordingAllowed = llList2Integer(notecardContents,1);
434             relativePos = llList2Integer(notecardContents,2);
435             autoPickup = llList2Integer(notecardContents, 3);
436             underGroundMovement = llList2Integer(notecardContents, 4);
437             phantom = llList2Integer(notecardContents, 5);
438             phantomFixDone = llList2Integer(notecardContents, 6);
439         }//close process extra info card
440         else if (notecardName == ".SavedSettings") 
441         {   //come here if we are reading the saved settings card
442             //happens when the item is rezzed from the box
443             originalPos = llList2Vector(notecardContents, 0); 
444             originalRot = llList2Rot(notecardContents, 1); 
445             origRezBoxPos = llList2Vector(notecardContents, 2); 
446             relativePos = llList2Integer(notecardContents, 3);
447             autoPickup = llList2Integer(notecardContents, 4); 
448             underGroundMovement = llList2Integer(notecardContents, 5);
449             phantom = llList2Integer (notecardContents, 6);
450             phantomFixDone = llList2Integer (notecardContents, 7);
451         }//close read settings card
452         if (seriousWarning) autoPickup = FALSE; //if we are in a serious warning state ensure auto pickup is off
453     }//close if the requested notecard exists
454     else 
455     {   //come here if the requested notecard name is not found
456         llOwnerSay ("The notecard called " + notecardName + " is missing, did you remove it?"); //send warning to the user
457     }//close if the requested notecard is not found
458 }//close read settings card
459 
460 CheckForCopyPremissions()
461 {   //checks to make sure the item has copy permisiosn for its owner. If not warns and removes the items script
462     integer ownerPerms = llGetObjectPermMask( MASK_OWNER );
463     integer copyPerms = PERM_COPY;
464     if (! (ownerPerms & copyPerms)) 
465     {   //come here if we do not have cvopy permissions
466         llOwnerSay("You do not have copy permisions on this object. Packing it would likely mean you permanantly loosing it. Recording stoped. Removing this script.");
467         llRemoveInventory(llGetScriptName()); //removes the script
468     }//close if not copy permissions
469 }//close check for copy permissiosn
470 
471 RezPosCheck()
472 {
473     float distanceFromTarget = llVecDist(llGetPos(), endPos); //caclulate how far we are from the end position
474     if (distanceFromTarget >= 0.01) CheckRezLimits();
475     else 
476     {
477         llSetTimerEvent(0);
478         if (autoPickup && !phantomFixDone) SetPhantomStatus();
479     }
480 }
481 
482 
483 default
484 {   //start of the default state when script first starts 
485     on_rez (integer boxNoFromRezBox)
486     {   //do this if the iten is rezzed
487         SetsimSize(); //gets the current sim siz
488         rezBoxSetNumber = boxNoFromRezBox; //saves the rez box number we were rezzed from
489         if(llGetLinkNumber() > 1) llOwnerSay("Script Only Works In The Root Prim, please place me there");
490         if (rezBoxSetNumber == 0) SetPosInfo(); //do this if there is no rez box number 
491         else  
492         {   //read the settings card and turn the menu off
493             rezBoxUUID = osGetRezzingObject();
494             ReadConfigCards(".SavedSettings"); //read saved settings card
495             MenuOnOff("Off"); //turn the menu off
496             llRegionSayTo(rezBoxUUID ,rezBoxComsChannel, "RezedFromBox" + "," + (string)rezBoxSetNumber); 
497         }
498     }//close on rez
499     
500     changed(integer change) 
501     {   //come here if the link is changed
502         if(change & CHANGED_LINK && llGetLinkNumber() > 1) llOwnerSay("This script will only work in the root prim, please place it there");
503     }//close changed
504      
505     state_entry()
506     {   //do this once when the script first starts
507         CheckForExistingScript(); //checks to see if there is a duplicate to this script and removes if there is
508         CheckForCopyPremissions();//checks to make sure the item has copy permissions
509         SetUpListeners(); //sets up the listeners
510         CheckExtrasCardExists(); //checks for extra info card and restores settings if found
511         SetsimSize(); //sets the sim size
512         if (rezBoxSetNumber == 0) SetPosInfo(); //if there is no rez box nunber its a fresh drop, set pos info
513         else  
514         {   //this item has been rezzed from the box,  
515             ReadConfigCards(".SavedSettings"); //read the settings card
516             MenuOnOff("Off"); //turn the menu off
517         }//close if rezzed from box
518     }//close state entry
519      
520     /*
521     REMOVED DUE TO BUG IN OS 0.9.0.1!!!!
522     ======================================
523     touch_start(integer dont_care)
524     {   //do this if the iten is clicked
525         if (llDetectedKey(0) == llGetOwner() && recordingAllowed) 
526         {   //only do this if the itenms owner is clicking
527             list mainMenuList = ["Update"]; 
528             llDialog(llDetectedKey(0), "Please Make your selection", mainMenuList , mainMenuChannel); 
529         }//close if toucher is owner
530     }//close touch start
531     */
532      
533     listen(integer channel, string name, key id, string message)
534     {   //listens for messages based on the listeners defined
535         if (llGetOwnerKey(id) == llGetOwner() && id != llGetKey())
536         {   //only process messages if the sending item is owned by the my owner
537             
538             if (channel == itemsComsChannel) 
539             {
540                 ProcessRezBoxMessage(id, message); //process coms channel messages from rez box
541             }
542             if (channel == mainMenuChannel) ProcessMenuResponse(id, message); //process menu chanel messages from  my owner
543         }//close if user is our owner
544     }//close listen
545     
546     run_time_permissions(integer perm)
547     {   //called if permissions are requested 
548         if(perm & PERMISSION_ATTACH)
549         {   //if attach permision requested
550             llDetachFromAvatar( ); //detach from avatar
551         }//close if attach permisions requested
552     }//close runtime
553     
554     timer()
555     {
556         RezPosCheck();
557     }
558 }//close default
559 
560 /*
561 Covey Rez Pro System  - Items Script
562 ==================================== 
563 */

Rezzer Script

  1 /*
  2 Covey Rez Pro System - Rezzor Script
  3 ====================================
  4 --------------------------------------------------------------------------
  5 Do not adjust settings below this line unless you know what you are doing!
  6 --------------------------------------------------------------------------
  7 */ 
  8 integer itemsComsChannel = -83654730; 
  9 integer rezBoxSetNo; //sent from main script and recieved by linked messages
 10 string instruction; //instruction recieved via linked messages
 11 integer chatFeedback = TRUE; //used to decide if feedback is given in local chat
 12 
 13 integer contains(string haystack, string needle) 
 14 {   //returns true if a needle is found inside the heystack 
 15     return ~llSubStringIndex(haystack, needle); //returns integer
 16 }// close contains
 17 
 18 MessageItems(string which, string instruction, string data, key UUID)
 19 {   //sends a message to all items or a single item depending on the "which" string
 20     string toSend = (string)rezBoxSetNo + "," + instruction + ":" + data;
 21     if (which == "All") llRegionSay(itemsComsChannel, toSend); //send message to all items
 22     else if (which == "SingleItem") llRegionSayTo(UUID, itemsComsChannel, toSend); //send message to specific item
 23 }//closwe message items
 24 
 25 RezItems()
 26 {//code to rez the items in the rez box
 27 if (chatFeedback) llOwnerSay("Rezzing has begun, please wait untill it tells you this is complete");
 28 integer rezBoxIndex; //set the counter to 0
 29 integer rezBoxItemCount = llGetInventoryNumber(INVENTORY_OBJECT); //get how many objects are in the rezzor
 30 for (rezBoxIndex = 0; rezBoxIndex < rezBoxItemCount; ++rezBoxIndex)
 31 {
 32     llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT, rezBoxIndex), llGetPos(), ZERO_VECTOR, llGetRot(), rezBoxSetNo);
 33     llSleep(0.1);
 34 }
 35 MessageItems("All", "RezCheck", "", "");
 36 llMessageLinked( LINK_SET, -105145667, "ApiRezzingComplete", llGetOwner() );
 37 if (chatFeedback) llOwnerSay("Rezzing Is Complete, item movement may take a few seconds yet");//report rezzing finished
 38 }//close rez items
 39 
 40 RezSingleItem(string name)
 41 {   //rez the specified item
 42     llRezAtRoot(name, llGetPos(), ZERO_VECTOR, llGetRot(), rezBoxSetNo);
 43 } //closw rez single item
 44 
 45 CheckForExistingScript()
 46 {   //checks to see if another copy of this script alreayd exists, if it does remove it. 
 47     string name = llGetScriptName(); // gets the current script name
 48     integer length = llStringLength(name); // how many charcters are in this script name
 49     string lastTwoChars = llGetSubString(name, -2 ,-1); // finds the last two characters in the name
 50     if (lastTwoChars == " 1" ) 
 51     {   // come here if the name ends with a space then the number 1 (like its been auto adjusted due to a duplicate name already existing)
 52         string mainScriptName = llGetSubString(name, 0,length-3); //get the script name without the space and 1 at the end
 53         integer check = llGetInventoryType(mainScriptName); //gets the inventory type of an item with name minus the tail if it exists
 54         if (check == INVENTORY_SCRIPT) 
 55         {   //come here if a script matching the name without the tail exists come here
 56             llRemoveInventory(mainScriptName); //remove the old script
 57             llOwnerSay("Duplicate script detected and removed");
 58         }//close if duplicate exists
 59     }//close if this script name ends in " 1"
 60     integer numScripts = llGetInventoryNumber(INVENTORY_SCRIPT); //get the number of scripts in the item after the above check
 61     if ( numScripts > 1)
 62     {   //come here if there are still multiple scripts in the item
 63         integer scriptIndex;
 64         for (scriptIndex = numScripts-1; scriptIndex >=0; --scriptIndex)
 65         {   //loop through all scripts in this object in reverse order so if removing we don't get adujust index issues 
 66             string currentScriptName = llGetInventoryName(INVENTORY_SCRIPT, scriptIndex); //gets the name of the current script index
 67             if (currentScriptName != name)
 68             {   //come here if we are not checking this script!. (Dont remove this script)
 69                 integer isDuplicate = contains(currentScriptName, name); 
 70                 //returns true if the name of this script is contained inside the name of the script we are checking
 71                 //eg this script is "MainScript" and the script we are checking is "MainScript 1"
 72                 if (isDuplicate) 
 73                 {   //come here if the found script is a duplicate of this script
 74                     llRemoveInventory(currentScriptName); //remove the duplicate script
 75                     llOwnerSay("Duplicate script detected and removed");
 76                 }//close if script is a duplicte
 77             }//close if we are dealing with a script other than this script 
 78         }//close loop through scripts in the object
 79     }//close if we still have more than 1 script in the objevt 
 80 }//close check for existing script
 81 
 82 default
 83 {
 84    state_entry()
 85    {
 86        CheckForExistingScript();
 87    }
 88    
 89    link_message(integer Sender, integer Number, string LnkMsg, key name) // This script is in the object too.
 90     {  //listen for linked messages coming from the control script, break it down into components and save.
 91         if (Number == 10000);
 92         {
 93            list Instructions = llCSV2List(LnkMsg); //make a list from the recieved message which is comma seperated values
 94            instruction = llList2String(Instructions, 0); //save instruction
 95            rezBoxSetNo = llList2Integer(Instructions, 1); //save rez box set number
 96            if (instruction == "RezItems") RezItems(); //check instruction and rez items if told to.  
 97            if (instruction == "RezSingleItem") 
 98            {    // convert the key to a string and call rez single item method
 99                 string nameToRez = (string)name;
100                 RezSingleItem(nameToRez);       
101            }//close rez single item
102            if (instruction == "ChatFeedBack")
103            {    //set the chat feedback to true or false based on the key field
104                if (name == "On") chatFeedback = TRUE;
105                else if (name == "Off") chatFeedback = FALSE;
106            }//close if instruction is chat feeback
107         }//close if number is 100000
108     }//close linked mesage
109 }//close default
110 
111 /*
112 Covey Rez Pro System
113 ===============
114 Full instructions in the accompanying notecard
115 */

Syntax Highlighting

GeShi syntax highlighting is enabled on this wiki. <be>

When using the tabs described in the link, change the language part to "lsl". Eg.
syntaxhighlight lang="lsl" line
inside angled brackets <>