KiondraeLoc Posted April 27, 2019 Share Posted April 27, 2019 This is the script I have in my hud: string TargetName = "n"; default { state_entry() { // run this code when entering the default state // displays red "OFF" as floating text above the prim llRegionSay(3, "off"); llSetText("OFF", <1,0,0>, 1.0); llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA); llClearCameraParams(); llSetTimerEvent(0.0); } touch_start(integer num_detected) { // when touched, switch to state named 'on' state on; llRegionSayTo("n", 3, "on"); } } state on { state_entry() { llRegionSay( 3, "on"); // run this code when entering state 'on' // displays green "ON" as floating text above the prim llSetText("ON", <0,1,0>, 1.0); llRequestPermissions(llGetOwner(), PERMISSION_CONTROL_CAMERA); llSetTimerEvent(0.022); llListen(4, "","", ""); } touch_start(integer num_detected) { // when touched, switch to the default state state default; } listen(integer channel, string name, key id, string message) { if(llGetPos()) { list data = llGetObjectDetails(TargetName, [OBJECT_POS, OBJECT_ROT]); vector pos = llList2Vector(data, 0); rotation rot = llList2Rot(data, 1); llSetCameraParams([ CAMERA_ACTIVE, TRUE, CAMERA_FOCUS_LOCKED, TRUE, CAMERA_POSITION_LOCKED, TRUE, CAMERA_FOCUS, pos, CAMERA_POSITION, pos + (<0, -2, 1> * rot) ]); } } } This is the script I have in my RC Flying Drone: string TargetName = "n"; default{ on_rez(integer r){ llResetScript(); } state_entry() { llListen(3, "","", ""); } listen(integer channel, string name, key id, string message) { if (llGetOwner() != llGetOwnerKey(id)) {return;} if(message == "on") { llSetTimerEvent(0.05); } if (message == "off") { llSetTimerEvent(0.0); } } timer() { llSetObjectName(TargetName); llRegionSay(4,(string)llGetPos()); } } How can I get the camera to track the object and not the bottom left corner of the sim at <0,0,0>? I don't want to use the object uuid, I want to use the name of the object to track on a channel so I don't have to keep changing the uuid of my object every time I rez it. Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 27, 2019 Share Posted April 27, 2019 I'm not quite sure what you are asking for, but when I design something like this, I make the HUD be the rezzer that generates the drone. That way, I automatically know the UUID of the drone as it is created, from the result of an object_rez event. 2 Link to comment Share on other sites More sharing options...
steph Arnott Posted April 27, 2019 Share Posted April 27, 2019 12 minutes ago, Rolig Loon said: I'm not quite sure what you are asking for, but when I design something like this, I make the HUD be the rezzer that generates the drone. That way, I automatically know the UUID of the drone as it is created, from the result of an object_rez event. Am somewhat confused at the OPs request myself seeing as that is what the object_rezz event is for. Link to comment Share on other sites More sharing options...
steph Arnott Posted April 27, 2019 Share Posted April 27, 2019 What does this do? listen(integer channel, string name, key id, string message) { if(llGetPos()) Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 27, 2019 Share Posted April 27, 2019 14 minutes ago, steph Arnott said: What does this do? listen(integer channel, string name, key id, string message) { if(llGetPos()) Literally? It says, "If my present location is not <0,0,0>, go ahead and do stuff ..." Link to comment Share on other sites More sharing options...
steph Arnott Posted April 27, 2019 Share Posted April 27, 2019 Just now, Rolig Loon said: Literally? It says, "If my present location is not <0,0,0>, go ahead and do stuff ..." But what is the point? Maybe i am half asleep because i just do not get it. Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 27, 2019 Share Posted April 27, 2019 Just now, steph Arnott said: But what is the point? Maybe i am half asleep because i just do not get it. Oh, I have no idea. Personally, I would not want a HUD that only works if I happen to be standing at <0,0,0>. Link to comment Share on other sites More sharing options...
steph Arnott Posted April 27, 2019 Share Posted April 27, 2019 7 minutes ago, Rolig Loon said: Oh, I have no idea. Personally, I would not want a HUD that only works if I happen to be standing at <0,0,0>. The odds of that are higher than you being the first woman on the moon. 1 Link to comment Share on other sites More sharing options...
Madelaine McMasters Posted April 27, 2019 Share Posted April 27, 2019 (edited) 13 minutes ago, Rolig Loon said: Oh, I have no idea. Personally, I would not want a HUD that only works if I happen to NOT be standing at <0,0,0>. Which is pretty much anywhere. I think the OP misunderstands llGetPos() as being the position of the drone, relayed to the HUD via llRegionSay in the timer event. The HUD's listen event makes no reference to the message it receives, and the only thing the drone says is its position. If the HUD were actually looking at the message, I don't think the OP would be asking this particular question. Edited April 27, 2019 by Madelaine McMasters Link to comment Share on other sites More sharing options...
Rolig Loon Posted April 27, 2019 Share Posted April 27, 2019 10 minutes ago, Madelaine McMasters said: I think the OP misunderstands llGetPos() as being the position of the drone, relayed to the HUD via llRegionSay in the timer event. The HUD's listen event makes no reference to the message it receives, and the only thing the drone says is its position. If the HUD were actually looking at the message, I don't think the OP would be asking this particular question. Yup, and I was hoping that the OP would figure that out for herself. 😉 Link to comment Share on other sites More sharing options...
steph Arnott Posted April 27, 2019 Share Posted April 27, 2019 (edited) 3 hours ago, Madelaine McMasters said: Which is pretty much anywhere. I think the OP misunderstands llGetPos() as being the position of the drone, relayed to the HUD via llRegionSay in the timer event. The HUD's listen event makes no reference to the message it receives, and the only thing the drone says is its position. If the HUD were actually looking at the message, I don't think the OP would be asking this particular question. Would make more sense doing this. listen(integer channel, string name, key id, string message) { if(name == "whatever_it_called") { llOwnerSay( (string) id );//use this data for whatever purpose. Make it a global variable if you want to. } } Edited April 27, 2019 by steph Arnott data collection output. 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