Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rez object warpPos

Turokhan Legion
Vortech Enterprises CEO
Join date: 22 Jul 2007
Posts: 32
02-19-2009 15:44
Hey all,

I'm making a script that will rez the object inside to the position i chat to it.

Thing is i had done this successfully but then lost the script, now i cant seem to find what I am doing wrong here.

Heres the code:

warpPos( vector destpos )
{ //R&D by Keknehv Psaltery, 05/25/2006
//with a little poking by Strife, and a bit more
//some more munging by Talarus Luan
//Final cleanup by Keknehv Psaltery
//Changed jump value to 411 (4096 ceiling) by Jesse Barnett
// Compute the number of jumps necessary
integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
// Try and avoid stack/heap collisions
if (jumps > 411)
jumps = 411;
list rules = [ PRIM_POSITION, destpos ]; //The start for the rules list
integer count = 1;
while ( ( count = count << 1 ) < jumps)
rules = (rules=[]) + rules + rules; //should tighten memory use.
llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
if ( llVecDist( llGetPos(), destpos ) > .001 ) //Failsafe
while ( --jumps )
llSetPos( destpos );
}

string object = "Object";
vector vec = <0,0,0>;
default
{
state_entry()
{
llListen(13, "",NULL_KEY, "";);
}
listen(integer channel, string name,key id, string message)
{
vec = warpPos( (vector)message );
llRezAtRoot(object, vec * llGetRot(), ZERO_VECTOR, llEuler2Rot(<0,0,0> * DEG_TO_RAD) * llGetRot(), 0);


}
}
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
02-19-2009 19:34
From: Turokhan Legion
Hey all,

I'm making a script that will rez the object inside to the position i chat to it.

Thing is i had done this successfully but then lost the script, now i cant seem to find what I am doing wrong here.

Heres the code:
CODE

string object = "Object";
vector vec = <0,0,0>;
default
{
state_entry()
{
llListen(13, "",NULL_KEY, "");
}
listen(integer channel, string name,key id, string message)
{
vec = warpPos( (vector)message );
llRezAtRoot(object, vec * llGetRot(), ZERO_VECTOR, llEuler2Rot(<0,0,0> * DEG_TO_RAD) * llGetRot(), 0);


}
}
A couple of problems spring to mind. First, you don't use warpPos to convert things.. you feed warpPos a vector and off it goes. Second, you can't rez anything more that 10 metres away from the rezzer.

So you need to grab the destination vector, have the rezzed object open a listener as part of its on_rez event, and have the rezzer repeat the destination to the rezzed object. When the newly rezzed object hears this, it calls warpPos and whoosh..

Jesse Barnett's teleport hud works like this.. you have to sit on the rezzed object in that example but it shows the principle, I think -- the hud whispers the destination to the object after it's rezzed it. http://wiki.secondlife.com/wiki/Teleport_HUD