Scripts Library

Creating scripts
User avatar
Constance Peregrine
Posts: 2348
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1479 times

stop all animations

Post by Constance Peregrine »

Put in a prim and click

Code: Select all

// stops all currently running animations when clicked
default {
    touch_start(integer num_detected) {
        llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
    }

    run_time_permissions(integer perm) {
        if(perm & PERMISSION_TRIGGER_ANIMATION)
        {
            list anims = llGetAnimationList(llGetPermissionsKey());        // get list of animations
            integer len = llGetListLength(anims);
            integer i;
            
            llSay(0, "Stopping " + (string)len + llGetSubString(" animations",0,-1 - (len == 1)));//strip the "s" when there is only 1 to stop.
            for (i = 0; i < len; ++i) llStopAnimation(llList2Key(anims, i));
            llSay(0, "Done");
        }
    }
}
These users thanked the author Constance Peregrine for the post:
Dot Matrix
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Kayaker Magic
Posts: 354
Joined: Sun Dec 01, 2013 8:40 am
Has thanked: 52 times
Been thanked: 393 times

Magic Bullet Sample Scripts

Post by Kayaker Magic »

I'm giving away some sample scripts to show how to make weapons that work with my Magic Bullet System. The short version: Go here http://www.kitely.com/market/product/60 ... et-Scripts and buy (for practically nothing) the FULL PERM scripts and try them out.

The long version: I developed this system to implement weapons in Open Simulator without using physics. It can also be set up to work in NO-REZ areas. (Normal weapons in SL require that you give “create object” permission to everyone, opening yourself up to griefing). It works using the LSL functions llCastRay and llRegionSay.

llCastRay looks in the direction you are pointing a weapon and decides if a ray cast in that direction will hit anything. If it does, the weapon sends a message with llRegionSay to tell the object it has been hit. If it is an avatar, then a HUD called a 'meter' listens for the message, calculates health, and informs the avatar. If it is a target, that just listens to the messages and displays a score. If it is a huntable animal or a sinkable ship, it listens to the message, calculates damage, and dies or sinks when the damage becomes too great.

An invisible ray is not very interesting, so I added another type of object: Bullet Effects Prims. These objects wait around listening to the same messages. They move invisibly to the location of a weapons hit, make explosive sounds, bursts of particles and particle beams. I have several types of effects prims already: One for weapons that shoot bullets, for arrows, snowballs, and laser beams. The owner of a region can rez a few of these and leave them lying around. Any weapon firing in the same region uses these to make effects. The owner of the land does not have to give anyone permission to rez bullets.

I had a lot of fun finding a way to do this and writing the scripts, but I'm about done making weapons. I'd like to share some of what I have done and see if anyone else is interested in developing weapons that use the same system. So I am giving away FULL PERM scripts that show how it works. I'm giving the scripts away without restriction, use them in any way, including in products for sale. If you are interested in making weapons, or making your existing objects react to them, check this out. It would be fun if all weapons developed in the future worked with each other. If you make a weapon based on these scripts, it will work with my effects prims, count scores on my targets, kill avatars wearing my meters, kill my huntable dinosaurs and sink by gunboats. My meter is actually very basic, you could write a better one! I have not done melee weapons, but I think this is possible.

I am giving these scripts away by placing them in simple objects and selling them for almost nothing in the Kitely Market. I'll also set up free givers in my stores. Grab a copy of these and try them out. Try your hand at making weapons. The scripts I am giving out are the following:

Simple Gun:
This script makes you hold and fire the stick it is in as if it was a rifle. You can change the prim into a better looking rifle. (It can be many prims). You can change a single line in the code and it will shoot laser beams or arrows instead of bullets. You will need different effects prims for this, but I include several for you to try out. You can change the animations and make it act like a handgun or a bow. (The viewer has built in animations for this already).

Simple Meter:
This script is even simpler than the meter I give away with all my other weapons. But this makes the code easier to read. It shows the basics of how a meter can listen for the right messages to tell when your avatar has been hit.

Simple Target:
This script shows how an object like a huntable animal or a boat can listen for the Magic Bullet messages. There is nothing preventing you from listening to these messages AND collision events in the same object. If you have a sinkable boat that uses collision events, look at this Simple Target script and see how simple it would be to also take Magic Bullet hits.

