add partners and builder buddy

This commit is contained in:
Fred Beckhusen
2019-02-27 14:27:09 -06:00
parent ba9767c919
commit 06d613a104
10 changed files with 2676 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<Solution name="BuildersBuddy-Opensim">
<Project name="BuildersBuddy-Opensim" path="BuildersBuddy-Opensim\BuildersBuddy-Opensim.prj" active="true"/>
</Solution>

View File

@@ -0,0 +1,477 @@
// :CATEGORY:Building
// :NAME:Builders Buddy for Opensim
// :AUTHOR:Newfie Pendragon
// :KEYWORDS:Opensim
// :REV:2
// :WORLD:Opensim
// :DESCRIPTION:
// Builders Buddy for Opensim Base Script
// :CODE:
///////////////////////////////////////////////////////////////////////////////
// Builders' Buddy 1.10 (Base Script)
// by Newfie Pendragon, 2006-2008
///////////////////////////////////////////////////////////////////////////////
//
// Script Purpose & Use
// Functions are dependent on the "component script"
//
// QUICK USE:
// - Drop this script in the Base.
// - Drop the "Component" Script in each building part.
// - Touch your Base, and choose RECORD
// - Take all building parts into inventory
// - Drag building parts from inventory into Base Prim
// - Touch your base and choose BUILD
//
// OTHER COMMANDS from the Touch menu
// - To reposition, move/rotate Base Prim choose POSITION
// - To lock into position (removes scripts) choose DONE
// - To delete building pieces: choose CLEAN
///////////////////////////////////////////////////////////////////////////////
// This script is copyrighted material, and has a few (minor) restrictions.
// For complete details, including a revision history, please see
// http://wiki.secondlife.com/wiki/Builders_Buddy
///////////////////////////////////////////////////////////////////////////////
// Channel used by Base Prim to talk to Component Prims
// This channel must be the same one in the component script
// A negative channel is used because it elimited accidental activations
// by an Avatar talking on obscure channels
integer DefaultPRIMCHAN = -120001; // Default channel to use
//integer PRIMCHAN = DefaultPRIMCHAN; // Channel used by Base Prim to talk to Component Prims;
integer PRIMCHAN = -120001; // OpenSim Modification - also comment out the previous line for OpenSim
// ***THIS MUST MATCH IN BOTH SCRIPTS!***
//The UUID of the creator of the object
//Leave this as "" unless SL displays wrong name in object properties
key creatorUUID = "";
// Set to TRUE to allow group members to use the dialog menu
// Set to FALSE to disallow group members from using the dialog menu
integer ingroup = TRUE;
// Set to TRUE to delete piece from inventory when rezzed
// (WARNING) If set to FALSE, user will be able to rez multiple copies
integer deleteOnRez = FALSE;
// Allow non-creator to use CLEAN command?
// (WARNING) If set to TRUE, it is recommended to set
// deleteOnRez to FALSE, or user could lose entire building
integer allowClean = TRUE;
//When user selects CLEAN, delete the base prim too?
integer dieOnClean = FALSE;
// Set to TRUE to record piece's location based on sim
// coordinates instead of relationship to base prim
integer recordSimLocation = FALSE;
// Set to TRUE to rez all building pieces before positioning,
// or FALSE to do (slower?) one at a time
integer bulkBuild = TRUE;
//Set to FALSE if you dont want the script to say anything while 'working'
integer chatty = TRUE;
//How long to listen for a menu response before shutting down the listener
float fListenTime = 30.0;
//How often (in seconds) to perform any timed checks
float fTimerRate = 0.25;
//How long to sit still before exiting active mode
float fStoppedTime = 30.0;
//SL sometimes blocks rezzing to prevent "gray goo" attacks
//How long we wait (seconds) before we assume SL blocked our rez attempt
integer iRezWait = 30;
//Specify which Menu Options will be displayed
//FALSE will restrict full options to creator
//TRUE will offer full options to anyone
integer fullOptions = FALSE;
//Set to TRUE if you want ShapeGen channel support
// (Last 4 digits of channel affected)
integer SGCompatible = FALSE;
///////////////////////////////////////////////////////////////////////////////
//Part of KEYPAD CODE BY Andromeda Quonset....More added below in seevral places
list Menu2 = [ "-", "0","enter","7","8","9","4","5","6","1","2","3"];
string Input = "";
string Sign = "+";
string SignInput = " ";
string Caption = "Enter a number, include any leading 0's: ";
///////////////////////////////////////////////////////////////////////////////
// DO NOT EDIT BELOW THIS LINE.... NO.. NOT EVEN THEN
///////////////////////////////////////////////////////////////////////////////
//Name each option-these names will be your button names.
string optRecord = "Record";
string optReset = "Reset";
string optBuild = "Build";
string optPos = "Position";
string optClean = "Clean";
string optDone = "Done";
string optChannel = "Channel";
//Menu option descriptions
string descRecord = ": Record the position of all parts\n";
string descReset = ": Forgets the position of all parts\n";
string descBuild = ": Rez inv. items and position them\n";
string descPos = ": Reposition the parts to a new location\n";
string descClean = ": De-Rez all pieces\n";
string descDone = ": Remove all BB scripts and freeze parts in place.\n";
string descChannel = ": Change Channel used on base and parts.\n";
integer MENU_CHANNEL;
integer MENU2_CHANNEL;
integer MENU_HANDLE;
integer MENU2_HANDLE;
key agent;
key objectowner;
integer group;
string title = "";
list optionlist = [];
integer bMoving;
vector vLastPos;
rotation rLastRot;
integer bRezzing;
integer iListenTimeout = 0;
integer iLastRez = 0;
integer iRezIndex;
InvertSign()
{
if(Sign == "+")
Sign = "-";
else
Sign = "+";
}
//To avoid flooding the sim with a high rate of movements
//(and the resulting mass updates it will bring), we used
// a short throttle to limit ourselves
announce_moved()
{
llRegionSay(PRIMCHAN, "MOVE " + llDumpList2String([ llGetPos(), llGetRot() ], "|"));
llResetTime(); //Reset our throttle
vLastPos = llGetPos();
rLastRot = llGetRot();
return;
}
rez_object()
{
//Rez the object indicated by iRezIndex
llRezObject(llGetInventoryName(INVENTORY_OBJECT, iRezIndex), llGetPos(), ZERO_VECTOR, llGetRot(), PRIMCHAN);
//DreamGrid is very slow when compared to other grids when rezzing using this script,
//by adding an llSleep(2);
//Gives this script time to detect when the parts have been successfully rezzed and positioned.
llSleep(2);
iLastRez = llGetUnixTime();
if(!bRezzing) {
bRezzing = TRUE;
//timer_on();
}
}
post_rez_object()
{
if ( creatorUUID != llGetOwner() ) {
if(deleteOnRez) llRemoveInventory(llGetInventoryName(INVENTORY_OBJECT, iRezIndex));
}
}
heard(integer channel, string name, key id, string message)
{
if( channel == PRIMCHAN ) {
if( message == "READYTOPOS" ) {
//New prim ready to be positioned
vector vThisPos = llGetPos();
rotation rThisRot = llGetRot();
llRegionSay(PRIMCHAN, "MOVESINGLE " + llDumpList2String([ vThisPos, rThisRot ], "|"));
} else if( message == "ATDEST" ) {
//Rez the next in the sequence (if any)
iRezIndex--;
if(iRezIndex >= 0) {
//Attempt to rez it
rez_object();
} else {
//We are done building, reset our listeners
iLastRez = 0;
bRezzing = FALSE;
state reset_listeners;
}
}
return;
} else if( channel == MENU_CHANNEL ) { //Process input from original menu
if ( message == optRecord ) {
PRIMCHAN = DefaultPRIMCHAN;
llOwnerSay("Recording positions...");
if(recordSimLocation) {
//Location in sim
llRegionSay(PRIMCHAN, "RECORDABS " + llDumpList2String([ llGetPos(), llGetRot() ], "|"));
} else {
//Location relative to base
llRegionSay(PRIMCHAN, "RECORD " + llDumpList2String([ llGetPos(), llGetRot() ], "|"));
}
return;
}
if( message == optReset ) {
llOwnerSay("Forgetting positions...");
llShout(PRIMCHAN, "RESET");
return;
}
if ( message == optBuild ) {
if(chatty) llOwnerSay("Rezzing build pieces...");
//If rezzing/positioning one at a time, we need
// to listen for when they've reached their dest
if(!bulkBuild) {
llListen(PRIMCHAN, "", NULL_KEY, "READYTOPOS");
llListen(PRIMCHAN, "", NULL_KEY, "ATDEST");
}
//Start rezzing, last piece first
iRezIndex = llGetInventoryNumber(INVENTORY_OBJECT) - 1;
rez_object();
return;
}
if ( message == optPos ) {
if(chatty) llOwnerSay("Positioning");
vector vThisPos = llGetPos();
rotation rThisRot = llGetRot();
llRegionSay(PRIMCHAN, "MOVE " + llDumpList2String([ vThisPos, rThisRot ], "|"));
return;
}
if ( message == optClean ) {
llRegionSay(PRIMCHAN, "CLEAN");
if(dieOnClean) llDie();
return;
}
if ( message == optDone ) {
llRegionSay(PRIMCHAN, "DONE");
if(chatty) llOwnerSay("Removing Builder's Buddy scripts.");
return;
}
if ( message == optChannel ) {
Sign = "+"; //default is a positive number
Input = "";
llDialog( agent, Caption, Menu2, MENU2_CHANNEL );
}
} else if ( channel == MENU2_CHANNEL ) { //process input from MENU2
// if a valid choice was made, implement that choice if possible.
// (llListFindList returns -1 if Choice is not in the menu list.)
if ( llListFindList( Menu2, [ message ]) != -1 ) {
if( llListFindList(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"], [message]) != -1) {
Input += message;
SignInput = Sign + Input;
llDialog( agent, Caption + SignInput, Menu2, MENU2_CHANNEL );
} else if( message == "-" ) {
InvertSign();
SignInput = Sign + Input;
llDialog( agent, Caption + SignInput, Menu2, MENU2_CHANNEL );
} else if( message == "enter" ) { //terminate input from menu2
string CalcChan = Input;
//Apply ShapeGen compatibility?
if(SGCompatible) {
//new assign channel number, forcing last 4 digits to 0000
integer ChanSize = llStringLength(Input); //determine number of digits (chars)
if(ChanSize > 5) {
CalcChan = llGetSubString(Input, 0, 4); //Shorten to 5 digits
}
CalcChan += "0000"; //append 0000
if(Sign == "-")
CalcChan = Sign + CalcChan;
}
PRIMCHAN = (integer)CalcChan; //assign channel number
llOwnerSay("Channel set to " + (string)PRIMCHAN + ".");
}
} else {
llDialog( agent, Caption, Menu2, MENU2_CHANNEL );
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
default {
///////////////////////////////////////////////////////////////////////////////
changed(integer change) {
if(change & CHANGED_OWNER)
llResetScript();
}
///////////////////////////////////////////////////////////////////////////////
state_entry () {
//Determine the creator UUID
if(creatorUUID == "") creatorUUID = llGetCreator();
//Use which menu?
if (creatorUUID == llGetOwner() || fullOptions) {
//Display all options
optionlist = [optPos, optClean, optDone, optRecord, optReset, optBuild, optChannel];
title = optRecord + descRecord;
title += optReset + descReset;
title += optBuild + descBuild;
title += optPos + descPos;
title += optClean + descClean;
title += optDone + descDone;
title += optChannel + descChannel;
} else {
//Display limited options
if(allowClean) {
optionlist = [optBuild, optPos, optClean, optDone];
title = optBuild + descBuild;
title += optPos + descPos;
title += optClean + descClean;
title += optDone + descDone;
} else {
optionlist = [optBuild, optPos, optDone];
title = optBuild + descBuild;
title += optPos + descPos;
title += optDone + descDone;
}
}
//Record our position
vLastPos = llGetPos();
rLastRot = llGetRot();
llSetTimerEvent(fTimerRate);
}
///////////////////////////////////////////////////////////////////////////////
touch_start (integer total_number) {
group = llDetectedGroup(0); // Is the Agent in the objowners group?
agent = llDetectedKey(0); // Agent's key
objectowner = llGetOwner(); // objowners key
// is the Agent = the owner OR is the agent in the owners group
if ( (objectowner == agent) || ( group && ingroup ) ) {
iListenTimeout = llGetUnixTime() + llFloor(fListenTime);
MENU_CHANNEL = llFloor(llFrand(-99999.0 - -100));
MENU2_CHANNEL = MENU_CHANNEL + 1;
MENU_HANDLE = llListen(MENU_CHANNEL,"","","");
MENU2_HANDLE = llListen(MENU2_CHANNEL,"","","");
if ( creatorUUID == llGetOwner() || fullOptions) {
llDialog(agent,title + "Now on Channel " + (string)PRIMCHAN, optionlist, MENU_CHANNEL); //display channel number if authorized
} else {
llDialog(agent, title, optionlist, MENU_CHANNEL);
}
//timer_on();
}
}
///////////////////////////////////////////////////////////////////////////////
listen(integer channel, string name, key id, string message) {
heard(channel, name, id, message);
return;
}
///////////////////////////////////////////////////////////////////////////////
moving_start()
{
if( !bMoving )
{
bMoving = TRUE;
//timer_on();
announce_moved();
}
}
///////////////////////////////////////////////////////////////////////////////
object_rez(key id) {
//The object rezzed, perform any post-rez processing
post_rez_object();
//Rezzing it all before moving?
if(bulkBuild) {
//Move on to the next object
//Loop through backwards (safety precaution in case of inventory change)
iRezIndex--;
if(iRezIndex >= 0) {
//Attempt to rez it
rez_object();
} else {
//Rezzing complete, now positioning
iLastRez = 0;
bRezzing = FALSE;
if(chatty) llOwnerSay("Positioning");
llRegionSay(PRIMCHAN, "MOVE " + llDumpList2String([ llGetPos(), llGetRot() ], "|"));
}
}
}
///////////////////////////////////////////////////////////////////////////////
timer() {
//Did we change position/rotation?
if( (llGetRot() != rLastRot) || (llGetPos() != vLastPos) )
{
if( llGetTime() > fTimerRate ) {
announce_moved();
}
}
//Are we rezzing?
if(bRezzing) {
//Did the last one take too long?
if((llGetUnixTime() - iLastRez) >= iRezWait) {
//Yes, retry it
if(chatty) llOwnerSay("Reattempting rez of most recent piece");
rez_object();
}
}
//Open listener?
if( iListenTimeout != 0 )
{
//Past our close timeout?
if( iListenTimeout <= llGetUnixTime() )
{
iListenTimeout = 0;
llListenRemove(MENU_HANDLE);
}
}
}
///////////////////////////////////////////////////////////////////////////////
on_rez(integer iStart)
{
//Reset ourselves
llResetScript();
}
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
state reset_listeners
{
//////////////////////////////////////////////////////////////////////////////////////////
state_entry()
{
state default;
}
}

View File

@@ -0,0 +1,302 @@
// :CATEGORY:Building
// :NAME:Builders Buddy for Opensim
// :AUTHOR:Newfie Pendragon
// :KEYWORDS:Opensim
// :REV:2
// :WORLD:Opensim
// :DESCRIPTION:
// Builders Buddy for Opensim readme
// :CODE:
Revision History
TABLE OF CONTENTS
01. PRODUCT SUMMARY
02. LICENCE AND COPYRIGHT
03. OFFICIAL RELEASES
04. ABOUT THE SCRIPTS
05. USAGE SUMMARY
06. DEFINITIONS
07. PREPARING A SET OF PRIMS TO WORK WITH BUILDER'S BUDDY
08. FINE-TUNING THE BEHAVIOUR
09. OTHER NOTES
10. FOOTNOTES
11. USING BUILDER'S BUDDY -- CUSTOMER HELP
01. PRODUCT SUMMARY
Builder's Buddy lets ordinary SL users rez a set of unlinked items in their proper places in relation to each other, without needing any building skills. The "Set" is usually a building, but there is no reason it can't also be a statue, a furniture set, etc.
You prepare the unlinked items according to the easy steps below, then for distribution put them in a Packing Box.
02. LICENCE AND COPYRIGHT
* Use the Builder's Buddy scripts as you wish, to modify, sell, etc.
* If you use this script in a for-sale product, please give credit to Newfie Pendragon as the creator of the script.
* If you wish to modify this script and release the changes for public use, please submit changes to Newfie Pendragon. This is to ensure a consistent version numbering on releases, and to ensure changes are not wiped out in future releases.
03. OFFICIAL RELEASES
Official Releases of Builder's Buddy are tracked here: http://wiki.secondlife.com/wiki/Builders_Buddy
The most current official release as of April 2008 is version 1.10. Any release numbers higher than this, as of April 2008, are not on the officially supported path for updates in the future.
Subsequent versions of help for Builder's Buddy v 1.10 will be named -2, -3, -4, etc. This indicates the version of Builder's Buddy it is for, and the version of the help document.
For instance, when Builder's Buddy v 1.20 comes out, then the help for it would be named v 1.20 -1, etc.
04. ABOUT THE SCRIPTS
There are two scripts, base and component.
Make sure the Builder's Buddy scripts have the right permissions on them. They need at least transfer permissions, and since they are open source, there's no reason not to make them modify and copy as well.
Both scripts must be set to running. Do NOT hold down the CTRL key -- or Apple key on a Mac -- while dragging and dropping any of the scripts into prims, or that will set them to not running.
05. USAGE SUMMARY
The base script you only use once in an item. It goes in a "base" prim, which is the piece that is moved/rotated/etc. The component script goes into each part or each linked part that makes up the rest of the large build. In short, only one base script, many component scripts. You do not put a component script in the same item where you put a base script.
1. Drop the base script in the Base.
2. Drop the "Component" Script in each building part.
3. Touch your Base, and choose RECORD
4. Take all building parts into inventory except for the base prim
5. Drag building parts from inventory into Base Prim
6. Touch your base and choose BUILD
OTHER COMMANDS from the Touch menu
* To reposition, move or rotate the Base Prim choose POSITION
* To adjust where the house has rezzed after choosing BUILD, you can just edit - arrow move the base prim around, and the Rest of the build will follow;
* To lock into position (removes all scripts, helping to reduce work on the sim server) choose DONE
* To delete building pieces: choose CLEAN
06. DEFINITIONS
For the sake of this help, we refer to the base unit as the "Packing Box", and the set of unlinked items as the "Set."
07. PREPARING A SET OF PRIMS TO WORK WITH BUILDER'S BUDDY
[Note: please ensure first that you are on land where you are allowed to run scripts, or this will not work.]
A) Make a prim. Any size, any shape, and you can decorate later how you wish.
This is now what we are going to refer to as the "Packing Box." Occasionally, elsewhere, you will see it referred to as the "base unit."
All rotations for "Packing Box" should be set to 0, or all bets are off for how the objects rezzed out of it later will come out :} [1]
Drop the base script into it.
B) Rez in-world the set of prims you wish to be working with, if they are not already. As we are preparing them for distribution, now is the time to check that all of the permissions on them are what you like.
[TIP! in the steps below, you are going to do something to these items, then take them back into inventory. Remember that items rezzed in-world in SL, once taken *back* into inventory, tend to want to go back into the folder you rezzed them from. See the potential problem? You could end up with identically named items in that folder, the unprepared objects and the prepared objects, with no way to tell the difference. Consequently, you may wish to make sure in advance that once you have rezzed the items in-world from a folder, that in your inventory you then drag the originals off to another folder, so the coast will be clear for the incoming prepared ones. This can be particularly important if like most builders you leave each piece with the remarkably unique name of "Object" :} ]
C) Place the Component script into the content folder [2] of each piece or set of linked pieces of your build or set. To clarify, if you have several prims linked together (a "linked" set), just one of those prims (the "root" prim, which is the one you see by default when you edit a linked set, anyway) needs a Component script in it. If a prim is a standalone prim, it needs its own Component script.
D) Check your work. Did every piece or set of linked pieces get a Component script? Okay, then proceed.
E) Unless you have logistical reasons not to, we recommend now moving the Packing Box into roughly the centre of the Set. See footnote [3] at the end.
F) Click on the Packing Box (the prim you dropped the base script into earlier.) A blue menu will appear on your screen.
For now, the only button we care about is the RECORD button, but here's an explanation of all of them:
[Note: the menu also very cleverly contains brief explanations right on it!]
CHANNEL: The Packing Box and the Set pieces need a "channel" that they use to talk to each other. If you have several Packing Boxes, or several Sets, rezzed out and on the go all at once, you'll definitely want to make sure that each Packing Box / Set combination has its own unique channel to talk on, or the wrong Set might end up listening to the wrong Packing Box, and disaster could result! You could end up, for instance, issuing a CLEAN (delete) command that the only copy you have on a build might here!
RECORD: This memorizes the locations of the linksets you have dropped Component scripts into;
RESET: This "un-memorizes" the locations of the linksets you have dropped Component scripts into -- that is to say, it undoes any recording;
BUILD: This will rez your set of prepared, unlinked items, putting them all in the right place in relation both to each other, and in relation to the Packing Box.
POSITION: There may be times when the Set of objects doesn't respond to being moved by simply moving the Packing Box with the arrows (covered further below in point 4 of 11. USING BUILDER'S BUDDY) -- owing to lag, or no-script zones, etc. The POSITION command can be used to force the Set to try again.
CLEAN: This will derez the items you just rezzed using BUILD. This is done using the llDie() command. This means these items are gone, bye-bye, gonzo -- you won't even see them in your Lost and Found, or Trash.
DONE: Removes the Component scripts from the linksets, leaving them where they are "permanently." (Removing all the scripts helps to reduce work on the sim server.)
MOVE: Moves and rotates your set of unlinked items in relation to the Packing Box's height and rotation (e.g. your Packing Box will stay where it is; the build pieces will move.)
G) Press the RECORD button; the base Packing Box then records the locations of the prims or primsets that have a component script in them.
[TIP! With many pieces in a build, it can be very easy to forget to add component scripts into a piece or two. To help check that you haven't, after you have recorded the positions, go into edit mode on the Packing Box and move it up a bit. If everything follows as expected, then you are set. If not, from the SL client menu overhead, go EDIT - UNDO to have the Packing Box go back to where it was a second ago. Add a component script to the bits that didn't move. Record the positions again, then proceed.]
H) Leave the base Packing Box out, but take back into inventory all of the pieces that have Component scripts in them. It doesn't matter whether you take them in one by one, or whether you grab them all at once using TAKE from the SL client overhead menu to take them as a compound object.
I) The items are now in your inventory, and if you noted the advice in Step 2 above, you know exactly where they are in your inventory. Now, edit the Packing Box, switch to its contents folder, and drag all these prepared items into it.
J) Rename the Packing Box prim to a more helpful name than Object, if you haven't already.
K) Try rezzing the set from the Packing Box, as described below in 11. USING BUILDER'S BUDDY. Editing the packing box, and using the position arrows in edit mode, will cause the entire Set to move around with the Packing Box. Occasionally, if you are in a very laggy sim, or SL is having some kind of problem, when rezzing a build out of the Packing Box you may have to click on the Packing Box to get the menu, and click the POSITION button to get everything to pop into place. If that still doesn't do the trick, click on the CLEAN button, and then the BUILD button to try again.
[TIP! Occasionally, you may put all the prepared component pieces into the Packing Box, and run a test rez only to find that you're missing a piece of a house or furniture set that you meant to include. Don't despair; after all, that's what test runs are for!
Do the following:
a) rez the set as it is out of the Packing Box;
b) position the missing piece into place, where it should have gone;
c) add a component script to that missing piece;
d) record;
e) take just that missing piece into your inventory (make sure perms are right!);
f) place just that missing piece into the Packing Box
Note: that's right, just the missing piece -- no need to replace everything else.
08. FINE-TUNING THE BEHAVIOUR
Inside the Base script, at the top of it, are some parameters that you can set.
Full help comments are provided in the script above each parameter.
Please see these if you wish to change various aspects of how Buddy's Builder operates for you.
Here, though, is expanded help on a few items:
(a) "dieOnClean"
If you choose to use a piece of your build as the base component (which is fine), you will want to ensure that the "dieOnClean" to parameter is set to FALSE, or you risk deleting the piece during when any CLEAN command is issued.
(b) "creatorUUID" variable
You only need to fill this in if you are not the creator of the main root prim of your object.
Builder's Buddy checks the creator of the main root prim of your object to ensure that it can correctly determine which menu to show to whom. The creator gets the expanded menu; end users get the simpler menu that they need.
Normally, the creator of the packaged object has also made its root prim.
Occasionally, though, you may use prims other than those made by your own hand -- for instance, if you use megaprims. In this case, you can make sure you still get the expanded menu by specifying your UUID.
(c) "chatty" variable
If you want the Builder's Buddy to be less "chatty" while working away, you can change this via this script variable.
By default, it is set to:
integer chatty = TRUE.
To make Builder's Buddy quieter, you would change this to:
integer chatty = FALSE;
Bear in mind, though, that only the owner of the Packing Box can hear the messages, because the LSL script uses "llOwnerSay" versus "Say".
So, even though group members by default can use the menu on the Packing Box (because by default integer ingroup = TRUE ), those group members won't hear any confirmation messages unless they are the owner.
[TIP! If you want do want your team members to hear these messages, do a Search and Replace in the base script - search of llOwnerSay and replace it with llSay.]
09. OTHER NOTES
A) Position of set from Packing Box
If you had the Packing Box 5 metres in the air when you hit the RECORD button, then all the pieces of your Set will remember their position in relation to the box. Bearing that in mind, it therefore would not be a good idea to place the Packing Box on the ground and hit the BUILD button, because some pieces -- say, a floor -- might then end up 5 metres *under* the ground and be a headache for all concerned. So, tell purchasers of your Packing Box how high up or how low to place the Packing Box before hitting the BUILD button.
If you have indeed placed the Packing Box in the centre of your build before hitting the RECORD button, then advise purchasers that the build will rez using the Packing Box as the approximate centre.
B) Not getting a Menu on the Packing Box
* Check that scripts are enabled for you where you are;
* Check that the default click behaviour on the Packing Box hasn't been changed to Pay, etc.
* Edit the Packing Box, go to the contents folder, open up the Base Script, and check that it is set to running.
* If you copied the scripts yourself directly from the wiki on the web, ensure that no funny spaces or bad breaks come in with the text, as it often does from web pages;
C) There is no issue per se using megaprims, though normal constraints re sim boundaries, unsocial neighbours who deny building rights, etc :} still apply. However, if a megaprim is used as your base object, you may need to set the "creatorUUID" variable (08. FINE-TUNING THE BEHAVIOUR above) to your creator's UUID.
D) There is no issue with Buddy's Builder rezzing part of a build -- e.g. a foundation, a basement, etc, below ground level, if that is what you want.
E) Underground
When the linksets are moved/positioned, SL uses the coordinates of the root prim to move everything else with it.
When you move a root prim by hand, you can to some extent ram it under the ground (as you no doubt remember from your early days in SL.)
However, when a root prim is moved by script, script cannot move that room underground. Attempts to do so will fail silently.
Child prims linked to it, though, *can* go underground, so long as the root prim's centrepoint remains aboveground.
Bear this in mind if, for instance, you are planning to rez a house with a foundation, or basement.
F) Two different Menus
There are two different menus: one full menu for the creator of the Packing Box, and one with fewer options for the customer.
G) What memorizes the positions of all the bits to be rezzed -- the Packing Box, or the bits themselves?
Each "bit" remembers its own position, independent of the Packing Box and independent of its fellow bits.
For instance, with pieces from an already recorded set, you can:
a) make a fresh, new Packing Box;
b) drop a fresh, new base script into it;
c) load the previously prepared component pieces into it....
and it will all still work!
H) Naming component pieces
Builder's Buddy does not require all the prims in a build to have unique names. That being said, many feel it is good practice to have some kind of a naming system for the objects in your build so that they are not all named "object" or "block" or whatever. Otherwise, when you add them to the Packing Box, the SL system will just arbitrarily name them all Object, Object 1, Object 2, etc, and they will then not have the same name as those pieces in your inventory.
Depending on what your build is, you may have more than one naming convention. At the very least, when you manually add the component script to the component objects, consider naming the objects numerically yourself such as Object 01, Object 02, etc. That way, you have some idea of how many objects are in the build, and by going 01, 02, you know the numbers weren't just system-assigned ones. You can also count them easier from inside your inventory. When a build command doesn't work right, you can look back at your history and see which object by number didn't respond to the base prim when you did the record command.
10. FOOTNOTES
[1] Rotation
It is only the rotation of the Packing Box that you have to be concerned with. The rotation of the prims, or linked sets of prims, that you will be rezzing *doesn't* matter. Their rotations are part of the data that Builder's Buddy records, and deals with.
[2] Finding the Content Folder of an Item
Right-click the item in question (it must be rezzed in-world.) From the round pie menu, choose edit. The modal properties window will appear. Look on the right hand side for a button that says either "More>>" or "Less>>". If the blue button says "More>>", please click it. It will now say "Less>>". If it already says less, you are already ready for the next step.
For the next step, look for the folder tab called "Content". Click on this tab, please. You are now in the Content area of the item. To put items in here, locate them in your inventory, and drag them from your inventory and *drop* then into the Content folder. In a second or two, they will appear there. If SL is not behaving at the time, it may take a few more seconds.
To leave edit mode, locate the x in the upper-right hand corner of this editing properties window. Click it.
[3] Distance of Set pieces from Packing Box
In one way, there is no distance limit, with the simple proviso that all the prims must be in the same sim as the base. The base uses "region say" to communicate with them, meaning that its directions will be heard any anything listening for them within that region (aka sim.)
However, the linden script command to rez something can only rez something at a maximum distance of 96 metres from the item doing the rezzing. Note, however, that this is "in all directions", so the rezzer can rez something a maximum distance of 96 metres to the left, and 96 metres to the right -- ergo, a total distance, if the rezzer is in the middle, of 192 metres, which is not bad going. If you also place the box, say, 96 metres in the air, then you can rez pieces 96 metres up, 96 metres down, and 96 metres to either side, right and left (bear in mind that you probably want to be higher than 96 metres in the air; ground level is rarely actually bang on "0" in most sims.)
Consequently, when first setting out the Packing Box, and before pressing the RECORD button, it's good practice to place the Packing Box in the *middle* of the build, unless there are other prevailing reasons to place it elsewhere.
11. USING BUILDER'S BUDDY -- CUSTOMER HELP
Note: the following directions for usage are written in such a way that you can supply them just as they are written below to users / purchasers of your products, or, of course, modify them to make them more relevant to your product.
- - - - - - - - - - - - - - - - - - -
Packing Box refers to the prim object you received for your purchase. "Set" refers to the items that will be rezzed out of it.
[Note: please ensure first that you are on land where you are allowed to run scripts, or this will not work.]
1. Rez the Packing Box. The creator may have supplied you with directions about how to place the Packing Box for optimal rezzing results. If the creator noted that the Set rezzes using the Packing Box as its centre, bear that in mind. The creator may have recommended placing the Packing Box at a certain height before using it. If so, this is most easily done by editing the Packing Box [1], going to the Object tab of its properties, and just typing the coordinates provided into the appropriate X, Y and / or Z fields. When you close the editing properties, the Packing Box may appear to vanish, but it hasn't -- it has just instantly moved to that new position! Fly there yourself to join it.
TIP! Before changing the position using the X-Y-Z fields, consider just plain sitting on the Packing Box. That way, when it whizzes off, you will too right along with it!
2. Click on the Packing Box. A blue menu will appear on your screen. The buttons are:
Build / Position / Clean / Done
3. Click the BUILD button. In a matter of microseconds, the Set rezzes into place.
4. To move the entire Set of objects all at once, just edit the Packing Box and move it -- the pieces magically move in relation to it!
5. There may be times when the Set of objects doesn't respond to being moved, as just described -- owing to lag, or no-script zones, etc. The POSITION command can be used to force the Set to try again.
6. If a real mess has somehow happened, or if you were just experimenting, click the CLEAN button. This will derez everything you just rezzed, except the Packing Box itself. Then, click the BUILD button again.
7. To fix the build in place, click the DONE button.
CUSTOMER HELP FOOTNOTES
[1] Editing the Packing Box
Right-click the item in question (it must be rezzed in-world.) From the round pie menu, choose Edit. The modal properties window will appear. Look on the right hand side of it for a button that says either "More>>" or "Less>>". If it already says less, you are already ready for the next step. If the blue button instead says "More>>", please click it. It will now say "Less>>". You are now ready to proceed.
To leave edit mode, locate the x in the upper-right hand corner of this editing properties window. Click it.

