Jump to content

LeonissiaLoc

Resident
  • Content Count

    24
  • Joined

  • Last visited

Everything posted by LeonissiaLoc

  1. How can I get llGetObjectDetails(); to track the name of a remote prim instead of the key?
  2. Can llSetLinkPrimitiveParamsFast(); be used inside a timer function to make the base of the turret track the avatar selected in the dialogue? Note: the base is a separate prim in the link set and the barrel isn't the root prim. They are both connected to a separate block.
  3. What can I use to get the turret to not shoot the owner or the house, but only the target? Something that will make the turret stop shooting on the timer and then continue shooting after the obstacle is no longer in the way.
  4. Is there a way to have two timers in a script like this: integer index; default { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { llSay(0, "Touched."); } timer() { } timer(index) { } }
  5. We can be glad there is an endless amount of puzzles to solve with this. That's interesting.
  6. I defined integer index; in the global variable and now it looks at the right avatar when I select it. I had to study LSL Variables to figure out how to do it. I was just stressing out over it because it seemed impossible to define index as a global variable and then change it later in the script. Thank you for your help, I couldn't have figured that out without it. It was a lesson to go back to basics. I will do further testing to make sure everything works right.
  7. When did LSL finally click for you?
  8. All this code does is list my avatar first followed by the rest in the list at the same time when I select one from the list: integer index = llListFindList(uuid,[]); key kTarget = llList2Key(uuid,index); vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); llLookAt(vPos + (vTargetPos + <0.0, 0.0, 0.0> - vPos) / llGetRootRotation(), 1.0, 0); It does the same thing even before even before the timer starts in the listen event in this bit of code with the llOwnerSay() Test: listen(integer channel, string obj, key id, string message) { list uuid = llList2ListStrided(Names, 0, -1, 2); integer index = llListFindList(Names, [message]); if (index != -1) { llSetTimerEvent(0.05); } } I think the problem is somewhere in the listen event or it could be in the sensor event because I have the same issue throughout the entire script. It doesn't zero in on the avatar I select It just keeps going at the avatar sensed first and ignores the one I select. Do I need to rewrite the script again or is there something that I failed to study properly? Could it be something simple that I forgot to include? At this point, I'm not really sure what to do.
  9. When there are avatars in the region, it's returning all keys with llOwnerSay(llList2CSV(uuid)); and all names with llOwnerSay(llList2CSV(Names)); at the same time. What should I do to get it to read only the one I select from the llDialog()?
  10. I don't know what to do to get this thing to work. I studied the strided list and I can select the avatar with just the names list. I put the uuid list in there because I can't get the llLookAt() to work with only one list. At "integer index = llListFindList(uuid,[]);" is the only way to track the avatar selected but my avatar is still the one targeted no matter who I select. How do I know what to look up and study so I can fix this what seems to be an impossible challenge? I looked up the functions, but I don't get this. Thanks for your help, any guidance is appreciated. list Names; list uuid; default { state_entry() { llListen(10, "", llGetOwner(), ""); llSensorRepeat("", "", AGENT, 96.0, PI, 0.2); } touch_start(integer detected) { if (llDetectedKey(0) == llGetOwner()) { llSetTimerEvent(0.0); llListenRemove(10); llSensorRemove(); llSensor("","",AGENT,96,PI); llDialog(llDetectedKey(0), "Choose an avatar...", Names, 10); } } sensor(integer allAvatars) { integer o; key Id; Names = []; uuid = []; o = 0; while ((o < allAvatars) && (o < 12)) { Id = llDetectedKey(o); uuid = uuid + Id; Names = Names + llKey2Name(Id); o = o+1; } } listen(integer channel, string obj, key id, string message) { list uuid = llList2ListStrided(Names, 0, -1, 2); integer index = llListFindList(Names, [message]); if (index != -1) { llSetTimerEvent(0.05); } } timer() { integer index = llListFindList(uuid,[]); key kTarget = llList2Key(uuid,index); vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); llLookAt(vPos + (vTargetPos + <0.0, 0.0, 0.0> - vPos) / llGetRootRotation(), 1.0, 0); } }
  11. When I am hammering code, I'm also looking up the functions. I seem to not be able to understand what seems to be abstract. Anything with a practical sense or what I've already reverse engineered I can figure out pretty easily. I guess I need to read the wiki about the functions two million times and ask y'all about it for me to get it to click.
  12. After I study LSL long enough and it clicks, will I be able to program anything I think of? Is it the same for all programming languages? How do you know what to do when you get stuck for lack of knowledge and don't know what to look up? Do I just ask on here on how to program a billion different scripts until I finally get it? How does all this work? I don't understand why this is so complicated to wrap my head around. How did y'all do it? Thanks for all the help thus far.
  13. I got my new script to do the basic select avatars and use one list instead of two. What do I need to study to get the listen event to receive the avatar tracking info when I select an avatar?
  14. Thanks for that. I will research it to see what I can come up with.
  15. I was trying to do two different things with the same script. The other post was me trying to replace the sensor with llGetAgentList();, but then I discovered that my current script has a targeting issue with the sensor so it probably wouldn't work right with llGetAgentList(); not until I can get the targeting to work with the sensor. I'm trying to use this to learn how all the functions work together and understand how the math works. I'm not asking that anyone do the work for me. I'm looking for help kinda like what I found in this example. I just don't know how to speak LSL effectively yet. I understand a lot of the logic part, but it's the math that is stumping me the most. I keep looking and looking at the script, researching the different functions and I still can't get my head around it. I may be pushing myself a little too much and I'm just missing something. If this is the wrong way to go about asking for help, please let me know. I don't want to come off like I'm trying to get y'all to do the work for me, I want to learn how this works. Any advice is appreciated and I understand beginners like me make a lot of mistakes and y'all probably get a bunch of people trying to get ya'll to do the work for them, I don't want to be like that. Thank you.
  16. How can I get this to target another avatar instead of me when I select a foreign target? I tried a lot of stuff with it and can't get it to work. Thanks. integer listener; integer sensorChannel; list avatarsKeys; list avatarsNames; integer touched; menu(key user,integer channel,string title,list buttons) { listener = llListen(channel,"","",""); llDialog(user,title,buttons,channel); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { llSensor("","",AGENT,96,PI); } } sensor(integer total_number) { integer i; key tempId; avatarsKeys = []; avatarsNames = []; i = 0; while ((i < total_number) && (i < 12)) { tempId = llDetectedKey(i); avatarsKeys = avatarsKeys + tempId; avatarsNames = avatarsNames + llKey2Name(tempId); i = i+1; } sensorChannel = randomNumber(); menu(llGetOwner(),sensorChannel,"Select an avatar...",avatarsNames); } listen(integer channel,string name,key id,string message) { if (channel == sensorChannel) { llSetTimerEvent(0.05); } } touch(integer total_number) { llSetTimerEvent(0.0); } timer() { integer index = llListFindList(avatarsNames,[]); key kTarget = llList2Key(avatarsKeys,index); vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); llLookAt(vPos + (vTargetPos + <0.0, 0.0, 0.0> - vPos) / llGetRootRotation(), 1.0, 0); list hit = llCastRay(vPos, vTargetPos, []); if( llKey2Name(llList2Key(hit, 0)) != "RC" ) { llRezObject("bullet", llGetPos()+<0,0,3>*llGetRot(),<0,0,20>*llGetRot(),llGetRot(),0); } if( llGetOwnerKey(llList2Key(hit, 0)) == llGetOwner() ) { return; } } }
  17. I found this script that does the basics. Now I'm trying to add X and Y coordinates to detected avatars. I came across this on the wiki: vector vec; float x = vec.x; float y = vec.y; float z = vec.z; So I added it to this script I found under llGetAgentList() under a Google Search: Untouched Script: // Tiaeld Tolsen @ TT Industries - llGetAgentList sim-wide radar/Radar de todo el sim de llGetAgentList //Based in the new llGetAgentList LSL Function (https://jira.secondlife.com/browse/SVC-6427) this is a little //gadget capable to work as an (almost)zero-lag sim-wide radar. Currently, llGetAgentList is only available on the //3 RC Simulator Channels (Magnum, BlueSteel, LeTigre) and it will be hopely deployed for the rest of the grid in a //couple of days. //This script can't be sold and any variation of it must contain my name as the original creator. //More info at: http://creativecommons.org/licenses/by-nc-sa/3.0/ //---------------------------------------------------------------------------------- //Basado en la nueva función de LSL llGetAgentList (https://jira.secondlife.com/browse/SVC-6427) este pequeño //aparato puede funcionar como un radar para todo el sim con (casi) cero lag. Actualmente, llGetAgentList sólo está //disponible en los 3 canales RC (Magnum, BlueSteel, LeTigre) y esperemos que sea repartido al resto del grid en un //par de días. //Este script no puede ser vendido y cualquier variación del mismo debe contener mi nombre como el creador original. //Más información en: http://creativecommons.org/licenses/by-nc-sa/3.0/ //We'll need this later / Necesitaremos esto después list lTemp; list lTemp2; integer iTemp; integer iPrims; integer iOn; //WARNING: Not-so begineer-scripter friendly code ahead, be careful. //CUIDADO: Código no tan amigable para scripters novatos adelante, tener cuidado. clean() { //We clean the remaining cells. / Limpiamos las celdas restantes. llSetLinkPrimitiveParamsFast(LINK_ALL_OTHERS, [PRIM_TEXT, "", <1., 1., 1.>, 1.]); } default { state_entry() { clean(); llSetText("TT Industries\nSimwide Radar\nOFF", <1., .2, .2>, 1.); //We'll need this to iterate across all the prims. //Necesitaremos esto para recorrer todos los prims. iPrims = llGetNumberOfPrims(); } touch_start(integer n) { if(iOn = !iOn) { llOwnerSay("Radar ON"); llSetText("TT Industries\nSimwide Radar\nON", <.6, .8, 0.>, 1.); //This is a reasonable time to the script to do it's job. //Es un tiempo razonable para dejar trabajar al script. llSetTimerEvent(.2); } else { llOwnerSay("Radar OFF"); llSetText("TT Industries\nSimwide Radar\nOFF", <1., .2, .2>, 1.); llSetTimerEvent(0.); clean(); } } timer() { //This is where magic start, thanks to the new llGetAgentList. //Aquí empieza la magia, gracias al nuevo llGetAgentList. lTemp = (lTemp = []) + (lTemp2 = []) + llGetAgentList(AGENT_LIST_REGION, []); iTemp = lTemp!=[]; //In case we got some kind of error, stop everything. //En caso de tener algún error, paramos todo. if(llGetListEntryType(lTemp, 0)==TYPE_STRING) { llOwnerSay("Error: " + llList2String(lTemp, 0)); iOn = FALSE; llSetTimerEvent(0.); return; } //We start filling our new list with the name and distance from ourselves. //Empezamos llenando nuestra nueva lista con los nombres y la distancia hacia nosotros. while(iTemp--) lTemp2 = [llVecDist(llList2Vector(llGetObjectDetails(llList2Key(lTemp, iTemp), [OBJECT_POS]), 0), llGetPos()), llKey2Name(llList2Key(lTemp, iTemp))] + lTemp; //Since results are unsorted, we sort them. //Ya que los resultados están desordenados, los ordenamos. lTemp2 = llListSort(lTemp2, 2, TRUE); //If there are more results than cells, we cap their number. //Si hay más resultados que celdas, cortamos su número. if((iTemp = lTemp!=[]) > iPrims) iTemp = iPrims; //We start drawing every cell with our info. //Empezamos a dibujar cada celda con nuestra información while(--iTemp) llSetLinkPrimitiveParamsFast(iTemp+1, [PRIM_TEXT, llList2String(lTemp2, (iTemp*2)+1) + ": " + (string)llList2Integer(lTemp2, iTemp*2) + " m.",<1., 1., 1.>, 1.]); //We clean remaining cells in linkset. //Limpiamos las celdas restantes en el linkset. iTemp = lTemp!=[]; while(iTemp++ < iPrims) llSetLinkPrimitiveParamsFast(iTemp,[PRIM_TEXT, "", <1., 1., 1.>, 1.]); } //Update the interface in case we need it. //Limpiamos la interface en caso lo necesitemos. on_rez(integer s) { clean(); } changed(integer change) { if(change & CHANGED_REGION) clean(); else if(change & CHANGED_LINK) iPrims = llGetNumberOfPrims(); } } Touched Script: // Tiaeld Tolsen @ TT Industries - llGetAgentList sim-wide radar/Radar de todo el sim de llGetAgentList //Based in the new llGetAgentList LSL Function (https://jira.secondlife.com/browse/SVC-6427) this is a little //gadget capable to work as an (almost)zero-lag sim-wide radar. Currently, llGetAgentList is only available on the //3 RC Simulator Channels (Magnum, BlueSteel, LeTigre) and it will be hopely deployed for the rest of the grid in a //couple of days. //This script can't be sold and any variation of it must contain my name as the original creator. //More info at: http://creativecommons.org/licenses/by-nc-sa/3.0/ //---------------------------------------------------------------------------------- //Basado en la nueva función de LSL llGetAgentList (https://jira.secondlife.com/browse/SVC-6427) este pequeño //aparato puede funcionar como un radar para todo el sim con (casi) cero lag. Actualmente, llGetAgentList sólo está //disponible en los 3 canales RC (Magnum, BlueSteel, LeTigre) y esperemos que sea repartido al resto del grid en un //par de días. //Este script no puede ser vendido y cualquier variación del mismo debe contener mi nombre como el creador original. //Más información en: http://creativecommons.org/licenses/by-nc-sa/3.0/ //We'll need this later / Necesitaremos esto después list lTemp; list lTemp2; integer iTemp; integer iPrims; integer iOn; //WARNING: Not-so begineer-scripter friendly code ahead, be careful. //CUIDADO: Código no tan amigable para scripters novatos adelante, tener cuidado. clean() { //We clean the remaining cells. / Limpiamos las celdas restantes. llSetLinkPrimitiveParamsFast(LINK_ALL_OTHERS, [PRIM_TEXT, "", <1., 1., 1.>, 1.]); } default { state_entry() { clean(); llSetText("TT Industries\nSimwide Radar\nOFF", <1., .2, .2>, 1.); //We'll need this to iterate across all the prims. //Necesitaremos esto para recorrer todos los prims. iPrims = llGetNumberOfPrims(); } touch_start(integer n) { if(iOn = !iOn) { llOwnerSay("Radar ON"); llSetText("TT Industries\nSimwide Radar\nON", <.6, .8, 0.>, 1.); //This is a reasonable time to the script to do it's job. //Es un tiempo razonable para dejar trabajar al script. llSetTimerEvent(.2); } else { llOwnerSay("Radar OFF"); llSetText("TT Industries\nSimwide Radar\nOFF", <1., .2, .2>, 1.); llSetTimerEvent(0.); clean(); } } timer() { //This is where magic start, thanks to the new llGetAgentList. //Aquí empieza la magia, gracias al nuevo llGetAgentList. lTemp = (lTemp = []) + (lTemp2 = []) + llGetAgentList(AGENT_LIST_REGION, []); iTemp = lTemp!=[]; //In case we got some kind of error, stop everything. //En caso de tener algún error, paramos todo. if(llGetListEntryType(lTemp, 0)==TYPE_STRING) { llOwnerSay("Error: " + llList2String(lTemp, 0)); iOn = FALSE; llSetTimerEvent(0.); return; } vector pos; float x = vec.x; float y = vec.y; float z = vec.z; //We start filling our new list with the name and distance from ourselves. //Empezamos llenando nuestra nueva lista con los nombres y la distancia hacia nosotros. while(iTemp--) lTemp2 = [llVecDist(llList2Vector(llGetObjectDetails(llList2Key(lTemp, iTemp), [OBJECT_POS]), 0), pos), llKey2Name(llList2Key(lTemp, iTemp))] + lTemp; //Since results are unsorted, we sort them. //Ya que los resultados están desordenados, los ordenamos. lTemp2 = llListSort(lTemp2, 2, TRUE); //If there are more results than cells, we cap their number. //Si hay más resultados que celdas, cortamos su número. if((iTemp = lTemp!=[]) > iPrims) iTemp = iPrims; //We start drawing every cell with our info. //Empezamos a dibujar cada celda con nuestra información while(--iTemp) llSetLinkPrimitiveParamsFast(iTemp+1, [PRIM_TEXT, llList2String(lTemp2, (iTemp*2)+1) + ": " + (string)llList2Integer(lTemp2, iTemp*2) + " m.",<1., 1., 1.>, 1.]); //We clean remaining cells in linkset. //Limpiamos las celdas restantes en el linkset. iTemp = lTemp!=[]; while(iTemp++ < iPrims) llSetLinkPrimitiveParamsFast(iTemp,[PRIM_TEXT, "", <1., 1., 1.>, 1.]); } //Update the interface in case we need it. //Limpiamos la interface en caso lo necesitemos. on_rez(integer s) { clean(); } changed(integer change) { if(change & CHANGED_REGION) clean(); else if(change & CHANGED_LINK) iPrims = llGetNumberOfPrims(); } } I tried to replace llGetPos() with pos, but I'm not sure how to integrate x and y coordinates. The script already does distance. Later I'm gonna try to get the linked spheres to track the avatars in a cube frame. Can someone give me some advice on this? I'm trying to learn how to do this, thank you.
  18. So far I have this, but I'm having trouble figuring out the avatarsName part. integer listener; integer sensorChannel; list avatarsKeys; list avatarsNames; integer touched; menu(key user,integer channel,string title,list buttons) { listener = llListen(channel,"","",""); llDialog(user,title,buttons,channel); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { touch_start(integer total_number) { list avatarsInRegion = llGetAgentList(AGENT_LIST_REGION, []); integer numOfAvatars = llGetListLength(avatarsInRegion); // if no avatars, abort avatar listing process and give a short notice if (!numOfAvatars) { llOwnerSay("No avatars found within the region!"); return; } integer i; key tempId; avatarsKeys = []; avatarsNames = []; i = 0; integer index; while ((i < total_number) && (i < 12)) { tempId = llDetectedKey(i); avatarsKeys = avatarsKeys + tempId; avatarsNames = avatarsNames + llKey2Name(tempId); i = i+1; key id = llList2Key(avatarsInRegion, index); string name = llKey2Name(id); llOwnerSay(name + " [ " + (string)id + " ]"); ++index; } sensorChannel = randomNumber(); menu(llGetOwner(),sensorChannel,"Select an avatar...",avatarsInRegion); } listen(integer channel,string name,key id,string message) { if (channel == sensorChannel) { llSetTimerEvent(0.05); } }touch(integer total_number) { llSetTimerEvent(0.0); llListenRemove(0); } timer() { integer index = llListFindList(avatarsNames,[]); key kTarget = llList2Key(avatarsKeys,index); vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); llLookAt(vPos + (vTargetPos + <0.0, 0.0, 0.0> - vPos) / llGetRootRotation(), 1.0, 0); list hit = llCastRay(vPos, vTargetPos, []); if( llKey2Name(llList2Key(hit, 0)) != "RC" ) { llRezObject("bullet", llGetPos()+<0,0,3>*llGetRot(),<0,0,20>*llGetRot(),llGetRot(),0); } if( llGetOwnerKey(llList2Key(hit, 0)) == llGetOwner() ) { return; } } }
  19. I want to make a 3D radar that has the spheres linked to it to track avatars in the entire region. I also want the radar to be linked to a moving vehicle. Plus I want to be able to select the avatars from a dialog and send them an object. How would I go about doing this?
  20. How can I get this to detect avatars using llGetAgentList? integer listener; integer sensorChannel; list avatarsKeys; list avatarsNames; integer touched; menu(key user,integer channel,string title,list buttons) { listener = llListen(channel,"","",""); llDialog(user,title,buttons,channel); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { llSensor("","",AGENT,96,PI); } } sensor(integer total_number) { integer i; key tempId; avatarsKeys = []; avatarsNames = []; i = 0; while ((i < total_number) && (i < 12)) { tempId = llDetectedKey(i); avatarsKeys = avatarsKeys + tempId; avatarsNames = avatarsNames + llKey2Name(tempId); i = i+1; } sensorChannel = randomNumber(); menu(llGetOwner(),sensorChannel,"Select an avatar...",avatarsNames); } listen(integer channel,string name,key id,string message) { if (channel == sensorChannel) { llSetTimerEvent(0.05); } } touch(integer total_number) { llSetTimerEvent(0.0); } timer() { integer index = llListFindList(avatarsNames,[]); key kTarget = llList2Key(avatarsKeys,index); vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); llLookAt(vPos + (vTargetPos + <0.0, 0.0, 0.0> - vPos) / llGetRootRotation(), 1.0, 0); list hit = llCastRay(vPos, vTargetPos, []); if( llKey2Name(llList2Key(hit, 0)) != "RC" ) { llRezObject("bullet", llGetPos()+<0,0,3>*llGetRot(),<0,0,20>*llGetRot(),llGetRot(),0); } if( llGetOwnerKey(llList2Key(hit, 0)) == llGetOwner() ) { return; } } }
  21. Thank you very much, this works as intended now.
  22. Will this bit of code communicate to the helicopter from the hud script? I'm not worried if any of the solutions are jerky or not because that can be improved, Thanks. focus_on_helicopter() { vector here = llGetPos(); llSetCameraParams([CAMERA_ACTIVE, TRUE, CAMERA_BEHINDNESS_ANGLE, 0.0, CAMERA_BEHINDNESS_LAG, 0.5, //CAMERA_DISTANCE, 4.0, CAMERA_DISTANCE, 6.0, CAMERA_PITCH, 10.0, // CAMERA_FOCUS, CAMERA_FOCUS_LAG, 0.05, CAMERA_FOCUS_LOCKED, FALSE, CAMERA_FOCUS_THRESHOLD, 0.0, // CAMERA_POSITION, CAMERA_POSITION_LAG, 0.5, CAMERA_POSITION_LOCKED, FALSE, CAMERA_POSITION_THRESHOLD, 0.0, //CAMERA_FOCUS_OFFSET, <0,0,3>]; CAMERA_FOCUS_OFFSET, <0,0,0>]); } This is the Script in the Heli: 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() { llRegionSay(4,(string)llGetPos()); } }
  23. How can I make my camera lock focus behind an rc helicopter? I want to wear a hud that has a button I press to activate the camera to follow the RC heli remotely. Any help will be appreciated, Thank you.
×
×
  • Create New...