Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llMoveToTarget, then STUCK!!

Wezza Writer
Registered User
Join date: 9 Jun 2009
Posts: 59
09-09-2009 02:52
I have used llMoveToTarget to move to a pos, but then I cannot move anywhere afterward. I have used llWhisper before and after llMoveToTarget to signal a move is being called, but then no whisper at all after the 1st one!

What's keeping me there? SL ghosts? :p
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
09-09-2009 03:21
Sim border?

Other then that it is gonna be hard throwing every possible cause at you without seeing the code.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-09-2009 04:45
once you get there you need to use llStopMoveToTarget
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
09-09-2009 15:16
You have now learned how a MoveLock works. :D

Ruthven has it: llStopMoveToTarget() will solve your problem.
Wezza Writer
Registered User
Join date: 9 Jun 2009
Posts: 59
09-10-2009 00:04
From: Ruthven Willenov
once you get there you need to use llStopMoveToTarget


good stuff mate :)
Wezza Writer
Registered User
Join date: 9 Jun 2009
Posts: 59
09-10-2009 00:06
From: Talarus Luan
You have now learned how a MoveLock works. :D

Ruthven has it: llStopMoveToTarget() will solve your problem.


absolutely :p

some how I wish they used the stop function in the wiki example...
Wezza Writer
Registered User
Join date: 9 Jun 2009
Posts: 59
09-10-2009 01:36
Any good way to detect if the MoveToTarget is finished other then continuously calling some check, so the script knows its time to call StopMove?
Wezza Writer
Registered User
Join date: 9 Jun 2009
Posts: 59
09-10-2009 03:21
I'm trying to use llTarget to determine if I get moved into pos. It seems that llMoveToTarget isn't in effect after calling llTarget!! And the printout from not_at_target() is of course non-stop!!
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-10-2009 07:37
here's a script i was using for a warp hud, not sure what you're trying to do with llmovetotarget, but this might be an overkill. probably needs some cleaning up, i never use it anymore now that i use the emerald viewer

CODE

list targets = [<72,73,24>,<67,85,502>];//just a list of targets i used in my home sim
vector VTarget;

integer target;

float tau = 0.05;
float dist;

string home = "Sasha";//my home sim

default
{
on_rez(integer d)
{
if(llGetAttached())
{
llResetScript();
}
}

attach(key id)
{
if(id){llResetScript();}
}

state_entry()
{
llRequestPermissions(llGetOwner(),PERMISSION_TRACK_CAMERA | PERMISSION_TAKE_CONTROLS);
}

run_time_permissions(integer perm)
{
if(PERMISSION_TAKE_CONTROLS & perm)
{
llTakeControls(CONTROL_ML_LBUTTON, TRUE, TRUE);//taking controls allows it to work in no-script zones
}
}

touch_start(integer total_number)
{
llTargetRemove(target);//removes whatever target you might have already had
llStopMoveToTarget();//stops you from moving in case you were already on route somewhere
integer num = llDetectedTouchFace(0);//checks which face
if(num)
{
if(num == 2){VTarget = llGetCameraPos();//2 is the cam button as labeled on my hud
llOwnerSay((string)VTarget);}
else if(num == 4){VTarget = llList2Vector(targets,1);}//4 is the "skybox" button as labeled on my hud
else if(num == 1)//1 is the stop button if i get stuck or want to stop for any reason
{
llTargetRemove(target);//removes the target
llStopMoveToTarget();//stops me moving
llSetTimerEvent(0.0);//turns off the timer
return;//stops the script here so it doesn't try to set a target on the next line
}
target = llTarget(VTarget,tau);
llSetTimerEvent(0.001);
}
else if(num == 0)//0 is the "home" button as labeled in the
{
if (llGetRegionName() == home)//checks if i'm in my home sim
{
VTarget = llList2Vector(targets,0);
target = llTarget(VTarget,tau);
llSetTimerEvent(0.001);
}
}
}

at_target(integer tnum, vector tpos, vector mypos)
{
llApplyImpulse(-llGetVel(),FALSE);//applies an impulse in the opposite direction that i'm moving to help me stop
llTargetRemove(target);
llStopMoveToTarget();
llOwnerSay("here");
}

timer()
{
llMoveToTarget(VTarget,tau);//using this in the timer calls move to target in a loop to keep me moving
dist = llVecDist(llGetPos(),VTarget);//checks the distance from where you are currently to the target
llApplyImpulse((VTarget - llGetPos()) * dist,FALSE);//applies an impulse in the direction i need to go to help me get going
if(dist<60){llSetTimerEvent(0);}//turn off the timer if you're under the 60m limit
}
}
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Wezza Writer
Registered User
Join date: 9 Jun 2009
Posts: 59
09-11-2009 01:21
thanks Ruthven Willenov,

This is a very good example, and it shows me a neat start.

If I want to move FORWARD by 10m, how do I find out which direction I'm facing and calculate the new pos to move to?
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
09-11-2009 06:53
From: Wezza Writer
thanks Ruthven Willenov,

This is a very good example, and it shows me a neat start.

If I want to move FORWARD by 10m, how do I find out which direction I'm facing and calculate the new pos to move to?


the same way you would figure out the local offset for any other vector, you figure out the start position, then add the offset, and multiply it by your rotation

llMoveToTarget(llGetPos() + < 10.0,0.0,0.0 > * llGetRot(),tau);
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Vladimir Petrichor
Registered User
Join date: 6 Apr 2006
Posts: 19
09-11-2009 07:07
From: Wezza Writer
thanks Ruthven Willenov,

This is a very good example, and it shows me a neat start.

If I want to move FORWARD by 10m, how do I find out which direction I'm facing and calculate the new pos to move to?



If you want to move forward, regardless of orientation (as forward is a relative term), use this...

llGetPos() + (llRot2Fwd(llGetRot()) * 10)


That tells you to go to a position equal to whatever your current position is, plus 10 meters along the forward vector.

You can find out a little bit more (in relatively simple terms) about the use of llRot2Fwd and its cousins llRot2Up and llRot2Left, in this page at the Vladwerkz wiki

http://vladwerkz.wikidot.com/rot2fwd-action