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

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 <>