Jump to content

Leo1452

Resident
  • Posts

    17
  • Joined

  • Last visited

Everything posted by Leo1452

  1. So I got around to trying the scripts in separate prims, they still interfere with each other. Do you have any other suggestions?
  2. Both scripts are in the same prim. The driver script has these pieces to handle control: llRequestPermissions(llAvatarOnLinkSitTarget(1), PERMISSION_TAKE_CONTROLS); run_time_permissions(integer k) { if(k & PERMISSION_TAKE_CONTROLS) { llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_UP | CONTROL_DOWN, TRUE, FALSE); } } control(key n, integer l, integer e) { if(llAvatarOnLinkSitTarget(1) != NULL_KEY && n == llGetPermissionsKey()) { } } The turret script has these pieces: llRequestPermissions(llAvatarOnLinkSitTarget(2), PERMISSION_TAKE_CONTROLS); run_time_permissions(integer k) { if(k & PERMISSION_TAKE_CONTROLS) { llTakeControls(CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ML_LBUTTON, TRUE, FALSE); } } control(key n, integer l, integer e) { if(llAvatarOnLinkSitTarget(2) != NULL_KEY && n == llGetPermissionsKey()) { } } When I add your code to test it, "control id is not the same as script permissions id" never happens. I sat two avatars from different viewers, but no matter which avatar I control from, it registers as the driver sending controls.
  3. I want to make a tank that seats two avatars. llAvatarOnLinkSitTarget(1) will drive the tank while llAvatarOnLinkSitTarget(2) will control the turret. I have separate scripts handle the driving and turret. The driving script only calls llRequestPermissions() on the driver avatar while the turret script only calls llRequestPermissions() on the turret avatar. I also add if-statements above all controls to make sure the key of the avatar's control is coming from the appropriate avatar. I'm clearly still missing something because both scripts still respond to the controls of both avatars. Can someone help me? Both scripts are in the same prim. The driver script has these pieces to handle control: llRequestPermissions(llAvatarOnLinkSitTarget(1), PERMISSION_TAKE_CONTROLS); run_time_permissions(integer k) { if(k & PERMISSION_TAKE_CONTROLS) { llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_LEFT | CONTROL_UP | CONTROL_DOWN, TRUE, FALSE); } } control(key n, integer l, integer e) { if(llAvatarOnLinkSitTarget(1) != NULL_KEY && n == llGetPermissionsKey()) { } } The turret script has these pieces: llRequestPermissions(llAvatarOnLinkSitTarget(2), PERMISSION_TAKE_CONTROLS); run_time_permissions(integer k) { if(k & PERMISSION_TAKE_CONTROLS) { llTakeControls(CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ML_LBUTTON, TRUE, FALSE); } } control(key n, integer l, integer e) { if(llAvatarOnLinkSitTarget(2) != NULL_KEY && n == llGetPermissionsKey()) { } }
  4. Thank you very much. I have a follow-up question for anyone who can help. I have a non-physical object rotated forward 90 degrees using this line of code. I want to restrict its rotation so that it can only rotate on the z axis. I would code something to nullify the x and y axis rotations so that it's always upright no matter how someone tries to edit the rotation. However, with the object rotated 90 degrees forward, the -x axis replaces the z axis as the new "upright." How do I do this given that the three axes are no longer independent?
  5. timer() { list details = llGetObjectDetails(id, [OBJECT_POS, OBJECT_ROT]); rotation rot = llList2Rot(details, 1) ; llSetPos(llList2Vector(details, 0) + <0.0, -0.5, 0.75>*rot); //The follower floats -0.5 on the y-axis and 0.75 on the z axis from the target llSetRot(<rot.x, PI, rot.z, 1>); } This timer is for a follow that follows the object with the UUID of "id." The follower is only to rotate on the z-axis to face the same direction as the target. I want to rotate the object 90-degrees along the y-axis so that its top faces forward instead. However, when I try to set the rotation to <0, 90, 0>, it seems to turn all over the place. I know that there's a mathematical reason why, but I have no idea how to fix this.
  6. How would you combine that with the laser blast so that it lines up with what the blast object has passed through?
  7. I'm making a sort of laser beam game where people ride cars that shoot blasts. The cars don't move with physics. The blasts should pass through through everything except the cars that are part of the game. Is there a way to make a bullet that only collides with objects of a certain name? If not, is there a way to make a phantom bullet that notices when it's passed through objects of a certain name so that it can perform some sort of reaction?
  8. The wiki for this function says that this statement would return "The account creation/"born on" date as a string in an ISO 8601 format of YYYY-MM-DD," but I'm getting a string that looks like a UUID. Can someone help me with a solution to getting an agent's birth date from DATA_BORN?
  9. I'd have a listener on channel 0. For every message in nearby chat, it would check if that string contains a substring from a list in my script and perform some action if it finds one. To see if a message contains the word "happy," I'd use llSubStringIndex(llToLower(message), "happy") but how about a whole list of words I'm looking for?
  10. Hi. Sorry, I shouldn't have said the object is attached to me. Let's say that the object is on the ground. How can it know the distance between me and the person/object that just spoke?
  11. This is a script that will repeat anything that it hears in nearby chat within 20m to the owner. This script will be in an object within range of a few people. If I'm already in range of the person who sent the chat, it will repeat it to me twice, which is unfavourable. How do I detect if the person who sent the chat in nearby is already within 20 metres of the owner (me)? If I could add an if statement around the llOwnerSay() that only repeats a message when I'm out of the 20 m range of the avatar or object that sent it, that'd be great. integer nearby; default { state_entry() { nearby = llListen(0, "", "", ""); } listen(integer channel, string name, key id, string message) { llOwnerSay(message); } }
  12. I'm trying to get a boolean value for whether or not I am seated on an object not counting the ground.
  13. Here's an example of an avatar bumper sound script. Is there a way for it to only detect horizontal collisions such that if you tp on someone's head, it doesn't play. This is for people with tp sounds because one sound will interrupt the other. float volume = 1.0; //Volume 0.0 - 1.0; default { collision_start(integer num) { if(llDetectedType(0) & AGENT) { llStartAnimation("lulz"); llPlaySound(llGetInventoryName(INVENTORY_SOUND,llFloor(llFrand(llGetInventoryNumber(INVENTORY_SOUND)))),1.0); llSetTimerEvent(1.0); } } timer() { llStopAnimation("lulz"); } attach(key uid) { if(llGetAttached()) llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION); } }
  14. // Play a sound whenever the owner is walking integer gWasWalking; // TRUE when wearer is already walking string gSound = "Sleepwalk"; // name of soundfile in inventory default { state_entry() { // Start a timer to continuously check if the owner is walking llSetTimerEvent(0.25); } timer() { integer NowWalking = llGetAgentInfo(llGetOwner()) & AGENT_WALKING; if (NowWalking != gWasWalking) // walking has stopped or started { llStopSound(); if (NowWalking) llLoopSound(gSound, 1.0); } gWasWalking = NowWalking; } }
  15. Below is a basic walker script that's been shared around. Whenever I teleport to a person or location, it starts playing. I want make sure that it can't play until (let's say) 5 seconds after every teleport. It's because I already have a teleport sound player, so I don't want them both playing at the same time. I've tried adding llSleep(), but that just causes it to play 5 seconds later, even though I'm not even walking by then. I just want it to act as if I didn't walk at all no matter what my avatar does during the 5 seconds after every teleport. string Snd = "Sleepwalk"; integer For = AGENT_WALKING; default { state_entry() { llPreloadSound(Snd); state entry; } } state entry { state_entry() { llStopSound(); @D; if (llGetAgentInfo(llGetOwner()) & For) { llSleep(2.0); state walking; } jump D; } } state walking { state_entry() { llLoopSound(Snd,.0); float alpha = 0.0; @DD; llAdjustSoundVolume(alpha); alpha +=.1; if(alpha >= 1.0){jump D;} jump DD; @D; if (!(llGetAgentInfo(llGetOwner()) & For)) { float alpha = 1.0; @DXD; llAdjustSoundVolume(alpha); alpha -=.1; if(alpha < 0.0){jump DX;} jump DXD; @DX; state entry; } jump D; } }
  16. I find that the walker scripts people are sharing around are too sensitive. You TP on someone's head and it starts playing, which isn't great for me because it already has a TP sound. I've tried adding llSleep() but that just causes the sound to come in late. I wanna prevent the following basic walker from playing unless I walk for 5 seconds. string Snd = "Sleepwalk"; integer For = AGENT_WALKING; default { state_entry() { llPreloadSound(Snd); state entry; } } state entry { state_entry() { llStopSound(); @D; if (llGetAgentInfo(llGetOwner()) & For) { llSleep(2.0); state walking; } jump D; } } state walking { state_entry() { llLoopSound(Snd,.0); float alpha = 0.0; @DD; llAdjustSoundVolume(alpha); alpha +=.1; if(alpha >= 1.0){jump D;} jump DD; @D; if (!(llGetAgentInfo(llGetOwner()) & For)) { float alpha = 1.0; @DXD; llAdjustSoundVolume(alpha); alpha -=.1; if(alpha < 0.0){jump DX;} jump DXD; @DX; state entry; } jump D; } }
  17. I'm looking to unseat everyone who sits on a particular object except for the first person to sit on it.
×
×
  • Create New...