Jump to content

SeanMcDonald

Resident
  • Posts

    32
  • Joined

  • Last visited

Reputation

11 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Yet another upvote for the builtin editor. If I need an external, Kate is my go-to du jour. It also comes with an LSL highlighter, which is handy for offline work.
  2. Maybe I have a strange case, then. It's a pair of scripts, but it works well enough for a vehicle I built several years ago. The door script: /* * Smooth Rotating Linked Door With Hinge * * By: Lyn Mimistrobell * Version: 1.1 * License: Do whatever you like with it, just don't blame me if you break it :) */ /* * Define the rotation in degrees, using the door prim's local coordinate * system */ vector ROTATION = <122.0, 0.0, 0.0>; /* * Define the position of the virtual hinge; usually this is half the door * prim's width and thickness */ vector HINGE_POSITION = <0.0, 0.05, -1.425>; /* * Define how fast the door opens, in seconds */ float SECONDS_TO_ROTATE = 1.0; /* * Define after how much time the door should close automatically, in seconds; * set to 0.0 to disable autolmatic closing */ float AUTO_CLOSE_TIME = 10.0; /* * Define a sound that plays when the door starts to open; set to NULL_KEY * for no sound. */ key SOUND_ON_OPEN = "e5e01091-9c1f-4f8c-8486-46d560ff664f"; /* * Define a sound that plays when the door has closed; set to NULL_KEY * for no sound. */ key SOUND_ON_CLOSE = "88d13f1f-85a8-49da-99f7-6fa2781b2229"; /* * Define the volume of the opening and closing sounds */ float SOUND_VOLUME = 1.0; /* * NORMALLY, THERE IS NO NEED TO CHANGE ANYTHING BELOW THIS COMMENT. IF YOU DO * YOU RISK BREAKING IT. */ integer gClosed; // Door state: TRUE = closed, FALSE = opened rotation gRotationClosed; // Initial rotation of the door (closed) vector gPositionClosed; // Initial position of the door (closed) vector gRotationPerSecond; // The amount to rotate each second doOpenOrClose() { /* * Only perform the rotation if the door isn't root or unlinked */ integer linkNumber = llGetLinkNumber(); if (linkNumber < 2) return; if (gClosed) { /* * Store the initial rotation and position so we can return to it. * * Rotating back purely by calculations can in the longer term cause the door * to be positioned incorrectly because of precision errors * * We determine this everytime before the door is being opened in case it was * moved, assuming the door was closed whilst being manipulated. */ gPositionClosed = llGetLocalPos(); gRotationClosed = llGetLocalRot(); /* * Play the opening sound and preload the closing sound */ if (SOUND_ON_OPEN) llPlaySound(SOUND_ON_OPEN, SOUND_VOLUME); } vector hingePosition = gPositionClosed + HINGE_POSITION * gRotationClosed; /* * Reset the timer and start moving */ llResetTime(); while (llGetTime() < SECONDS_TO_ROTATE) { float time = llGetTime(); if (! gClosed) /* * Invert the timer for closing direction */ time = SECONDS_TO_ROTATE - time; rotation rotationThisStep = llEuler2Rot(gRotationPerSecond * time) * gRotationClosed; vector positionThisStep = hingePosition - HINGE_POSITION * rotationThisStep; llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_ROT_LOCAL, rotationThisStep, PRIM_POS_LOCAL, positionThisStep]); } /* * Set the new state */ gClosed = !gClosed; if (gClosed) { /* * Finalize the closing movement */ llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_ROT_LOCAL, gRotationClosed, PRIM_POS_LOCAL, gPositionClosed]); /* * Play the closing sound and preload the opening sound */ if (SOUND_ON_CLOSE) llPlaySound(SOUND_ON_CLOSE, SOUND_VOLUME); if (SOUND_ON_OPEN) llPreloadSound(SOUND_ON_OPEN); } else { /* * Finalize the opening movement */ rotation rotationOpened = llEuler2Rot(ROTATION * DEG_TO_RAD) * gRotationClosed; vector positionOpened = hingePosition - HINGE_POSITION * rotationOpened; llSetLinkPrimitiveParamsFast(linkNumber, [PRIM_ROT_LOCAL, rotationOpened, PRIM_POS_LOCAL, positionOpened]); /* * Preload the closing sound */ if (SOUND_ON_CLOSE) llPreloadSound(SOUND_ON_CLOSE); /* * Set a timer to automatically close */ llSetTimerEvent(AUTO_CLOSE_TIME); } } default { state_entry() { /* * Assume the door is closed when the script is reset */ gClosed = TRUE; /* * These doesn't change unless the script is changed, calculate them once */ gRotationPerSecond = (ROTATION * DEG_TO_RAD / SECONDS_TO_ROTATE); /* * Preload the opening sound */ if (SOUND_ON_OPEN) llPreloadSound(SOUND_ON_OPEN); } touch_start(integer agentCount) { doOpenOrClose(); } timer() { llSetTimerEvent(0.0); /* * Close the door if it isn't already closed */ if (! gClosed) doOpenOrClose(); } } And the hinge script: default //initially closed { touch_start(integer num_detected) { state open; } } state open { state_entry() { rotation r1 = llEuler2Rot(<122.5,0.0,0.0> * DEG_TO_RAD); llSetRot(r1 * llGetRot()); } touch_start(integer num_detected) { state closed; } } state closed { state_entry() { rotation r2 = llEuler2Rot(<-122.5,0.0,0.0> * DEG_TO_RAD); llSetRot(r2 * llGetRot()); } touch_start(integer num_detected) { state open; } } If I were guessing, I'd say that this likely came my way from the Outworldz.com site. It only uses LSL functions, though, so it should work in SL as well as OS.
  3. When building with prims, a trick I've used is to create a hinge prim, link it to the door, then rotate the hinge.
  4. I have a (very old) shuttlecraft that uses the HC-1 flight script. It has a second short script to monitor physics and re-enable if a sim-crossing borks it. The vehicle is full perm. If you'd like a copy, message me here or inworld.
  5. I'm not an expert scripter, but it seems that the script on this page just needs to call llPlaySound() just before the door starts to move. I'd probably drop the sound file in the door's inventory and call it by name in the script (rather than using a key for it).
  6. Pshaw! Kirk's pauses were so dramatic they required ellipses. Measly commas were powerless. :D
  7. I don't know the InWorldz script, but Fred Beckhusen has quite a library at Outworldz.com. If he doesn't have it, he may know someone who does.
  8. It's no problem to share the script. It's a work in progress and more of a learning exercise than anything else. I just noticed that it uses osTeleportOwner, but llTeleportAgent with the owner's key should work in SL. I also just noticed that I haven't gotten the portal and beam working yet; that's on the list of things to fix when I circle back around to this. // Script: OS Teleport from Google Sheets database // by Duncan Steuart@hg.osgrid.org:80 // June, 2018 // // ================================================== // Global Variables // ================================================== // // Set up Google Sheet to store teleport coordinates with columns "", "Destination", "SimName", "LandingPoint.x", "LandingPoint.y", "LandingPoint.z", "LookAt.x", "LookAt.y", and "LookAt.z" Note first blank column; this is necessary because llCSV2List() does not properly interpret Google exported line ends. // NB: Google Sheets is used here, but it should be possible to use any publishable spreadsheet tool // Publish Google Sheet as CSV and paste link here. string URL ="https://docs.google.com/spreadsheets/d/e/2PACX-1vTG2Gz4EUNKYehv86zRmfViykKDyW4j8fcMIoZ-o8GSCZ5z8LYYtrjCEmliHCFzWFv13MUKn5taHGe4/pub?gid=0&single=true&output=csv"; // Variables used in retrieving coordinates list and looking up information from it. key HTTPkey; list DataList = []; integer LocationIndex; // Variables for teleport coordinates function. string Destination; string SimName; vector LandingPoint; vector LookAt; string Coordinates; // Other variables. key Owner; key Transportee; integer ListenHandle; // // ================================================== // Functions // ================================================== vector getLandingPoint(string fDestination) { LandingPoint.x = llList2Float(DataList, LocationIndex + 2); LandingPoint.y = llList2Float(DataList, LocationIndex + 3); LandingPoint.z = .05 + (llList2Float(DataList, LocationIndex + 4)); return LandingPoint; } vector getLookAt(vector fDestination) { LookAt.x = llList2Float(DataList, LocationIndex + 5); LookAt.y = llList2Float(DataList, LocationIndex + 6); LookAt.z = llList2Float(DataList, LocationIndex + 7); return LookAt; } // // ================================================== // Main Routine // ================================================== // default { on_rez(integer start_param) { llResetScript(); } changed(integer change) // something changed, take action { if(change & CHANGED_OWNER) { llResetScript(); } else if (change & CHANGED_TELEPORT) { llResetScript(); } } state_entry() { HTTPkey = llHTTPRequest(URL, [] ,""); Owner = llGetOwner(); } http_response(key id, integer status, list meta, string Body) // Retrieve CSV file from online spreadsheet { Body = llToLower(Body); // Convert to lowercase DataList = llCSV2List(Body); // Convert CSV-delimited string body retrieved from URL to LSL list Datalist. This is a strided list; consider using "2D Pseudo Array" user functions at http://wiki.secondlife.com/wiki/2D_Pseudo-Array state listening; // After retrieving the list, listen for commands } } state listening { state_entry() { llListenRemove(ListenHandle); ListenHandle = llListen(0, "", Owner, ""); // Listen only to owner on ch. 0 } listen(integer channel, string name, key id, string OwnerSez) { OwnerSez = llToLower(OwnerSez); // Clean input & avoid LSL pickiness string OwnerCommand = llGetSubString(OwnerSez, 0, 1); if(OwnerSez == "t reset") { llOwnerSay("Resetting coordinates database\nPlease stand by"); llResetScript(); } else if (LocationIndex != -1) { Destination = llStringTrim(llGetSubString(OwnerSez, 2, -1),STRING_TRIM); LocationIndex = llListFindList(DataList, [Destination]); SimName = llList2String(DataList, LocationIndex + 1); LandingPoint = getLandingPoint(Destination); LookAt = getLookAt(Destination); } else llResetScript; // Parse commands and process if(OwnerCommand == "t ") { state transport; } else if(OwnerCommand == "p ") { state portal; } } } state transport { state_entry() { // llListenRemove(ListenHandle); // Rez beam & sound effect for dematerialize // llRezObject("Beam 2.0", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, 0); llSleep(1.5); // Then teleport user. Rez beam for materialize. osTeleportOwner(SimName, LandingPoint, LookAt); // llRezObject("Beam 2.0", llGetPos(), ZERO_VECTOR, ZERO_ROTATION, 0); LocationIndex = 0; // Clear location for next transport state listening; } } state portal { state_entry() { state default; // Do nothing yet } } // ================================================== // END // ================================================== Hope this is helpful.
  9. Not sure if it's helpful, but I have a teleporter wearable over on OSGrid that's written using only LSL. It uses a spreadsheet at Google to record destinations and an llHTTPRequest routine (I think by Maria Korolov at Hypergrid Business) to look up coordinates. So long as you're just looking up variables and not actually recoding a script, something like it might work for your needs here.
  10. I'm not sure, either. I'll download and try out the current version. Thanks for setting the record straight.
  11. Side note: I didn’t know Cool-VL was still in use. I stopped using it when Henri decided not to support EEP, and haven’t seen it mentioned anywhere in months.
  12. Search online. There are free scripts in various libraries that do what you’re asking.
  13. It’s a bit clunky, but you could also set FULL_BRIGHT to “on” then add a semi-transparent prim on top to dim it.
  14. Thanks for this, Fénix. That’s useful in a lot of contexts.
  15. Because it came up in a search, and Ardy and others were wrong. If they didn't like Opensim, fine. But they don't have to lie about it.
×
×
  • Create New...