Tighern McDonnell Posted February 13, 2013 Share Posted February 13, 2013 I am making a hud and a in-world relay for a role play system. I already know I will be using llRegionSayTo a bit but what I am trying to figure out is how to pass a message to the relay. Example the user click button A on the hud and it calls to the relay to exicute "if" statement A but i need to pass the user's key as well. Would this be where I would use a list? I know nothing about lists at this point so will have to read up on the wiki on them if that is the case. Is there an easier way of doing this? example would be.... hud button A sends a beamup command to the relay and the relay passes it on to the teleporter. the beamup command consists of "beamup " + llGetDisplayName(llDetectedKey(0))could i just have that sent as a string (which it is) and then repeated by the relay? when it repeats it it would pass on "beamup Tighern McDonnell" which would work just fine. Would that be the easiest way? Link to comment Share on other sites More sharing options...
Dora Gustafson Posted February 13, 2013 Share Posted February 13, 2013 Anything you say will be in string format You can't say anything that isn't So your suggestion is just fine But what you wrote will not pass the key, this will: "beamup " + (string)llDetectedKey(0) If you include a comma it will be more easy to decode on the reciever side "beamup "+"," + (string)llDetectedKey(0) See llCSV2List() and llParseString2List() :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
Innula Zenovka Posted February 13, 2013 Share Posted February 13, 2013 If you need to send the user's key, I suggest that's what you do, in the form of llRegionSayTo(relay,someChannel,"beamup"+"," +(string)llGetOwner()); (that's assuming it's a hud, so it must be the owner touching it). Then the relay can decode it in the listen event. It knows that the string before the comma is a command and the string after the comma is a uuid, so it can cast it as a key do what it likes with it listen(integer channel, string name, key id, string message) { list temp = llParseString2List(message,[",",[]); if ("beamup"==llList2String(temp,0)){ key who = (key) llList2String(temp,1); if(who){//check it's a valid key //do stuff, eg string whatName= llGetDisplayName(who); } } } Link to comment Share on other sites More sharing options...
Tighern McDonnell Posted February 14, 2013 Author Share Posted February 14, 2013 Excellent. Thank you. The list part works very well. I have the command option as the first part and that trigers the if statement in the relay to tell it which object to send the information to. Oh this is turning out be be a very fun project. Learning a lot of things to make it happen. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now