Jump to content

totally new to scripting, not sure where to even start


Rumancekk
 Share

You are about to reply to a thread that has been inactive for 1308 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am wanting to do a teleport script with a sound included, but I don't even know where to start or look. I want to be able to click an object and have it teleport me elsewhere and I want a sound to play when it does it.

There's unfortunately already a script in the object but I'm assuming I can just take it out? Or maybe put an invisible prim in front of it.

 

Edited by Rumancekk
Link to comment
Share on other sites

Teleporting is weirdly tricky; there are several basic ways teleporters work, and the "best" choice depends on requirements of the situation. I'm not sure anyone has the patience for me to recite the whole litany.

Maybe you'd like to try by searching through script libraries for teleporter scripts to see if any are close to what you want.

I'm not sure you'll find examples of Experience-based teleporters, which are probably the cleanest of all but depend on the parcel having an Experience enabled, and on those who are teleported granting Experience permissions at some point. The big advantage, though, is that you can literally Touch the object and have it teleport you, no need to click-to-sit that results in a teleport. If that fits your situation, we should explore that option in more detail.

About the pre-existing script: unless it's doing something you want to retain in the teleporter, go ahead and take it out and see what happens.

Link to comment
Share on other sites

22 minutes ago, Qie Niangao said:

Teleporting is weirdly tricky; there are several basic ways teleporters work, and the "best" choice depends on requirements of the situation. I'm not sure anyone has the patience for me to recite the whole litany.

Maybe you'd like to try by searching through script libraries for teleporter scripts to see if any are close to what you want.

I'm not sure you'll find examples of Experience-based teleporters, which are probably the cleanest of all but depend on the parcel having an Experience enabled, and on those who are teleported granting Experience permissions at some point. The big advantage, though, is that you can literally Touch the object and have it teleport you, no need to click-to-sit that results in a teleport. If that fits your situation, we should explore that option in more detail.

About the pre-existing script: unless it's doing something you want to retain in the teleporter, go ahead and take it out and see what happens.

i was just thinking of doing the sit to teleport thing because I don't know if I can work an experience . i think it's supposed to TP fairly far, not sure exactly how, i think it's up like 2000m where I need to teleport

Link to comment
Share on other sites

1 hour ago, Qie Niangao said:

I'm not sure you'll find examples of Experience-based teleporters

The one on the Wiki is quite simple, and Just because I can, I've added a play sound to it (I haven't tested it though, and requires experience)

// A SIMPLE SCRIPT that implements an Experience based teleport.
// Compile with the "Use Experience" box cnecked and an experience key you own selected.
// The prim containing this script must contain a landmark named "Landmark" in its contents
//
// If the person touching this box has not previously accepted an invitation to your experience,
// that person will be offered that opportunity when this prim is touched, and if the invitations
// is accepted, will be immediately teleported to the target of the landmark.
//
// If the toucher has previously accepted an invitation, the person will be immediately teleported
// with no interruption.
//
// The script has no safety features, e.g., will simply fail if the prim contains no landmark.
//
// Thanks to Rolig Loon for her help in figuring out how to do this
// See https://community.secondlife.com/t5/English-Knowledge-Base/Experiences-in-Second-Life/ta-p/2744686
// to read what the Lindens think is an adequate explanation of all this.
 
 
default
{
    touch_start(integer n)
    {
        llRequestExperiencePermissions(llDetectedKey(0), "");
    }
 
    experience_permissions(key av)
    {
		llPlaySound("some_sound",1.0);
        llTeleportAgent(av, "Landmark", ZERO_VECTOR, ZERO_VECTOR);
    }
 
}

It will play the sound where you teleport from though, so you might not hear it after you teleport.

Link to comment
Share on other sites

4 hours ago, Profaitchikenz Haiku said:

For that sort of distance you're best using the sit - llSetRegionPos - unsit method. The sit target trick is limited to 327 or so metres, but llSetRegionPos will get you anywhere.

Once an avatar has sat on an object, they can also be moved like a regular prim in the linkset, up to a thousand meters from the root on any axis (even outside region boundaries). But beyond that, llSetRegionPos is the most universal method.

 

6 hours ago, Rumancekk said:

I am wanting to do a teleport script with a sound included, but I don't even know where to start or look. I want to be able to click an object and have it teleport me elsewhere and I want a sound to play when it does it.

You already have something specific in mind that you want to script, so that's like half the job done already.

The next thing you should do is break your goal down to smaller problems and google something like "lsl how to do something on touch", "lsl how to teleport avatar" and "lsl how to play sound".

The search results would most likely get you the wiki pages for the touch eventllTeleportAgent and llPlaySound. The wiki might not be the most intuitive place at first, but reading through the function description (and caveats) should at least give you some approximation of if they are what you need.

The bottom of the wiki page also includes some example code to explain how the function could be used in a script, but you can also usually find examples elsewhere on the internet (which may be more or less confusing than the wiki page). But regardless of where you start, you should generally reference the wiki page as much as possible (whenever you see a new function) to understand how everything works.

Of course, the search results aren't always enough to guide you in the best solutions, so asking here about what to do is another good step, although we might equally confuse you with too much information or different ways to do the same thing.

4 hours ago, Rumancekk said:

I was just thinking of doing the sit to teleport thing

Like Profait and I already mentioned, there's two (technically three) ways to do this:

  1. Detect when an avatar sits on an object. (changed event)
  2. Move the object (or avatar) to the intended location.
  3. Unsit the avatar from the object.
  4. Move the object back to its original location if you moved the object.
Edited by Wulfie Reanimator
  • Like 1
Link to comment
Share on other sites

Start here: https://www.outworldz.com/cgi/freescripts.plx?ID=492

Edit that script until you get what you want and at the same time learn what everything in the script does.
Google every function (ex: llSitTarget) and check the LSL wiki page.

For sound use llTriggerSound (http://wiki.secondlife.com/wiki/LlTriggerSound)
instead of llPlaySound. Read both wiki's if you want to know why.

Link to comment
Share on other sites

7 hours ago, Wulfie Reanimator said:

Once an avatar has sat on an object, they can also be moved like a regular prim in the linkset, up to a thousand meters from the root on any axis (even outside region boundaries). But beyond that, llSetRegionPos is the most universal method.

I was referring to the sitTarget trick where you set the sit-target quite some distance away and unsit them at once. Job done, but it is limited to the hypotenuse of a triangle with one of the right-angled sides at a maximum of 256, I forget the other one.

Link to comment
Share on other sites

On 2/28/2021 at 12:46 AM, Rumancekk said:

I am wanting to do a teleport script with a sound included

I think you need to explain more you want to teleport grid wide or inside SIM. Teleports uses different methods for different teleport requirement.

Known methods:

User sits on object object changes location and un-sits user.. its kind of... teleports (current SIM only)

http://wiki.secondlife.com/wiki/LlSitTarget

Teleports user based on given landmark requires permission to teleport (grid wide or current SIM)

http://wiki.secondlife.com/wiki/LlTeleportAgent

Brings up map so user can see where he is going or alter destination (grid wide or current SIM)

http://wiki.secondlife.com/wiki/LlMapDestination

Playing sound in LSL simple

http://wiki.secondlife.com/wiki/LlPlaySound

You will probably want to preload your sound file for more better interaction

http://wiki.secondlife.com/wiki/LlPreloadSound

Hope it helps..

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1308 days.

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
 Share

×
×
  • Create New...