Vade Blair
Tattoo Artist
Join date: 19 Mar 2004
Posts: 132
|
09-04-2004 17:35
I have a somewhat simple problem. I would like a user to say "height XXX" and have an object move to that position. Any idea on how I could do this? I was thinking llsetpos but from what I read, that has it's limits.
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
09-04-2004 17:44
llSetPos has a limit of 512m in total height and 10m of movement per 0.2 seconds. list listmessage = []; vector loca; float ground;
GoTo(vector dest) { ground = llGround(ZERO_VECTOR); if(dest.z > 512) { llSay(0,"Error! Can not go that high!"); } else if(ground > dest.z) { llSay(0,"Error! Ground only " + (string)ground + " high!"); } else while(dest != llGetPos()) { llSetPos(dest); } }
default { state_entry() { llListen(0,"",NULL_KEY,""); } listen(integer channel,string name, key id, string message) { listmessage = llParseString2List(message,[" "],[]); if(llList2String(listmessage,0) == "height") { loca = llGetPos(); GoTo(<loca.x,loca.y,llList2Float(listmessage,1)>); } } }
I didn't put in a check for the ground height, but... *shrug* I'm lazy. EDIT: Ok, I put the ground height check in, because I hate doing a half-assed job. EDIT2: Because everything in LSL is fucked up and some things take offsets while others take global coords with no rhyme or reason whatsoever.
_____________________
</sarcasm>
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
09-04-2004 18:04
Mol, llGround accepts an offset from the object's current position. llGround(llGetPos()) doesnt actually get the ground height at the location the object is currently at. llGround(ZERO_VECTOR) would do that. (Unless something has changed since Ive been gone  ) ==Chris
|
Vade Blair
Tattoo Artist
Join date: 19 Mar 2004
Posts: 132
|
09-04-2004 18:15
Very good, only problem was when I re-rezed it, it moved back to where it was before, easy fix... llGetpos() in state_entry.
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
09-04-2004 18:27
There. Fixed it so it works right. Stupid LSL.
_____________________
</sarcasm>
|
Vade Blair
Tattoo Artist
Join date: 19 Mar 2004
Posts: 132
|
09-04-2004 18:30
My fix did not work :/ after using height, you will never be able to use it again.
|
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
|
09-04-2004 21:33
Whaaat? You sure about that? Lemme go check.
EDIT: You must be using some other script at the same time in there or something. I copy/pasted that into an object, left it EXACTLY the way it was, no editing whatsoever, and it worked fine, even if I Took it and re-rezzed it.
_____________________
</sarcasm>
|