Simple Boat:
This is a slightly more complex version of the Simple Target script. I made it bob in the water like a buoy, jerk every time it is hit, EXPLODE and SINK when it takes too many hits. It actually makes a pretty fun target for shooting at with my new boat mounted cannon....

Effects Prims:
In the boxed set with the above objects, I am also including several of my Bullet Effects Prims. I'm not giving the source to these away, but they are COPY TRANS and you can pass them on to anyone who wants to set up your weapons. If your weapon fires bullets, arrows or shoots laser beams you can use these effects prims and don't have to develop your own. I started to write a “Simple Effects” script, but the simplest one seemed too complex to start with. However, if you would like to write one, contact me and we'll talk.

The Future:
The llCastRay function seems to limit us to weapons that fire very fast projectiles with very flat trajectories. However I have already found a way to make cannonballs follow a parabolic path. Calculating a parabola isn't Rocket Science after all! Well, perhaps it is! But it is still pretty easy and I don't need a physics engine to do this. I have not put this in a generally useable Bullet Effects Prim yet. It might make for a new type of arrow or thrown spear! I'm planning on making a SIM Defense Cannon with an effects prim that can fire across SIM boundaries in InWorldz.
These users thanked the author Kayaker Magic for the post (total 4):
Graham MillsDot MatrixSelby EvansChris Namaste
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Another book script (uses particles)

Post by Graham Mills »

These users thanked the author Graham Mills for the post:
Dot Matrix
User avatar
Dot Matrix
Posts: 1625
Joined: Sun Jul 28, 2013 3:26 am
Has thanked: 1208 times
Been thanked: 2324 times

Re: Scripts Library

Post by Dot Matrix »

Graham Mills wrote:Via Nebadon Izumi, untested. https://gist.github.com/nebadon2025/39f ... 01597206b4
It works on Kitely -- I've just tried it. Thanks, Graham.
These users thanked the author Dot Matrix for the post:
Graham Mills
User avatar
Ghaelen DLareh
Posts: 76
Joined: Thu Dec 27, 2012 4:13 pm
Has thanked: 49 times
Been thanked: 59 times
Contact:

Re: Walkthrough Teleporter

Post by Ghaelen DLareh »

I came across this script several times while looking for a teleport script for moving around within one region in Kitely (and between sims in Kitely). It looks wonderful, but I ignored it because I'm not using it for HG right now - I'm trying to get people from the link-in point to the classroom in the same 2x2 region.
Sarge Misfit wrote:This is the script I use in my WarpGates. Its a Hypergrid script I got on Pathlandia and I use it everywhere.

Code: Select all

// XEngine

// For more info see http://becunningandfulloftricks.com/2010/10/29/the-metaphor-of-portals
// anti-loop code added by Jag Nishi/The Ham

string  GridName     = "Visit Pathlandia\n(4000,4000)\n";
string  SimAddress   = "pathlandia.dlinkddns.com:9000:Pathlandia"; // use region name for inworld locations
string  LastVerified = "\nLast Verified: 04/05/2012";
string  Message      = "";
string  BoilerPlate  = "\nWalk through to teleport";
vector  LandingPoint = <123.0, 130.0, 13.0>;
vector  TextColor    = <0,1,1>;
vector  LookAt       = <1.0,1.0,0.0>;

key     AgentToTransfer;
list    LastFewAgents;

string  CONTROLLER_ID       = "A";
integer AUTO_START          = TRUE;
list    particle_parameters = [];
list    target_parameters   = [];

