Jump to content

KiondraeLoc

Resident
  • Posts

    31
  • Joined

  • Last visited

Everything posted by KiondraeLoc

  1. 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.
  2. How can I get my avatar to immediately sit on a prim upon rez? I've looked at some of the sit functions and can't figure it out. Thanks.
  3. Thanks everyone, now I have all the pieces I need to put my script together.
  4. I want to replace llOwnerSay("beep"); with a touch function that will let me change the texture right or left based on commands along side the buttons. I just don't know the right command to look up to use here.
  5. // Says beep to owner the first time owner says something in main chat // and then stops listening integer listenHandle; remove_listen_handle() { llListenRemove(listenHandle); } default { state_entry() { // Change the channel number to a positive integer // to listen for '/5 hello' style of chat. // target only the owner's chat on channel 0 (PUBLIC_CHANNEL) listenHandle = llListen(0, "", llGetOwner(), ""); } listen(integer channel, string name, key id, string message) { // we filtered to only listen on channel 0 // to the owner's chat in the llListen call above llOwnerSay("beep"); // stop listening until script is reset remove_listen_handle(); } on_rez(integer start_param) { llResetScript(); } changed(integer change) { if (change & CHANGED_OWNER) { llResetScript(); } } } I want to change llOwnerSay("beep"); to a touch function and I'm not sure how to do that. What command will allow this?
  6. Instead of touch_start(), is there a way to command the object through chat to be touched without clicking on it?
  7. //You would put the uuid key of your textures in here like this list textures; integer textureIndex; //How far through the above list of textures we have moved integer textureLink=1; //Change to the link number to display the texture integer rightButton=2; //Change to the link number of the right button integer leftButton=3; //Change to the link number of the left button default{ state_entry(){ //Here so that everytime you save, add a new texture etc it will reset the image being displayed back to the first image in the list textureIndex=0; llSetLinkTexture(textureLink,llList2String(llGetInventoryNumber(INVENTORY_TEXTURE),textureIndex),ALL_SIDES); } //You can use llSetLinkPrimitiveParams as well to change the texture but as you seem to be a learner and because its simpler for a learner to understand iv used llSetLinkTexture touch_start(integer x){ //Change "right button" and "left button" to the link number of the buttons you are pressing if(llDetectedLinkNumber(0)==rightButton){ //Move down through the textures or "to the right" ++textureIndex; //Display the texture llSetLinkTexture(textureLink,llList2String(llGetInventoryNumber(INVENTORY_TEXTURE),textureIndex),ALL_SIDES); //Check if we have reached the end of the list and if so go back to the start if(textureIndex==llGetListLength(textures))textureIndex=0; }else if(llDetectedLinkNumber(0)==leftButton){ //Move up through the textures or "to the left" --textureIndex; //Display the texture llSetLinkTexture(textureLink,llList2String(llGetInventoryNumber(INVENTORY_TEXTURE),textureIndex),ALL_SIDES); //Check if we have reached the start of the list go back to the end if(textureIndex==llGetListLength(textures))textureIndex=llGetListLength(textures)-1; } } } I thought maybe adding llGetInventoryNumber(INVENTORY_TEXTURE) in place of textures would allow me to drop textures in the root prim and it would automatically detect them, but that puts me back at step one, trying to figure out how to make it work. What should I change to get it to detect the textures automatically so I don't have to update the list if I add, say 157 textures?
  8. This helps me understand how it works better, thank you.
  9. The script works and I can modify it in Second Life, I just wish the buttons worked like that in Opensimulator as well. I wonder what functions I should change to make it work in Opensimulator.
  10. I want to make a script containing a next and previous button(s) to scroll trough a large amount of textures. Should I make a main script that uses llSay(); with a listen script in the listener prim or should I do one script that calls on the names of the prims in the linkset? Also what LSL functions would be required to achieve this?
  11. I figured it out, it's because the llLookAt command and others like it are single focused. They can't make the prim do two separate things at once using the same command. It's like trying to look to the left and to the right at the same time.
  12. I'm looking for one that make the objects follow without too much lag while traveling in the spaceship and I haven't found any in the Marketplace. The only ones I see are in spaceships that are no modify.
  13. Where can I find a good scene rezzer for a spaceship?
  14. Thanks, this most certainly helps.
  15. Dually noted. I didn't think about it like that and you have a point. I agree with you one hundred percent. I won't do that again in the future. I want you and everyone to know that I do care about the people taking the time to help people like me with problems as such as the turret script and that is why I won't do a double thread again as a sign of respect.
  16. I'm just a bit of a protectionist and I wanted to create a second thread for solving this part of the problem. Don't you think it would be good to make it easier for others to find answers with two versions as opposed to one? Thank you and I appreciate all the help.
  17. This is the script in the turret. I added the llGetRot(); function bolded in Orange but the turret goes crazy. What should I add to fix it? The turret is linked to the vehicle as a child prim. It works fine as root, but I need it to function as a child prim on the vehicle. I don't want to use the llLookAt(); function because it will mess up my mouse look fighter craft I'm gonna link the turret to. You can see what it does in the Gif below. The blue light is the aiming face of the turret prim. //menu listener integer listener; integer sensorChannel; // sensor list avatarsKeys; list avatarsNames; menu(key user,integer channel,string title,list buttons) { listener = llListen(channel,"","",""); llDialog(user,title,buttons,channel); //remove listener if there's no activity in menu llSetTimerEvent(20.0); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { touch_start(integer total_number) { //only owner can access the menu if (llDetectedKey(0) == llGetOwner()) { llSensor("","",AGENT,55,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) { integer pos = llListFindList(avatarsNames,[message]); integer index = llListFindList(avatarsNames,[message]); integer i; if(index != -1) for (i = 0; i < 100; ++i) { key kTarget = llList2Key(avatarsKeys,index); vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); float fDistance=llVecDist(<vTargetPos.x,vTargetPos.y,0>,<vPos.x,vPos.y,0>); llSetRot(llRotBetween(<1,0,0>,llVecNorm(<fDistance,0,vTargetPos.z - vPos.z>)) * llRotBetween(<1,0,0>,llVecNorm(<vTargetPos.x - vPos.x,vTargetPos.y - vPos.y,0>))*llGetRot()); llRezObject("bullet", llGetPos()+<2,0,0>*llGetRot(),<20,0,0>*llGetRot(),llGetRot(),0); } } } timer() { llListenRemove(listener); llSetTimerEvent(0.0); } }
  18. I was doing something like this: float message1; float message2; float message3; integer listenHandle = 0; string message(string src, string divider) { integer index = llSubStringIndex( src, divider ); if(~index) return llDeleteSubString( src, index, -1); return src; } string message1(string src, string divider) { integer index = llSubStringIndex( src, divider ); if(~index) return llDeleteSubString( src, 0, index + llStringLength(divider) - 1); return src; } default { state_entry() {llListen(17, "","", ""); } listen(integer channel, string name, key id, string message) { if (message(message, " ") == "alt") { } message1 = (float)message1(message, " "); llSetRegionPos(<message1, 0,0>); } } But, I'm not sure because I have very light knowledge of scripting.
  19. How do I code a Jump Drive script that lets me type in any x,y,z coordinates on channel 17 that will teleport my spaceship to the specified location anywhere in the region I want to go?
  20. Adding a picture is a good idea, thanks Innula Zenovka. Right now the turret is just a single prim. I plan on doing a mesh turret later. Using the script below, the turret rotates interchangeably between clockwise and counter clockwise directions when it passes the main North, East, South, and West directions. When the front of the vehicle is pointing Northeast, Southeast, Southwest, or Northwest, the turret fires continuously in one direction, clockwise or counterclockwise. The turret is a child prim on top of the root prim of the vehicle. You can see in the Gif file what its actually doing. //menu listener integer listener; integer sensorChannel; // sensor list avatarsKeys; list avatarsNames; menu(key user,integer channel,string title,list buttons) { listener = llListen(channel,"","",""); llDialog(user,title,buttons,channel); //remove listener if there's no activity in menu llSetTimerEvent(20.0); } integer randomNumber() { return (integer)(llFrand(99999.0) * -1); } default { touch_start(integer total_number) { //only owner can access the menu if (llDetectedKey(0) == llGetOwner()) { llSensor("","",AGENT,55,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) { integer pos = llListFindList(avatarsNames,[message]); integer index = llListFindList(avatarsNames,[message]); integer i; if(index != -1) for (i = 0; i < 100; ++i) { key kTarget = llList2Key(avatarsKeys,index); vector vTargetPos = llList2Vector(llGetObjectDetails(kTarget,[OBJECT_POS]),0); vector vPos=llGetPos(); float fDistance=llVecDist(<vTargetPos.x,vTargetPos.y,0>,<vPos.x,vPos.y,0>); llSetRot(llRotBetween(<1,0,0>,llVecNorm(<fDistance,0,vTargetPos.z - vPos.z>)) * llRotBetween(<1,0,0>,llVecNorm(<vTargetPos.x - vPos.x,vTargetPos.y - vPos.y,0>))*llGetRot()); llRezObject("bullet", llGetPos()+<2,0,0>*llGetRot(),<20,0,0>*llGetRot(),llGetRot(),0); } } } timer() { llListenRemove(listener); llSetTimerEvent(0.0); } } So, what should I do here? The blue light on the front of the prim, linked as a child prim on the vehicle, is the face that aims at the target firing on the Z axis. I placed the first letter of each main direction to show the direction in which the vehicle is facing when rotating.
  21. It only makes the object rezzing fire at the selected AV though. The turret doesn't look at the avatar so I'm still missing something. When I multiply the vehicles rotation, like what said, the turret starts firing in random circles instead of firing at the selected avatar. I might be missing some extra math here, but I'm not totally sure. What do you think I'm missing?
  22. I replaced the llGetRot(); functions with llGetLocalRot(); in the llRezObject(); function and that fixed the issue. I didn't need to use *llGetRot(); in the llSetRot(); function. I also replaced llSetRot(); with llSetLocalRot();. Thanks for helping me figure that out. Now the turret works like a charm. Again, Thanks!
  23. May you specify futher on this please? I'm new to scripting so I'm not sure how to go about muliplying by the vehicle's rotation.
  24. Well, that works as a single prim turret. In a linkset on a moving vehicle that isn't pointing East, the turret doesn't fire at the avatar. The aim changes around. How do I get it to use the vehicle's front direction as its east instead of the local sim axis?
×
×
  • Create New...