Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

avatar moving problem

zeshu123 Horsley
Registered User
Join date: 28 Jan 2009
Posts: 15
04-10-2009 09:51
hi guys,

I want to move my avatar to the below position
pos=<119.54,124.53,22.71>

and i am using this code

default{
touch_start(integer total_number)
{

llMoveToTarget(pos,0.05);

}



}

nothing is happening,please help me in this problem.I am just started working in scripting.
Scott Savira
Not Scott Saliva
Join date: 10 Aug 2008
Posts: 357
04-10-2009 10:01
Don't have time to look but I believe there are distance constraints with llMoveToTarget. I haven't used the function much yet. Most teleporters require you to "sit" on them and use the sit target function to move you. Think that's right...
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-10-2009 10:06
llMoveToTarget only works if your destination is within a little under 65 meters away. If you have more distance to travel, you will need to break your trip up into smaller pieces.

And don't forget llStopMoveToTarget once you get there =)
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-10-2009 10:15
Take a look at the WarpPos function () to see a common way to break a long jump into a series of smaller ones for an apparently instantaneous TP.
zeshu123 Horsley
Registered User
Join date: 28 Jan 2009
Posts: 15
please help
04-10-2009 10:37
please guys help me in any other way that how i can move my avatar to a specific location
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-10-2009 11:05
There is no simple way. Linden Labs has declined to implement llTeleportAgent.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
zeshu123 Horsley
Registered User
Join date: 28 Jan 2009
Posts: 15
04-10-2009 11:38
hi Rolig,

I read the link that u posted here and i also try to implement it but i am getting this error
command not implemented :llRequestPermissions
Johan Laurasia
Fully Rezzed
Join date: 31 Oct 2006
Posts: 1,394
04-10-2009 11:40
From: Viktoria Dovgal


And don't forget llStopMoveToTarget once you get there =)


and dont forget an at_target event to detect when you get there.
_____________________
My tutes
http://www.youtube.com/johanlaurasia
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-10-2009 12:21
From: zeshu123 Horsley
hi Rolig,

I read the link that u posted here and i also try to implement it but i am getting this error
command not implemented :llRequestPermissions


Without seeing exactly how you are using the warpPos function in your own script, I have no way to tell why it's feeding you that error. For an example of how it can be used, though, take a look at . Another approach .... If you wander around SL, you can find loads of freebie TP scripts (or scripted TP objects). Go grab one and take it apart to see how it ticks.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
04-14-2009 16:10
From: zeshu123 Horsley
hi Rolig,

I read the link that u posted here and i also try to implement it but i am getting this error
command not implemented :llRequestPermissions
zeshu, you stated in a different thread that you are using OpenSim rather than Second Life. If this is the case, then you should know they aren't the same. Therefore, when you ask for scripting help, it would be good to know which product you're using the script within, OpenSimulator or Second Life.

You may find scripting help for OpenSimulator at:
http://opensimulator.org/wiki/Scripting_Documentation
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
04-14-2009 19:01
Yeah, scripting in OpenSim can be challenging to put it mildly. Not only isn't it quite finished yet, but you don't necessarily have the same functions available on all grids because of version differences. If there is usable physics installed, it won't be Havok. It's nice to have a familiar language to use, but don't expect actual portability in the near term.
zeshu123 Horsley
Registered User
Join date: 28 Jan 2009
Posts: 15
04-15-2009 01:57
hi guys,
I tried this code in Second life and in opensim both .The code is working fine when prim is moving towards the avatar.But i need the other way like avatar should move towards the prim.Kindly tell me where i should make changes.Thanks for your time and suggestions

key reqid;
vector start;
string name;
integer targetid;
integer number;
vector startpos=<123.25,128.74,22.70>;
vector stoppos=<119.70,124.73,22.71>;
float speed=1.5;
float braking=0.5;
vector target;

