Difference between revisions of "No Auto-Return NR"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
This script is released under DNSIOIWKU License, Free and Open for anyone...
This script is released under DNSIOIWKU License, Free and Open for anyone...


<lsl>
<source lang="lsl2">
//  anti return created by Jor3l Boa  
//  anti return created by Jor3l Boa  
//==================================================
//==================================================
Line 42: Line 42:
     }
     }
}
}
</lsl>
</source>


NOTE: I am not responsible for the use you give to this code, you are free to use it at your OWN risk
NOTE: I am not responsible for the use you give to this code, you are free to use it at your OWN risk


AUTOMATIC VERSION!
Another version... better :)
+ Second version. This one needs an easy setup. (Should work for any region with neighbours...)


HOW TO:
<source lang="lsl2">
  1. Create a Box and add this script.
float TIMER_SIM_JUMP = 600.0;
  2. Rotate it (pointing) to the region you want. (Make sure the red face points to that region)
  3. Touch and see if the object detects a region and is able to move.
  4. Touch again to start the noReturn and wait :)


<lsl>
safe_posJump( vector target_pos )
//  anti return created by Jor3l Boa
{
//==================================================
    // An alternative to the warpPos trick without all the overhead.
//  (works on blue and rausch combat region),
    // Trickery discovered by Uchi Desmoulins and Gonta Maltz. More exact value provided by Fake Fitzgerald.  
//  NOTE: for red, change -5 to 5 and + 5 to -5 :)
    // Safe movement modification provided by Alias Turbo.
// this anti return needs a nearby region
     vector start_pos = llGetPos();
//  with entry perms to work.
     llSetPrimitiveParams( [ PRIM_POSITION , < 1.304382E+19 , 1.304382E+19 , 0.0 > , PRIM_POSITION , target_pos ,
//==================================================
                            PRIM_POSITION , start_pos , PRIM_POSITION , target_pos ] );
// NOTE: USE IT AT YOUR OWN RISK! <------YOUR OWN RISK!
//version 0.2
 
//Change log:
//  - 0.2 automatic version
// - 0.1 initial release
integer sReg = FALSE;
vector to;
vector myPos;
doCheck(vector to)  {
    string status;
    integer region = FALSE;
     vector vPosObject = llGetPos();
     if (!llEdgeOfWorld( vPosObject, to )){
      region = TRUE;
    }
    if(region)    {
        status = "No Region found!\nTry another direction.";
        sReg = FALSE;
    }
    else    {
        status = "Redy to Start.\nTouch again.";
        sReg = TRUE;
    }
    llSetText(status,<1,1,1>,1);
}
}


vector toPos(vector dir, integer a) {
vector get_another_region()
     vector toP;
{
    vector this = llGetPos();
     list test = [ < 1.0 , 0.0 , 0.0 > , < -1.0 , 0.0 , 0.0 > , < 0.0 , 1.0 , 0.0 > , < 0.0 , -1.0 , 0.0 > ];
    if(a)  {
     integer i;
        if(to.x == 0)  this.x = dir.x;
    vector off;
        else    this.x = (this.x + dir.x + 5);
    for ( ; i < 4 ; i += 1 )
        if(to.y == 0)  this.y = dir.y;
     {
        else    this.y = (this.y + dir.y + 5);
         off = llList2Vector( test , i );
        toP = <this.x,this.y,dir.z>;
         if ( !llEdgeOfWorld( < 128.0 , 128.0 , 100.0 > , off ) ) jump found;
     }
     else    {
         if(to.x != 0) dir.x = to.x;
         if(to.y != 0) dir.y = to.y;
        toP = dir;
     }
     }
     return toP;
     return ZERO_VECTOR;
}
    @found;
 
    vector m_pos = llGetPos();
warpPos(vector destpos)  
    return off * 254.0;
{
  llSetPrimitiveParams([PRIM_POSITION, <1.304382E+19, 1.304382E+19, 0.0>, PRIM_POSITION,destpos]);
}
}


