|
Jolan Nolan
wannabe
Join date: 12 Feb 2006
Posts: 243
|
01-09-2007 09:08
I have a teleporter that sends to multiple destinations. The destination is changed by telling it through a channel the new coordinates, or that is the idea. I do not know how to get llListen to pick up the vector coordinates rather than a string message. Would it be easier to split them up into pos.x, pos.y and pos.z, send them one at a time, and then reassemble in the teleport script?
(The coordinates are stored in a controller on the HUD and when you click one, it would set the teleporter's destination.)
- Jolan
|
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
01-09-2007 09:23
type cast what is said into a vector the following example works only if the input is given in a "<x,y,z>" format. I believe if some other value is given that typcasting sets it to the zero equivalent for whatever variable class it is typecasting to: listen(integer channel, string name, key id, string message) { vector destination = (vector)message; if(destination==<0,0,0> && (string)destination!=message)//checks if the ZERO_VECTOR value was intentional or the cause of an invalid vector. { llInstantMessage(id,"You entered an invalid set of coordinates"); } else { llInstantMessage(id,"Changing target to " + message + "."); llSetSitTarget(newdestination,ZERO_ROTATION); } }
*note I did not test this in-game so I cannot garauntee that this will work and/or compile, but it should give a good idea of how to go about setting up a listen. **I see that these coordinates are being broadcast from a HUD. in that case you would want to change the "id" in the llInstantMessage to "llGetOwner(id)" so that the IM goes to the owner of the HUD.
_____________________
My SLExchange shopTypos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not. The function is working perfectly fine. It's just not working the way you wanted it to work.
|
|
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
|
01-09-2007 11:29
Type-casting a string to a vector can be tricky. I think what's posted above is close, but I'm pretty sure (I'm at work so like the above poster I cannot verify atm) that you would have to parse the string to a list, and then type-cast each value of the list as a float, then save that to a vector.
|
|
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
|
01-09-2007 13:41
From: Tiarnalalon Sismondi Type-casting a string to a vector can be tricky. I think what's posted above is close, but I'm pretty sure (I'm at work so like the above poster I cannot verify atm) that you would have to parse the string to a list, and then type-cast each value of the list as a float, then save that to a vector. they changed it so a simple typecast of string to vector works now. there's a blurb at the end of here about it.
_____________________
My SLExchange shopTypos are forgiven; desecrating the english language with reckless abandon and necrophilic acts is not. The function is working perfectly fine. It's just not working the way you wanted it to work.
|