Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Lockmeister Scripts and Tweak?

Keira Moxie
Registered User
Join date: 17 Dec 2005
Posts: 47
05-16-2008 10:09
Anyone familliar with the lockmeister scripts? If so... does anyone think their might be a way to lock the distance the avatar can move from the post or whatever once linked to it without a pose ball? Any ideas? the whole concept of a post doesn't really work if the avatar can just walk away at anytime lol... Any help is appreciated :)
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
05-16-2008 11:33
Here is the basic idea of how those things are usually done. The particle chains are really for show, they are independent of the actual restraint stuff.

Throw this into any old prim and wear it as an attachment it to experiment.

CODE

// Stuff this into an attachment to see the general idea.
// commands are /33 lock and /33 unlock

integer myChannel = 33;
integer myListen = 0; // so we can clean up after old listeners
float chainLength = 5.; // how many meters we are allowed to wander away
vector lockPosition; // the point where we are to be chained

init() {
llListenRemove(myListen);
myListen = llListen(myChannel, "", llGetOwner(), "");
}

default
{
state_entry()
{
init();
}

changed (integer change) {
if (change & CHANGED_OWNER) {
init();
}
}

listen(integer chan, string name, key id, string msg) {
if (msg == "lock") {
// use whatever our current position is for the example. For
// a collar use the position of the hitching post.
lockPosition = llGetPos();
llOwnerSay("locked at " + (string) lockPosition);
llSetTimerEvent(1.); // start monitoring position
}
else if (msg == "unlock") {
llSetTimerEvent(0.); // stop monitoring
llStopMoveToTarget(); // unlocked, no need to shove
}
}

timer() {
if (llVecDist(llGetPos(), lockPosition) > chainLength) { // oops trying to escape
llMoveToTarget(lockPosition, 0.5); // guide us back to where we belong
}
else {
llStopMoveToTarget(); // close enough, stop dragging
}
}
}
_____________________
Keira Wells
Blender Sculptor
Join date: 16 Mar 2008
Posts: 2,371
05-16-2008 11:48
From: Keira Moxie
Anyone familliar with the lockmeister scripts? If so... does anyone think their might be a way to lock the distance the avatar can move from the post or whatever once linked to it without a pose ball? Any ideas? the whole concept of a post doesn't really work if the avatar can just walk away at anytime lol... Any help is appreciated :)

Amethyst scripts and such do just this, with the leashing and posting.

And thank you Viktoria, I've been looking for that exact script for a couple days.
_____________________
Tutorials for Sculpties using Blender!
Http://www.youtube.com/user/BlenderSL