Jump to content

I need an expert review this script


Irene Muni
 Share

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

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

Recommended Posts

Hi all.

I have not the slightest idea about scripts, LSL... I usually use this teleport script in many places of my lands. But I don't know if is a "good" script or can be improved: less lag and/or less impact and/or ...

Please, can you (experts of the LSL) review the script? Any suggestion (as clear as possible LOL) will be welcomed and appreciated.

It's a free script provided originally by Klug Kuhn.

 

// The script begins 

vector destination = <10, 146, 197>; // the destination coordinate
string text = " "; // optional floating text on the teleporter, input a space if not used
vector text_color = <1.0,1.0,1.0>; // the floating text's color
integer touch2sit = TRUE; // TRUE - left click to sit; FALSE - left click to touch
integer access_mode = 1; // 1 - public; 2 - owner; 3 - group;

//=================================================
posJump( vector target_position )
{// Trickery discovered by Uchi Desmoulins
//and Gonta Maltz. More exact value provided by Fake Fitzgerald. llSetPrimitiveParams([PRIM_POSITION, <1.304382E+19, 1.304382E+19, 0.0>, PRIM_POSITION, target_position ]); } //================================================= warpPos( vector destpos ) { //R&D by Keknehv Psaltery, 05/25/2006; unlimited modified by Klug Kuhn 10/01/2008 // Change this safety range depends on your script memory // The larger the range, the quicker (and less "flashes")
 //to get to the destination, however, the more to eat up script memory. float safety_range = 1000.0; integer arrived = FALSE; integer within_range = FALSE; vector inter_pos = ZERO_VECTOR; vector current_pos = llGetPos(); vector checking_pos = destpos; integer jumps = 0; list rules = []; integer count = 0; if (llVecDist(destpos, current_pos) <= safety_range) { jumps = (integer)(llVecDist(destpos, current_pos) / 10.0) + 1; rules = [ PRIM_POSITION, destpos ]; //The start for the rules list count = 1; while ( ( count = count << 1 ) < jumps) rules = (rules=[]) + rules + rules; //should tighten memory use. llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) ); } else { while (!arrived) { current_pos = llGetPos(); checking_pos = destpos; within_range = FALSE; while (!within_range) { if (llVecDist(checking_pos,current_pos) > safety_range) { checking_pos = <(current_pos.x + checking_pos.x) / 2.0,(current_pos.y + checking_pos.y) / 2.0,(current_pos.z + checking_pos.z) / 2.0>; } else { within_range = TRUE; if (llVecDist(destpos, current_pos) <= safety_range) { jumps = (integer)(llVecDist(destpos, current_pos) / 10.0) + 1; rules = [ PRIM_POSITION, destpos ]; //The start for the rules list count = 1; while ( ( count = count << 1 ) < jumps) rules = (rules=[]) + rules + rules; //should tighten memory use. llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) ); arrived = TRUE; } } } if (!arrived) { jumps = (integer)(llVecDist(checking_pos, current_pos) / 10.0) + 1; rules = [ PRIM_POSITION, checking_pos ]; //The start for the rules list count = 1; while ( ( count = count << 1 ) < jumps) rules = (rules=[]) + rules + rules; //should tighten memory use. llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) ); } } } } //================================================= default { state_entry() { llSitTarget(<0.0, 0.0, 0.01>, ZERO_ROTATION); llSetText(text,text_color,1.0); if (touch2sit) llSetClickAction(CLICK_ACTION_SIT); else llSetClickAction(CLICK_ACTION_NONE); } changed(integer change) { if (change & CHANGED_LINK) { key user = llAvatarOnSitTarget(); if (llGetAgentSize(user) != ZERO_VECTOR) { integer access_granted = FALSE; if (access_mode == 1) access_granted = TRUE; else if (access_mode == 2) { if (user == llGetOwner()) access_granted = TRUE; else { llUnSit(user); llSay(0," sorry, owner access only."); } } else if (access_mode == 3) { if (llSameGroup(user)) access_granted = TRUE; else { llUnSit(user); llSay(0," sorry, group memeber access only."); } } if (access_granted) { vector init_pos = llGetPos(); // warpPos(destination); // use warPos() function posJump(destination); // use posJump() function llUnSit(user); llSleep(0.2); // warpPos(init_pos); // use warPos() function posJump(init_pos); // use posJump() function } } } } } // The script ends

 

Thank you very much in advance :)

Link to comment
Share on other sites

I haven't looked at your script. Just want to mention, there will be a new LSL function which replaces posJump/WarpPos. It will hit a RC channel in january. The function should work already on some Aditi regions.

integer llSetRegionPos(vector anywhere_in_the_region)

  • Like 1
Link to comment
Share on other sites

This script is in the object-moving class of teleporters, as distinct from the sit target variety.  The latter is more efficient (less sim impact), but has restricted range (300m in any dimension).  If all your applications fit within that restriction (no high skyboxes, for example), it may be worth replacing this script with a sit target script.  (They're very simple... there's bound to be one around here somewhere.)

If, on the other hand, you need that extended range, it would be best to wait a few weeks for llSetRegionPos().  I don't see anything that urgently needs changing before that function is available.

