Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

scripting for collars

Owner Maltese
Registered User
Join date: 13 Sep 2005
Posts: 65
11-02-2005 07:45
I am looking for a basic script for collars. Namely, I don't quite understand how one person can control the other person's animation. I know it has to do with permissions, but I'm having a hard time grasping them.
All I need is a little push, the basic idea and I can snowball it from there.
Thanks for the help.
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
11-02-2005 08:36
I've never done this type of scripting before, but my thought is that:

a)The collar requests permission from the owner to animate them.

b)The owner gives their "master" permission to send commands to the collar.

c)When a command is triggered, the collar animates the owner.


Essentially, the master's name would be stored as either a string (if you want the collar capable of only one master) or a list (if you wish more than one master capability) and checked for upon a given command...
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
11-02-2005 12:40
use llRequestPermissions in the collar to have the collar ask for PERMISSION_TRIGGER_ANIMATION and then do something like
CODE
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
llListen(12, "Joe Someone", NULL_KEY, "");
}
to start listening to the master's name.
Padraig Stygian
The thin mick
Join date: 15 Aug 2004
Posts: 111
11-02-2005 12:59
I just wrote one of these. :) I've got it set up so that during the configuration process, the collar rezzes an object that the master needs to touch. The touch-widget transmits the key back to the collar, and a listen gets opened for the master on one channel and for the wearer of the collar on a different one. This way, the wearer can control some actions, like sit and beg, but the master can attach the leash and "pull" the wearer.

Collar script contains:
CODE

//Some other stuff
...
state config
{
state_entry()
{
llListen( MENU_CHANNEL, "", NULL_KEY, "" );
mainDialog();
}
listen(integer channel,string name,key id,string msg)
{
vector newColor;
integer i;
//Some stuff
//...
if (msg == "Slave Owner")
{
llRezObject( "OwnerGet", llGetPos() + <0,0,0.7>,
ZERO_VECTOR, ZERO_ROTATION, 42 );
llWhisper( 0, "Owner of " + llKey2Name(gOwner)
+ " should now touch the bubble." );
}
}
//Other stuff
//...
state running
{
state_entry()
{
llOwnerSay("Running");
llListen(SLAVE_CHANNEL,"",gOwner,"");
llListen(MASTER_CHANNEL, "", gSlaveOwner, "");
}
listen(integer channel,string name,key id,string msg)
{
if (channel == SLAVE_CHANNEL)
{
if(( i = llListFindList( gAnimationNames, [ msg ] )) != -1 )
{
animStart();
}
else if (msg == "reset")
{
llResetScript();
}
//Some more stuff
//...
}
if (channel == MASTER_CHANNEL)
{
if (msg == "leash")
{
particleLeash();
}
if (msg == "unleash")
{
llParticleSystem([]);
}
//More stuff
//...
}
}

And the owner-widget contains:
CODE

string gOwner;
default
{
state_entry()
{
gOwner = llGetOwnerKey(llGetKey());
}

touch_start(integer total_number)
{
string gSlaveOwner = llKey2Name(llDetectedKey(0));
llSay(1949, llDetectedKey(0));
llWhisper(0, "This slave is owned by " + gSlaveOwner + ".");
llDie();
}
}
_____________________
(You): Aww! My pants won't rez! Does this texture look okay on me?

Incidental Radio :: Because nothing is by design
Now featuring Torley-tastic technomusic!
Hans Reitveld
Registered User
Join date: 21 Jun 2005
Posts: 16
Leash Code
03-05-2007 09:22
Any chance of getting the source for that particleLeash() function?

Thanks :)
Rael Delcon
Registered User
Join date: 23 Nov 2006
Posts: 86
03-06-2007 02:07
The best option for a leash is to use the LockGuard protocol so that your leash is compatible with other in-world objects.

The protocol is available on the lslwiki and there's a full implementation at Dominashop sold for 1L (many thanks to the author).

If you're interested there is a description of my collar script at http://slaveryring.blogspot.com

Contact me in-world for the current source code. You can use it as basis for yours (but beware, is GPLed).

Rael Delcon