i would like to display a shortened vector destination on my teleporter like 100,203,700 for example
but i actually end up with something much longer like
<0.00000,0.000000,0.00000>
5 digits each for the x y z
so anybody know how to go about this?
These forums are CLOSED. Please visit the new forums HERE
VECTOR <0.00000,0.000000,0.00000> |
|
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-14-2009 09:10
i would like to display a shortened vector destination on my teleporter like 100,203,700 for example
but i actually end up with something much longer like <0.00000,0.000000,0.00000> 5 digits each for the x y z so anybody know how to go about this? |
Pete Littlebird
Registered User
Join date: 30 Sep 2009
Posts: 44
|
10-14-2009 09:19
string IntegerVector (vector v)
{ return "<" + (integer) (v.x + 0.5) + ", " + (integer) (v.y + 0.5) + ", " + (integer) (v.z + 0.5) + ">"; } |
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-14-2009 09:34
getting a error type mismatch
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
10-14-2009 09:49
I don't see a problem with Pete's code. You certain you are passing a vector type variable into the function and not accidentally passing in the vector string?
|
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-14-2009 09:52
i havent tried testing the function yet,
i just cant save it |
Viktoria Dovgal
…
![]() Join date: 29 Jul 2007
Posts: 3,593
|
10-14-2009 09:55
You can't add strings to integers like that, use a second cast to string, or llDumpList2String.
|
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
|
10-14-2009 10:02
Ah, I believe Viktoria is right. I figured it would implicitly cast the integer to a string, but I guess it doesn't.
Try: string IntegerVector (vector v) { return "<" + (string)((integer) (v.x + 0.5)) + ", " + (string)((integer) (v.y + 0.5)) + ", " + (string)((integer) (v.z + 0.5)) + ">"; } |
QueenHeather Hancroft
Registered User
Join date: 26 Sep 2008
Posts: 20
|
10-14-2009 10:09
yup works good, thank you
|
Argent Stonecutter
Emergency Mustelid
![]() Join date: 20 Sep 2005
Posts: 20,263
|
10-14-2009 10:34
You can also use (string)llRound(v.x) instead of (string)((integer)(v.x+0.5)).
_____________________
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 |
Meade Paravane
Hedgehog
![]() Join date: 21 Nov 2006
Posts: 4,845
|
10-14-2009 11:04
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224 - If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left |
Pete Littlebird
Registered User
Join date: 30 Sep 2009
Posts: 44
|
10-14-2009 11:34
Sorry about my mistake; FWIW, I did check the function in LSLEditor 2.39 which issued no warning or errors and produced the desired results.
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
10-14-2009 14:33
For your voting enjoyment: http://jira.secondlife.com/browse/SVC-3084. |