StartEffects()
{
    // llCollisionSound("Magic Chimes", 1.0);
    
    particle_parameters = [
        PSYS_SRC_TEXTURE,          llGetInventoryName(INVENTORY_TEXTURE, 0), 
        PSYS_PART_START_SCALE,     <0.10,0.10, FALSE>,
        PSYS_PART_END_SCALE,       <1.00,1.00, FALSE>, 
        PSYS_PART_START_COLOR,     <1,1,1>,
        PSYS_PART_END_COLOR,       <1,1,1>, 
        PSYS_PART_START_ALPHA,     (float)1.0,
        PSYS_PART_END_ALPHA,       (float)0.0,     
        PSYS_SRC_BURST_PART_COUNT, 500, 
        PSYS_SRC_BURST_RATE,       (float)0.01,   
        PSYS_PART_MAX_AGE,         (float)1.0, 
        PSYS_SRC_MAX_AGE,          (float)0.6,  
        PSYS_SRC_PATTERN,          2,
        PSYS_SRC_ACCEL,            <0.0,0.0,-3.0>,  
        PSYS_SRC_BURST_SPEED_MIN,  (float)1.2,
        PSYS_SRC_BURST_SPEED_MAX,  (float)5.01, 
        PSYS_SRC_ANGLE_BEGIN,      (float)0.25*PI,
        PSYS_SRC_ANGLE_END,        (float)0.00*PI,  
        PSYS_SRC_OMEGA,            <0,0,0>,       
        PSYS_PART_FLAGS, ( 0
                            | PSYS_PART_INTERP_COLOR_MASK   
                            | PSYS_PART_INTERP_SCALE_MASK   
                            | PSYS_PART_EMISSIVE_MASK   
                            | PSYS_PART_FOLLOW_VELOCITY_MASK
                            | PSYS_PART_WIND_MASK            
                         )                   
    ];
        
    if ( AUTO_START ) llParticleSystem( particle_parameters );
}

PerformTeleport( key WhomToTeleport )
{
    integer CurrentTime = llGetUnixTime();
    integer AgentIndex = llListFindList( LastFewAgents, [ WhomToTeleport ] );
    if (AgentIndex != -1)
    {
        integer PreviousTime = llList2Integer ( LastFewAgents, AgentIndex+1 );
        if (PreviousTime >= (CurrentTime -5)) return;
        LastFewAgents = llDeleteSubList( LastFewAgents, AgentIndex, AgentIndex+1);
    }
    LastFewAgents += [ WhomToTeleport, CurrentTime ];
    osTeleportAgent( WhomToTeleport, SimAddress, LandingPoint, LookAt );
}

default
{   
    on_rez(integer start_param)
    {
        llResetScript(); 
    }
    
    state_entry()
    {
        //llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES, 0, 0, 0, 0, .05);
        llSetText(GridName + SimAddress + BoilerPlate + LastVerified + Message, TextColor, 1);  
    }
    
    collision_start(integer num_detected)
    {
        StartEffects();
    
        if(llDetectedKey(0) != AgentToTransfer)
        {
            AgentToTransfer=llDetectedKey(0);
            PerformTeleport( llDetectedKey(0));
        }
        else
        {
            llSetTimerEvent(3);
        }
    }
    
    timer()
    {
        AgentToTransfer="";
        llSetTimerEvent(0);
    }
    
    touch_start(integer num_detected)
    {
        llGiveInventory(llDetectedKey(0),llGetInventoryName(INVENTORY_NOTECARD, 0));
    }
    
    link_message( integer sibling, integer num, string mesg, key target_key )
    {
        if ( mesg != CONTROLLER_ID ) { // this message isn't for me.  Bail out.
            return;
        } else if ( num == 0 ) { // Message says to turn particles OFF:
            llParticleSystem( [ ] );
        } else if ( num == 1 ) { // Message says to turn particles ON:
            llParticleSystem( particle_parameters + target_parameters );
        } else if ( num == 2 ) { // Turn on, and remember and use the key sent us as a target:
            target_parameters = [ PSYS_SRC_TARGET_KEY, target_key ];
            llParticleSystem( particle_parameters + target_parameters );
        } else { // bad instruction number
            // do nothing.
        }            
    }
}

//// "Explosion" PARTICLE TEMPLATE v1 - by Jopsy Pendragon - 4/8/2008
//// You are free to use this script as you please, so long as you include this line:
//** The original 'free' version of this script came from THE PARTICLE LABORATORY. **//
While Googling, (explained below) I found This Post in another thread about teleporting:
Shandon Loring wrote:I've seen some cool "Hypergates" that work on the hypergrid.. one just walks through it and is TP'd to another sim, even another grid.
I'd like to put a couple gates on one of my Kitely worlds to allow visitors to walk through and be TP'd to another of my Kitely worlds.
I got a hold of some Hypergate scripts, but they don't seem to do anything.
Any suggestions?
Thanks!!
and a reply:
Sarge Misfit wrote:The script is in the Scripts Library

http://www.kitely.com/forums/viewtopic.php?f=26&t=759

second post
and it led me once again to the second post of this current thread and to the above quoted script. (/me thinks of Ruby and circumlocution in action)

Sarge, is it true that this script is not just a HG script but will also work within Kitely (between regions) and within one region? If so, can you edit the 'second post' to indicate that? Newbies like me would love you :) If not, well, I was confused in my goings 'around over and over.