View File

@@ -0,0 +1,12 @@
<Project name="BuildersBuddy-Opensim" guid="b6ca8a22-fe88-4009-9338-8d84eb9fb676">
<Object name="Base" guid="7d8637cb-4585-4ed4-9746-839c08acb8f5" active="true">
<Script name="Builders+Buddy+Base+(opensim).lsl" guid="bdd45611-f9c5-4a35-9ee4-7fdccd62bec9">
</Script>
<Notecard name="Readme.txt" guid="1886be92-5fdb-4ee8-9cf3-7fd244d232f4">
</Notecard>
</Object>
<Object name="SomeObject" guid="f01fb6bd-9e47-40bd-8b0a-252d8e1c7228">
<Script name="Builders+Buddy+Component+with+NC+(VAR).lsl" guid="fef24cdd-5a9a-4bca-8121-521e9300fc91">
</Script>
</Object>
</Project>

View File

@@ -0,0 +1,403 @@
// :CATEGORY:Building
// :NAME:Builders Buddy for Opensim
// :AUTHOR:Newfie Pendragon
// :KEYWORDS:Opensim
// :REV:2
// :WORLD:Opensim
// :DESCRIPTION:
// Builders Buddy for Opensim Component
// :CODE:
///////////////////////////////////////////////////////////////////////////////
// Builders' Buddy 1.10 (Component Script)
// by Newfie Pendragon, 2006-2008
///////////////////////////////////////////////////////////////////////////////
//
// Script Purpose & Use
// Functions are dependent on the "component script"
//
// QUICK USE:
// - First change the numbers on lines 35 and 37 to any negative number, then save this script, it is important that to avoid multiple calls using more than one rez box to change these numbers everytime a new build is packed away.
// - Change the same numbers in the Component script to,,,,,to match the numbers changed in this script.
// - Drop this script in each building part, if using a linset, then drop this script into the root prim.
// - Touch your Base, and choose RECORD
// - Take all building parts into inventory
// - Drag building parts from inventory into Base Prim
// - Touch your base and choose BUILD
//
// OTHER COMMANDS from the Touch menu
// - To reposition, move/rotate Base Prim choose POSITION
// - To lock into position (removes scripts) choose DONE
// - To delete building pieces: choose CLEAN
///////////////////////////////////////////////////////////////////////////////
// This script is copyrighted material, and has a few (minor) restrictions.
// For complete details, including a revision history, please see
// http://wiki.secondlife.com/wiki/Builders_Buddy
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Added a Memory datastorage for opensim using osMakeNotecard
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Configurable Settings
float fTimerInterval = 0.25; // Time in seconds between movement 'ticks'
integer DefaultChannel = -120003; // Andromeda Quonset's default channel
//integer PRIMCHAN = DefaultChannel; // Channel used by Base Prim to talk to Component Prims;
integer PRIMCHAN = -120003; // OpenSim Modification - also comment out the previous line for OpenSim
// ***THIS MUST MATCH IN BOTH SCRIPTS!***
//////////////////////////////////////////////////////////////////////////////////////////
// Runtime Variables (Dont need to change below here unless making a derivative)
vector vOffset;
rotation rRotation;
integer bNeedMove;
vector vDestPos;
rotation rDestRot;
integer bMovingSingle = FALSE;
integer bAbsolute = FALSE;
integer bRecorded = FALSE;
vector Region_Size;
vector vLimit;
list record_mem = []; // Memory to be stored
key g_quary_nc; //for reading our memory notecard
integer nc_line; //what line are we reading
integer iStartValue;
////////////////////////////////////////////////////////////////////////////////
string first_word(string In_String, string Token)
{
//This routine searches for the first word in a string,
// and returns it. If no word boundary found, returns
// the whole string.
if(Token == "") Token = " ";
integer pos = llSubStringIndex(In_String, Token);
//Found it?
if( pos >= 1 )
return llGetSubString(In_String, 0, pos - 1);
else
return In_String;
}
////////////////////////////////////////////////////////////////////////////////
string other_words(string In_String, string Token)
{
//This routine searches for the other-than-first words in a string,
// and returns it. If no word boundary found, returns
// an empty string.
if( Token == "" ) Token = " ";
integer pos = llSubStringIndex(In_String, Token);
//Found it?
if( pos >= 1 )
return llGetSubString(In_String, pos + 1, llStringLength(In_String));
else
return "";
}
////////////////////////////////////////////////////////////////////////////////
do_move()
{
integer i = 0;
vector vLastPos = ZERO_VECTOR;
while( (i < 5) && (llGetPos() != vDestPos) )
{
list lParams = [];
//If we're not there....
if( llGetPos() != vDestPos )
{
//We may be stuck on the ground...
//Did we move at all compared to last loop?
if( llGetPos() == vLastPos )
{
//Yep, stuck...move straight up 10m (attempt to dislodge)
lParams = [ PRIM_POSITION, llGetPos() + <0, 0, 10.0> ];
//llSetPos(llGetPos() + <0, 0, 10.0>);
} else {
//Record our spot for 'stuck' detection
vLastPos = llGetPos();
}
}
//Try to move to destination
//Upgraded to attempt to use the llSetPrimitiveParams fast-move hack
//(Newfie, June 2006)
integer iHops = llAbs(llCeil(llVecDist(llGetPos(), vDestPos) / 10.0));
integer x;
for( x = 0; x < iHops; x++ ) {
lParams += [ PRIM_POSITION, vDestPos ];
}
llSetPrimitiveParams(lParams);
//llSleep(0.1);
i++;
}
//Set rotation
llSetRot(rDestRot);
}
start_move(string sText, key kID)
{
//Don't move if we've not yet recorded a position
if( !bRecorded ) return;
//Also ignore commands from bases with a different owner than us
//(Anti-hacking measure)
if( llGetOwner() != llGetOwnerKey(kID) ) return;
//Calculate our destination position relative to base?
if(!bAbsolute) {
//Relative position
//Calculate our destination position
sText = other_words(sText, " ");
list lParams = llParseString2List(sText, [ "|" ], []);
vector vBase = (vector)llList2String(lParams, 0);
rotation rBase = (rotation)llList2String(lParams, 1);
vDestPos = (vOffset * rBase) + vBase;
rDestRot = rRotation * rBase;
} else {
//Sim position
vDestPos = vOffset;
rDestRot = rRotation;
}
Region_Size = osGetRegionSize();
vLimit.x = (Region_Size.x - 15);
vLimit.y = (Region_Size.y - 15);
//Make sure our calculated position is within the sim
if(vDestPos.x < 0.0) vDestPos.x = 0.0;
if(vDestPos.x > vLimit.x) vDestPos.x = vLimit.x;
if(vDestPos.y < 0.0) vDestPos.y = 0.0;
if(vDestPos.y > vLimit.y) vDestPos.y = vLimit.y;
if(vDestPos.z > 4096.0) vDestPos.z = 4096.0;
//Turn on our timer to perform the move?
if( !bNeedMove )
{
llSetTimerEvent(fTimerInterval);
bNeedMove = TRUE;
}
return;
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
default
{
//////////////////////////////////////////////////////////////////////////////////////////
state_entry()
{
//Open up the listener
llListen(PRIMCHAN, "", NULL_KEY, "");
llRegionSay(PRIMCHAN, "READYTOPOS");
}
//////////////////////////////////////////////////////////////////////////////////////////
on_rez(integer iStart)
{
iStartValue = iStart;
if(llGetInventoryType("Builders Buddy Memory") != -1)
{
nc_line = 0;
g_quary_nc = llGetNotecardLine("Builders Buddy Memory", nc_line);
}
else
{
//Set the channel to what's specified
if( iStart != 0 )
{
PRIMCHAN = iStart;
state reset_listeners;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////
listen(integer iChan, string sName, key kID, string sText)
{
string sCmd = llToUpper(first_word(sText, " "));
if( sCmd == "RECORD" )
{
record_mem = [];
//Record position relative to base prim
sText = other_words(sText, " ");
list lParams = llParseString2List(sText, [ "|" ], []);
vector vBase = (vector)llList2String(lParams, 0);
rotation rBase = (rotation)llList2String(lParams, 1);
vOffset = (llGetPos() - vBase) / rBase;
record_mem += "vOffset|" +(string)vOffset ;
rRotation = llGetRot() / rBase;
record_mem += "rRotation|" +(string)rRotation ;
bAbsolute = FALSE;
record_mem += "bAbsolute|" +(string)bAbsolute ;
bRecorded = TRUE;
record_mem += "bRecorded|" +(string)bRecorded ;
if(llGetInventoryType("Builders Buddy Memory") != -1)
{
llRemoveInventory("Builders Buddy Memory");
}
osMakeNotecard( "Builders Buddy Memory", record_mem );
llOwnerSay("Recorded position.");
return;
}
if( sCmd == "RECORDABS" )
{
record_mem = [];
//Record absolute position
rRotation = llGetRot();
record_mem += "rRotation|" +(string)rRotation ;
vOffset = llGetPos();
record_mem += "vOffset|" +(string)vOffset ;
bAbsolute = TRUE;
record_mem += "bAbsolute|" +(string)bAbsolute ;
bRecorded = TRUE;
record_mem += "bRecorded|" +(string)bRecorded ;
if(llGetInventoryType("Builders Buddy Memory") != -1)
{
llRemoveInventory("Builders Buddy Memory");
}
osMakeNotecard( "Builders Buddy Memory", record_mem );
llOwnerSay("Recorded sim position.");
return;
}
//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "MOVE" )
{
start_move(sText, kID);
return;
}
if( sCmd == "MOVESINGLE" )
{
//If we haven't gotten this before, position ourselves
if(!bMovingSingle) {
//Record that we are a single-prim move
bMovingSingle = TRUE;
//Now move it
start_move(sText, kID);
return;
}
}
//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "DONE" )
{
//We are done, remove script
if(llGetInventoryType("Builders Buddy Memory") != -1)
{
llRemoveInventory("Builders Buddy Memory");
}
llRemoveInventory(llGetScriptName());
return;
}
//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "CLEAN" )
{
//Clean up
llDie();
return;
}
//////////////////////////////////////////////////////////////////////////////////////////
if( sCmd == "RESET" )
{
llResetScript();
}
}
//////////////////////////////////////////////////////////////////////////////////////////
timer()
{
//Turn ourselves off
llSetTimerEvent(0.0);
//Do we need to move?
if( bNeedMove )
{
//Perform the move and clean up
do_move();
//If single-prim move, announce to base we're done
if(bMovingSingle) {
llRegionSay(PRIMCHAN, "ATDEST");
}
//Done moving
bNeedMove = FALSE;
}
return;
}
dataserver(key queryid, string data)
{
if ( queryid == g_quary_nc)
{
if (data != EOF)
{
list n = llParseString2List(data, ["|"], []);
if(llList2String(n, 0) == "vOffset")
{
vOffset = llList2Vector(n, 1);
}
else if(llList2String(n, 0) == "rRotation")
{
rRotation = llList2Rot(n, 1);
}
else if(llList2String(n, 0) == "bAbsolute")
{
bAbsolute = (integer)llList2String(n, 1);
}
else if(llList2String(n, 0) == "bRecorded")
{
bRecorded = (integer)llList2String(n, 1);
}
nc_line++;
g_quary_nc = llGetNotecardLine("Builders Buddy Memory", nc_line);
}
else
{
//Set the channel to what's specified
if( iStartValue != 0 )
{
PRIMCHAN = iStartValue;
state reset_listeners;
}
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
state reset_listeners
{
//////////////////////////////////////////////////////////////////////////////////////////
state_entry()
{
state default;
}
}

File diff suppressed because it is too large Load Diff

34
New folder/Flash.lsl Normal file
View File

@@ -0,0 +1,34 @@
integer primnum = 0 ; // change to the number of a prim that you want to flash
integer counter = 0;
Off() {
llSetLinkPrimitiveParamsFast(0,[PRIM_POINT_LIGHT, TRUE, <1,1,1>, 1.0, 10, .1, PRIM_FULLBRIGHT, ALL_SIDES,1, PRIM_GLOW, ALL_SIDES, 1.0]);
}
On() {
llSetLinkPrimitiveParamsFast(0,[PRIM_POINT_LIGHT, FALSE, <1,1,1>, 1.0, 10, .1, PRIM_FULLBRIGHT, ALL_SIDES,0, PRIM_GLOW, ALL_SIDES, 0.0]);
}
default
{
state_entry()
{
Off();
}
touch_start(integer total_number)
{
llSetTimerEvent(.1); // 1/10 a second between events
}
timer()
{
if (counter == 0)
On();
else if (counter == 1)
Off();
else if (counter == 2)
On();
else if (counter == 2) {
Off();
llSetTimerEvent(0);
}
counter++;
}
}

View File

@@ -0,0 +1,3 @@
<Solution name="Opensim Partners">
<Project name="Opensim Partners" path="Opensim Partners\Opensim Partners.prj" active="true"/>
</Solution>

View File

@@ -0,0 +1,201 @@
//:AUTHOR: Digiworldz.com
//:DESCRIPTION: Opensim Partnership program
// :REVISION: 2
//:CODE:
// Put this in a box. When two people touch it, they can make a partership.
// Mods by Ferd Frederix for Dreamgrid
// A SETTING YOU HAVE TO SET FOR SECURITY
// It works when blank, but it is possible for someone with this script to make or drop partners!
// Set this to your Unique grid identifier from the Settings panel.
string PW = "";
// CODE follows, the rest of this should probably not be modified.
// If you want to see a lot of messages, set this to TRUE
integer debug = FALSE;
// variables
string URL = "";
// Default = 8001 for Dreamgrid. :80 or blank for other grids
string PORT = ":8001";
// How long you have to convince him/her to click the box
float TIMEOUT = 20.0; // seconds
list PAR = [];
key id1; // 1st user
string name1; // 1st user
key id2; // 2nd user
string name2; // 2nd user
key id3; // partner of 2nd user
string name3; // partner of 2nd user
key http_request_id1; // get_partner; 1st user
key http_request_id2; // begin: get_partner; 2nd user
key http_request_id3; // begin: set_partner; 1st user
key http_request_id4; // begin: set_partner; 2nd user
key http_request_id5; // dissolve: set_partner; 1st user
key http_request_id6; // dissolve: set_partner; 2nd user
DEBUG(string msg) {
if (debug) {
llSay(0,msg);
};
}
string left(string src, string divider) {
integer index = llSubStringIndex( src, divider );
if(~index)
return llDeleteSubString( src, index, -1);
return src;
}
string right(string src, string divider) {
integer index = llSubStringIndex( src, divider );
if(~index)
return llDeleteSubString( src, 0, index + llStringLength(divider) - 1);
return src;
}
// default state
default {
state_entry() {
//Grid Gatekeeper Uri
URL = "http:" + left(right(osGetGridGatekeeperURI(),":"),":");
DEBUG(URL);
llSetText("Click here to begin or\ndissolve partnership", <1,1,1>, 1);
}
touch_start(integer num_detected) {
id1 = llDetectedKey(0);
name1 = llDetectedName(0);
string req = URL + PORT + "/get_partner?PW=" + PW + "&User=" + (string)id1;
DEBUG(req);
http_request_id1 = llHTTPRequest(req, PAR, "");
}
// called for all HTTP responses of all states
http_response(key request_id, integer status, list metadata, string body) {
if (request_id == http_request_id1) {
// get_partner; 1st user
DEBUG("Partner = " + body);
id2 = (key)body;
name2 = llGetDisplayName(id2);
if (!name2) name2 = (string)id2;
if (id2 == NULL_KEY)
{
llSay(0, name1 + ", you have no partnership at the moment");
state begin_partnership;
} else {
llSay(0, name1 + ", your partner is " + name2);
state dissolve_partnership;
}
} else if (request_id == http_request_id2) {
// begin: get_partner; 2nd user
id3 = (key)body;
DEBUG("Partner = " + body);
name3 = llGetDisplayName(id3);
if (!name3) name3 = (string)id3;
if (id3 == NULL_KEY)
{
string req = URL + PORT + "/set_partner?PW=" + PW + "&User=" + (string)id1 + "&Partner=" + (string)id2;
DEBUG(req);
http_request_id3 = llHTTPRequest(req, PAR, "");
} else {
llSay(0, name2 + ", you have " + name3 + " as partner already");
state default;
}
} else if (request_id == http_request_id3) {
// begin: set_partner; 1st user
string req = URL +PORT + "/set_partner?PW=" + PW + "&User=" + (string)id2 + "&Partner=" + (string)id1;
DEBUG(req);
http_request_id4 = llHTTPRequest(req, PAR, "");
} else if (request_id == http_request_id4) {
// begin: set_partner; 2nd user
llSay(0, name1 + " and " + name2 + " are now partners. Relog to see your new relationship status in your profiles.");
state default;
} else if (request_id == http_request_id5) {
// dissolve: set_partner; 2nd user
id2 = (key)body;
string req = URL+PORT + "/set_partner?PW=" + PW + "&User=" + (string)id2 + "&Partner=" + (string)NULL_KEY;
DEBUG(req);
http_request_id6 = llHTTPRequest(req, PAR, "");
} else if (request_id == http_request_id6) {
// dissolve: set_partner; 2nd user
llSay(0, name1 + " and " + name2 + " are not partners anymore");
state default;
} else {
// unknown response
llOwnerSay("Error: unknown response");
}
}
}
state begin_partnership{
state_entry() {
llSetText("Future partner of\n" + name1 + "\nplease click here", <1,1,1>, 1.0);
llSay(0,"Future partner of " + name1 + ", please click the box");
llSetTimerEvent(TIMEOUT);
}
timer() {
llSay(0, "Timeout, please try again");
llSetTimerEvent(0.0);
state default;
}
touch_start(integer num_detected) {
llSetTimerEvent(0.0);
id2 = llDetectedKey(0);
name2 = llDetectedName(0);
if ((string)id1 == (string)id2)
{
llSay(0, "canceled");
state default;
}
// check if new partner has no partnership
string req = URL +PORT + "/get_partner?PW=" + PW + "&User=" + (string)id2;
DEBUG(req);
http_request_id2 = llHTTPRequest(req, PAR, "");
state default;
}
}
// dissolve partnership
state dissolve_partnership{
state_entry() {
llSetText(name1 + ", click \nif you want to dissolve\nyour current partnership", <1,1,1>, 1.0);
llSay(0,name1 + ", click if you want to dissolve your current partnership");
llSetTimerEvent(TIMEOUT);
}
timer() {
llSay(0, "Timeout, please try again");
llSetTimerEvent(0.0);
state default;
}
touch_start(integer num_detected) {
llSetTimerEvent(0.0);
id2 = llDetectedKey(0);
name2 = llDetectedName(0);
if ((string)id1 != (string)id2)
{
llSay(0, "canceled");
state default;
}
string req = URL +PORT + "/set_partner?PW=" + PW + "&User=" + (string)id1 + "&Partner=" + (string)NULL_KEY;
DEBUG(req);
http_request_id5 = llHTTPRequest(req, PAR, "");
state default;
}
}

View File

@@ -0,0 +1,6 @@
<Project name="Opensim Partners" guid="e3e639d1-12b9-4b05-9525-64bd0716a3a1">
<Object name="Object" guid="e78727f2-0459-49e7-9fc3-8de80d602402" active="true">
<Script name="Opensim Partners.lsl" guid="4a900aa6-a6ce-4033-8f5d-4356836cc2c1">
</Script>
</Object>
</Project>