default
default
{
{
     state_entry()   {
     on_rez( integer start_param )
         llSetText("",<1,1,1>,1.0);
    {
        llSetColor(<1,0,0>,2);
         llResetScript();
     }
     }
     touch_start(integer total_number)
      
    state_entry()
     {
     {
        if(sReg) state noReturn;
         vector another_region = get_another_region();
        vector  myPos = llGetPos();
         if ( another_region )
        rotation myRot = llRotBetween(llRot2Fwd(llGetRot()),<myPos.x,myPos.y,0>);
         vector   eul  = llRot2Euler(myRot)*RAD_TO_DEG;
        float    ang  = llRot2Angle(myRot)*RAD_TO_DEG;
                ang  = ((eul.z)*1)+0;
        if(ang < 0) ang+=360;
        to = ZERO_VECTOR;      
         if(ang > 0+22.5 && ang < 45+22.5)
         {
         {
             to = <0,5,0>;
             llOwnerSay( "NR: Activated." );
         }
            llSetTimerEvent( TIMER_SIM_JUMP );
         else if(ang > 90+22.5 && ang < 135+22.5)
         } else llOwnerSay( "NR: This will not work in the current region." );
    }
 
    timer()
    {
        vector another_region = get_another_region();
         if ( another_region )
         {
         {
             to = <5,0,0>;
             safe_posJump( llGetPos() + another_region );
            llSleep( 2.0 );
            safe_posJump( llGetPos() - another_region );
         }
         }
        else if(ang > 180+22.5 && ang < 225+22.5)
        {
            to = <0,-5,0>;
        }
        else if(ang > 270+22.5 && ang < 315+22.5)
        {
          to = <-5,0,0>;
        }
        if(to == ZERO_VECTOR)
            llSetText("ERROR: Bad direction.\nRotate me again.",<1,0,0>,1);
        else
            doCheck(to);
    }
}
state noReturn {
    state_entry()  {
        myPos = llGetPos();
        //llOwnerSay(llList2CSV([toPos(myPos,FALSE),toPos(myPos,TRUE)]));
        llSetTimerEvent(10);
    } 
    timer() {
        llSetTimerEvent(0);
            llSetColor(<1,0,0>,ALL_SIDES);
        warpPos(toPos(myPos,FALSE));
        warpPos(toPos(myPos,TRUE));
            llSetColor(<1,1,0>,ALL_SIDES);
        llSetTimerEvent(60);
     }
     }
}
}
</lsl>
</source>

Latest revision as of 00:22, 25 January 2015

This script is released under DNSIOIWKU License, Free and Open for anyone...

//  anti return created by Jor3l Boa 
//==================================================
//  (works on blue and rausch combat region), 
//  NOTE: for red, change -5 to 5 and + 5 to -5 :)
//  this anti return needs a nearby region
//  with entry perms to work.
//==================================================
// NOTE: USE IT AT YOUR OWN RISK! <------YOUR OWN RISK!
//version 0.1

//Change log:
//  - 0.1 initial release

warpPos(vector destpos) 
{ 
   llSetPrimitiveParams([PRIM_POSITION, <1.304382E+19, 1.304382E+19, 0.0>, PRIM_POSITION,destpos]);
}
integer time;

default
{
    state_entry()
    {
        llSetTimerEvent(10);
    }

    timer()
    {
        llSetTimerEvent(0);
        llSetColor(<1,0,0>,ALL_SIDES);
        vector pos = llGetPos();
            warpPos(<-5,pos.y,pos.z>);
        vector tpos = llGetPos();
            warpPos(<tpos.x + pos.x + 5,pos.y,pos.z>);
        llSetColor(<1,1,0>,ALL_SIDES);
            llSetTimerEvent(60);
        time++;
        //llSetText((string)time+" minutes\nin this region.",<1,0,0>,1.0);
    }
}

NOTE: I am not responsible for the use you give to this code, you are free to use it at your OWN risk

Another version... better :)

float TIMER_SIM_JUMP = 600.0;

safe_posJump( vector target_pos )
{
    // An alternative to the warpPos trick without all the overhead.
    // Trickery discovered by Uchi Desmoulins and Gonta Maltz. More exact value provided by Fake Fitzgerald. 
    // Safe movement modification provided by Alias Turbo.
    vector start_pos = llGetPos();
    llSetPrimitiveParams( [ PRIM_POSITION , < 1.304382E+19 , 1.304382E+19 , 0.0 > , PRIM_POSITION , target_pos , 
                            PRIM_POSITION , start_pos , PRIM_POSITION , target_pos ] );
}

vector get_another_region()
{
    list test = [ < 1.0 , 0.0 , 0.0 > , < -1.0 , 0.0 , 0.0 > , < 0.0 , 1.0 , 0.0 > , < 0.0 , -1.0 , 0.0 > ];
    integer i;
    vector off;
    for ( ; i < 4 ; i += 1 )
    {
        off = llList2Vector( test , i );
        if ( !llEdgeOfWorld( < 128.0 , 128.0 , 100.0 > , off ) ) jump found;
    }
    return ZERO_VECTOR;
    @found;
    vector m_pos = llGetPos();
    return off * 254.0;
}

default
{
    on_rez( integer start_param )
    {
        llResetScript();
    }
    
    state_entry()
    {
        vector another_region = get_another_region();
        if ( another_region )
        {
            llOwnerSay( "NR: Activated." );
            llSetTimerEvent( TIMER_SIM_JUMP );
        } else llOwnerSay( "NR: This will not work in the current region." );
    }

    timer()
    {
        vector another_region = get_another_region();
        if ( another_region )
        {
            safe_posJump( llGetPos() + another_region );
            llSleep( 2.0 );
            safe_posJump( llGetPos() - another_region );
        }
    }
}