(Teleporting across sim boundaries is a different problem that wouldn't be addressed by this script.  If that's ever to become a requirement for you, the choices are currently pretty ugly, but there's renewed hope for the elegant llTeleportAgent(), as used in Linden Realms.)

  • Like 1
Link to comment
Share on other sites

Well apparently I'm not one of some of you and don't want to be. Writing and, even more so, testing software takes time and my time is worth something to me.

As far as I'm concerned, those who think that there is any significant difference in writing user applications in LSL and server applications in C++ don't know either one. So why not ask LL programmers to do it for free?

Link to comment
Share on other sites

You are really wasting a lot of time in here for somebody who thinks her time is always worth something. Seriously, if you have nothing else to say than "pay me if you want help", you should just refrain from posting. Forums are a free space in every sense of the expression.

I program/script for money but I never hesitate to answer to questions which amuse me, puzzle me, inspire me or whatever reason, for the betterment of SL. Sometimes, people to whom I answered contact me in-world and I keep on helping if I have the time or to distract me from my daily work.

We, so-called "experts", should always take the time to help the beginners... because we can and because it improves SL. Or maybe, just because scripting is fun. It looks like to me that you lost that feeling.

Scripting time is always worth something but a warm "thank you" from another human being is priceless.

  • Like 1
Link to comment
Share on other sites

@ arton, Qie, PeterCanessa, Kayleigh, & Kaluura, THANK YOU VERY MUCH for your ideas and advice. Yes, I need a range > 300 m. and at this moment I don't need teleport across different regions. I will be very attentive to the launch of that new LSL function llSetRegionPos() For now, my Mainland region can continue to operate with existing teleporters. Thank you very much for your help :)

And as always, sorry for my bad English. I'm from Spain and furthermore it's Christmas! (and in Spain there is no feast without friends around a glass of good wine LOL).

 


Ela Talaj wrote:

Apparently the script works, so you don't have a specific LSL question. Why do you feel "an expert" like for instance myself should provide free improvements for you?

I know the script works, it's no difficult for an ignoramos in LSL as me to know if a script works :) But my question was about possible lag or bad impact. I have not the slightest idea about scripts, but I can read, and I have readed many times that a script can be functional and badly programmed. So my question. As others have said, the purpose of my question was to avoid, where possible, more lag in a Mainland no-commercial region.

"Why do you feel "an expert" like for instance myself should provide free improvements for you?" I don't feel an expert should provide improvement for me. I KNOW (here in forums and also inworld) that many Residents help to others if they can and if they want. About you, I have no idea of your mind, I have not any feeling about your help, your life, or your free or not free work. I asked the residents, not you specifically :)

Of course, I understand that "testing software takes time and my time is worth somethinh to me". No problem for me about how you decide to spend your time. But I'm sure you can understand that others have other views about what is "win or lose" their (our) time.

@ arton, Qie, PeterCanessa, Kayleigh, Kaluura & Ela, Merry Christmas from Spain!

 

Link to comment
Share on other sites

Well said, Kaluura.  The LSL Scripting forum is for people who have questions or observations about how to create LSL scripts.  Many of the "regulars" here earn much of their in-world income from scripting. We spend time in this forum because we remember and respect the support that we were offered here when we were learning LSL ourselves.  Those of us who have worked with long-forgotten computer languages for over 40 years need somewhere to puzzle through the quirks of this odd one.  We rely on the accumulated experience of the community.  More importantly, though, raw beginners need someplace where they can ask the same dumb questions that we did when we were starting out. If they have the desire to learn, this is the place.  I have little patience with people who come here looking for a finished script or for a scripter to hire.  If someone is serious about learning, though, I'm ready to help.

Link to comment
Share on other sites


Rolig Loon wrote:

...If someone is serious about learning, though, I'm ready to help.

 

Erm, well yes, but that would rule Irene out.  As a non-scripter she was asking if anyone would tell her if that freely available script was efficient or not.  I agree that that's close to Ela's complaint that she was asking for something for nothing.

The difference, to me, is that this is all about the baseline script:  this thing is 'the standard' teleporter, is there a better freebie we should be using.  Oh, and by the way; if you want to sell a teleporter it had better be better than this.  Irene will point people at this script, she'll distribute it to others.

Some may see that as a threat to their SL income because they can't sell the same rubbish* over and over, claiming that it's something special.  Apart from teleporters we see the same thing with all the 'standard' scripts - doors, visitors, 'security', online-indicators.  Some want to publish and some want to sell.  Some of us want to do both, but the baseline keeps advancing: improve or die :-)

Link to comment
Share on other sites

I'll agree that Irene's question is not an "I'm stuck with a script I'm writing" post.  She's not looking for a freebie script, though. She wants to know whether she should be using this script or looking for something better.  Irene doesn't want to be a scripter, but she knows enough about scripts to understand that some are more efficient than others.  It's an opportunity for us to teach about what makes them different.  That's especially valuable information in Irene's case because you know that she'll pass it along. 

In my mind, there are two types of helpful answers.  One provides technical information, addressing the question of the moment and helping the OP over a sticking point.  The other discusses the logic behind a solution or a rationale for choosing among different approaches.  I enjoy the second type a bit more than the first, as you can tell by the fact that my answers here often have more text than code.  Irene's post calls for that sort of attention.

Link to comment
Share on other sites

If you're using a teleporter for less than 300 meters  just use a sit target followed by unsit:

http://wiki.secondlife.com/wiki/LlUnSit

The first example can be used as a teleporter and will have about as much script impact as a couch.

_____

As for the script provided, most people will have worse attached to their avatar that they forgot about.   I would say that it has some wasted script time, but provides more usability with it.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4664 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...