default {
touch_start(integer total_number)
{
llSetPos(startpos);
llSetStatus(STATUS_PHYSICS,TRUE);
target=stoppos;
llMoveToTarget(target,speed);
llSay(0,"start from defulat going to l";);
llSensor( "",llGetOwner(), AGENT, 20, PI );
}


sensor(integer total_number)
{
vector pos = llDetectedPos(0);
llMoveToTarget(pos,speed);
}

at_target(integer number,vector outtarget,vector ourpos)
{

llSay(0,"arrived at stopos";);
llTargetRemove(targetid);
target=startpos;
llMoveToTarget(target,speed);

}
}
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
04-15-2009 03:54
To make the avatar move towards a point you need to attach the prim with the script in it to the avatar, or have the avatar sit on the prim like a vehicle. There is a call llPushObject that can be used, but in practice it's pretty much restricted to the landowner because it's been so badly nerfed to keep people from abusing it.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
zeshu123 Horsley
Registered User
Join date: 28 Jan 2009
Posts: 15
04-15-2009 05:25
hi argent,

What i understand from your reply that i have to attached this prim object to the avatar then the avatar will move.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-15-2009 06:35
From: zeshu123 Horsley
hi argent,

What i understand from your reply that i have to attached this prim object to the avatar then the avatar will move.

yes.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-15-2009 07:07
From: zeshu123 Horsley
hi argent,

What i understand from your reply that i have to attached this prim object to the avatar then the avatar will move.

Yes, that's what people told you when you posted exactly the same question in your other thread, too. ;)
zeshu123 Horsley
Registered User
Join date: 28 Jan 2009
Posts: 15
04-16-2009 03:56
when i am attaching the scripted object/prim with the avatar.Then nothing is working if i right click the attachment pie menu appears only detach option is available there.
According to script if i touched the object then it moves towards the other location.Now i attached the object with the avatar ,its not giving me the touch option.

Please help me in this regard
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-16-2009 05:56
just click on it, IIRC touch doesn't show on the pie menu for attachments, but the cursor should change when it's over it.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
zeshu123 Horsley
Registered User
Join date: 28 Jan 2009
Posts: 15
04-16-2009 09:27
hi void,

sorry for bothering you gain.Do you have any sample code regarding my problem so please share with me.Some problem with going on with my logic or with my code.Please help me .
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-16-2009 10:39
From: zeshu123 Horsley
hi void,

sorry for bothering you gain.Do you have any sample code regarding my problem so please share with me.Some problem with going on with my logic or with my code.Please help me .


Five of your global variables (reqid, start, name, number, and braking) are not used anywhere in your code and can be safely removed from the script. Also, you never assign a value to targetid, so your statement llTargetRemove(targetid) won't do anything. Those are just cleanup issues, though. They shouldn't prevent your script from running.

I can't go in world now to field test the script, but it looks like it should work, even before you clean it. If it isn't working, maybe you aren't actually attaching the object that the script is in. Or maybe, as Void suggests, you're simply clicking it the wrong way. Do not right click and look for a pie menu. Just left click. If the object is attached to your avatar, the script should work.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-16-2009 11:26
Ah...... wait..... I spoke too soon. I see several problems.

Why do you have a sensor event in this script? The way you have written it, the llSensor filter is looking to see where your avatar is. Then the sensor event tells the object to move to the avatar's position. If the object is attached to your avatar, however, it won't go anywhere -- it is already AT the place that the sensor wants it to go.

Now that I study your script more closely, I also see that the at_target event is designed to send you immediately back to the startpos. I assume that's not really what you want to do. It's more likely that you want to change parameters so that you return to the first position the next time you touch the TP object --- right? If that's the case, see if this version of the script works. It compiles, but I can't take it in world to test it right now.

CODE

integer targetid;
vector startpos=<123.25,128.74,22.70>;
vector stoppos=<119.70,124.73,22.71>;
float speed=1.5;
vector target;