FYI, searching for "teleport script" on the Kitely forum yields nothing because the search engine considers 'teleport' too common to search for. I had to search Google, which then pointed me back here to the forums. So I feel like I've been going in circles more than a little....

And finally, what looks like an intersim teleport script within Kitely. From That Other Thread. I'm going to test this one now :)

Edit: This script (below) works beautifully to tp from one intra-region location to another. (Testing next to see how it works between regions of the same grid.)
Dundridge Dreadlow wrote:Try something simple like..

Code: Select all

// change the following for somewhere that excites you, if you like :)
string region="Computer Plaza";    // where you are going
vector position=<140,172,38>;      // where you are landing
vector lookat=<0,1,0>;                 // what you are looking at.

beam(key agent)
{
    osTeleportAgent(agent, region, position, lookat);
}

default
{

// touch or colliison, take yer pick.
//touch_start(integer c)
   collision_start(integer c)
   {
        integer n;
        for (n=0; n<c; n++)
        {
            if (llDetectedType(n) & AGENT)
            {
                beam(llDetectedKey(n));
            }
        }
   }
}
A Curative Poison (a metaverse story)

De Landria Rising Market

The De Landria Project
User avatar
Selby Evans
Posts: 620
Joined: Wed Sep 04, 2013 6:00 pm
Has thanked: 1840 times
Been thanked: 822 times

Re: Scripts Library

Post by Selby Evans »

We have used walkin TPs (local to kitely) for a long time on Cookie II. They are quite reliable. If you want one, go to Cookie II, main arrival point. They should be free-to-copy.

I have tried HG gates, but have not found one that was dependable. I gave up. If anyone has one, I would be interested in having the script.
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Scripts Library

Post by Graham Mills »

I thought I would write a simple multi-purpose script that took the parameters from the object description field to allow for 3 possibilities:

Kitely intra-region
<128,128,23>

Kitely inter-region
Kitely Welcome Center;<128,128,23>

Hypergrid
hg.hyperica.com:8022:Hyperica Upper;<128,128,23>

Note that the semi-colon is used as separator (although the code could be amended to make it superfluous) and at present there is almost zero error-checking.

Anyway, the first two worked fine with Firestorm 4.6.9 but the hypergrid one not at all. An interesting observation, however, is that all three worked when I swapped to Alchemy beta 4.0.0. Don't ask me why but it is worth noting that the Firestorm is 14 months old :oops:

NB this is touch-activated.

Code: Select all

default
{
    touch_start(integer num_detected) 
  {
    key avatar = llDetectedKey(0);
    string params = llGetObjectDesc();
    string destination;
    vector landingpoint;
    vector LookAt = <1,1,1>;
    if (llSubStringIndex(params, ";") > -1)
    {
        list paramsList = llParseString2List(params, [";"], []);
        destination = llList2String(paramsList, 0);
        landingpoint = llList2Vector(paramsList,1);
        llInstantMessage(avatar, "Teleporting you to : " + destination);
        osTeleportAgent(avatar, destination, landingpoint, LookAt); 
    }
    else if (llStringLength(params) > 0)
    {
        landingpoint = (vector)llGetObjectDesc();
        llInstantMessage(avatar, "Intra-region teleport to :" + (string)landingpoint);
        osTeleportAgent(avatar, landingpoint, LookAt); 
    }

  }
}
Last edited by Graham Mills on Thu Feb 25, 2016 11:54 pm, edited 1 time in total.
User avatar
Ilan Tochner
Posts: 6504
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4943 times
Been thanked: 4455 times
Contact:

Re: Scripts Library

Post by Ilan Tochner »

Have you tried your script with the latest Firestorm version Graham?
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Scripts Library

Post by Graham Mills »

Ilan Tochner wrote:Have you tried your script with the latest Firestorm version Graham?
I tried latest 32-bit FS 4.7.5 and that failed too although I should stress that I didn't do a clean install (it's late). I also updated the code as I pasted the wrong version.

PS: I think there may be a ghosted HG avatar on KWC.
User avatar
Ilan Tochner
Posts: 6504
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4943 times
Been thanked: 4455 times
Contact:

Re: Scripts Library

Post by Ilan Tochner »

Thank you for the heads up Graham.

I've restarted Kitely Welcome Center.
Post Reply