default
{
state_entry()
{
llSetPos(startpos);
llSetStatus(STATUS_PHYSICS,TRUE);
}

touch_start(integer total_number)
{
target= stoppos;
targetid = llTarget(stoppos, 1.0);
llMoveToTarget(target,speed);
llSay(0,"start from defulat going to l");
}

at_target(integer number,vector outtarget,vector ourpos)
{
llSay(0,"arrived at stopos");
llTargetRemove(targetid);
if (target == <119.70,124.73,22.71>)
{
stoppos=<123.25,128.74,22.70>;
startpos = <119.70,124.73,22.71>;
}
else
{
stoppos = <119.70,124.73,22.71>;
startpos = <123.25,128.74,22.70>;
}
}
}
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-16-2009 13:01
Here's a little afterthought...... It occurs to me that your startpos and stoppos vectors are fine if you are moving a object like a box, but less than ideal if you are moving an avatar and an attached object. Unless you are very accurate with the vertical components of those vectors, you may end up floating above the floor or sinking into it. After all, the exact vertical position will depend on how tall your avatar is. One way to get around the problem might be to change the state_entry event to look like this ....

CODE

state_entry()
{
startpos = llGetPos();
zee = startpos.z;
llSetStatus(STATUS_PHYSICS,TRUE);
}


Be sure that float zee is defined as a global variable, and then substitute it wherever you currently have a numerical value for the third component of startpos or stoppos in the at_target event. That is, instead of <123.25,128.74,22.70> you write <123.25,128.74,zee> and instead of <119.70,124.73,22.71> you write <119.70,124.73,zee>. This ought to work so long as you are only moving a short distance on level ground, as you appear to be.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
04-16-2009 14:53
simple test script, jump av 5m forward, attach and owner touch to activate.

CODE

vector gPosOffset = <5,0,0>;

default{
touch_start( integer vIntTotalTouches ){
if (llGetOwner() == llDetectedKey( 0 )){
llMoveToTarget( llDetectedPos( 0 ) + gPosOffset * llDetectedRot( 0 ), .1 );
}
}
}
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
04-16-2009 17:08
OK, guys.... I got sucked into this little script out of curiosity and now I could use a little help understanding how it works (or doesn't). Here's a modified and stripped-down version of what I posted earlier today. I removed the llSetStatus calls because it occurred to me that the object doesn't need to be physical, and I removed the recalculation of startpos that I had in the at_target event because it dawned on me (duh) that I wasn't using startpos for anything except getting a value of zee anyway. Oh, and I added llStopMoveToTarget() so that the script would stop trying to pull me back to the stoppos target if I decided to step away in between touch_start events.

CODE

integer targetid;
vector startpos=<30.0,73.0,32.0>;
vector stoppos=<21.0,71.0,32.0>;
float speed=2.5;
vector target;
float zee;
default
{
state_entry()
{
startpos = llGetPos();
zee = startpos.z;
}
touch_start(integer total_number)
{
if (llGetOwner() == llDetectedKey(0))
{
target= stoppos;
targetid = llTarget(stoppos, 1.0);
llMoveToTarget(target,speed);
}
}
at_target(integer number,vector outtarget,vector ourpos)
{
llTargetRemove(targetid);
llStopMoveToTarget();
if (target == <21.0,71.0,zee>)
{
stoppos=<30.0,73.0,zee>;
}
else
{
stoppos = <21.0,71.0,zee>;
}
}
}


I tried it out in world in an object worn as an attachment. It works nicely, but does two things I hadn't anticipated:

1. If I set the range in llTarget to anything less than 1.0, the script doesn't do a thing.
2. When I let the script move me to stoppos = <30.0,73.0,zee>, I get there. When I expect it to take me to stoppos=<30.0,73.0,zee>, it gets me to <29.0,72.0,zee> and thinks I have arrived.

Any guesses why?

Also, it would be most cool if this script let me actually face the stoppos target while I'm walking toward it. I'm new at this sort of problem, so I'm not sure how to do that. Help? :confused:
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
04-16-2009 17:35
targetid = llTarget(stoppos, 1.0);

llTarget is only as exact as the range you define it, in this case; 1 meter. Try 0.3 or so and then lower it from there.

"integer llTarget(vector position, float range)

Defines a target within range of position.

While the object with the task is outside range of position, not_at_target events will be raised.

Upon coming inside range of position, an at_target event will be raised"

EDIT: You might need to put a timer event in there also to remove the target in case something blocks the av from reaching it's destination.

EDIT EDIT: Just saw your footnote on less then 1.0. Guess some work needs to be done in the at target. I'll pop in and give it a go. Think I know what will work.
_____________________
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
1 2