Change font size
It is currently Sat Feb 16, 2019 8:46 am

Forum rules


{L_IMAGE}



Post a new topicPost a reply Page 1 of 8   [ 74 posts ]
Go to page 1, 2, 3, 4, 5 ... 8  Next
Author Message
 Post subject: MY EXPERIMENT WITH OPENSIM AND SOME OF MY FREE SCRIPTS
PostPosted: Sun Oct 18, 2015 4:21 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
I love Opensim. For me it is magical. I'm highly interested in the multifaceted educational aspects of Opensim and its scope in solving some of the real-life problems. Opensim offers an awesome, versatile and truly immersive teaching learning experience as I've seen by minutely using it in real-life class-room situations many a time as well as in some serious administrative professional training to compensate the lack of hardware infrastructure and I was utterly amazed at the efficacious result.
The due credit, without fail, goes to the respected developers, admins and myriads of talented, earnest and passionate persons who are painstakingly making it better day by day with their concerted and whole hearted effort.
Inspired by their dedication, love and sacrifice, I, with humble submission, just wish to add my two cents here. If anyone finds anything useful in my works, I'll surely be happy.

My works are free for all and solely intended for educational purpose. Kindly don't use my works for commercial purpose.
I am learning scripting so my works are not flawless. There might be some bugs and inefficiency. Sometimes I had to compromise on that just to make the script length shorter in a thread or for the sake of legibility for a newcomer to the wonderful world of scripting. But they can easily be fixed.
I fix bugs, update my scripts often and add more features or functionalities frequently. So be sure to check back my thread often for the update of the old versions of the scripts.

One very important thing: Sometimes you might find that a texture UUID is not working in a script and it is pure white when the uuid is applied. This is just an asset server issue which simply killed the textures. I am facing this lately. In that case (1) Check for any updated version of that specific script here or (2) inform me here and I will upload the asset again.

MY FREE LSL SCRIPTS AND TUTORIALS
1. Make Animated Mesh model for Secondlife and Opensim
2. Make GIF like Texture Animation in Secondlife and Opensim
3. BUILD YOUR OWN TEXTURE ANIMATION TOOL UPDATED TO VERSION 1.2 NOW
4. How Ray Casting works in Opensim and Secondlife-Tutorial with easy examples
5. Build an Instant Automated Touring Vehicle or Pos Rot Recorder and Player
6. Build an Audio Spectrum Analyser for SL and Opensim-Dancing bar display
7. Build a Magic Light for fun in the Virtual World
8. Build a Hydraulic Door for Virtual World
9. Nested Loop Example in Opensim and Secondlife -Make a Text Animation in LSL
10. Find LinkNumber from a LinkName- A very important LSL UDF
11. Build a VU meter using LSL and Pythagorean Theorem in Secondlife and Opensim
12. Build Multiple Doors with a simple single Script
13. Build a Multi Prim Curtain
14. Build a Magic curtain or Magic door (Interesting path cut script)
15. Build an Animated secret Door or Staircase ( It can be used with mesh too)
16. Build an Alarm Clock test for virtual world
17. Build an auto-closing 3 in 1 sliding door for virtual world.
18. Build an Automatic Staircase with LSL.
19. Build a Combination Lock Script For RP sims in Opensimulator and SecondLife
20. Build An All Purpose Analogue VU Meter
21. Build a very simple Hud for mesh animation for OpenSim and SecondLife
22. Build a Funny AFK Device.
23. Build a Magic Light with LSL Rotation for Opensim and SL
24. Build a Fountain for virtual World using Particle System
25. Build FAKE PHYSICS- A FUNNY TOY
26. Build an ANADIGI CLOCK for OPENSIM AND SECONDLIFE made with single script
27. Build A quick 7 segment Digital Display with normal prims
28. Build a Simple double pane slow opening hinge door
29. Build A Simple Photo viewer with instant loading feature
30. Build an LED CHASER LIGHT
31. Build A very basic Traffic Signal for Secondlife and Opensim
32. Build a Table Fan with 3 Speed push button Regulator
33. Build a Light Script Generator for SL and Opensim
34. Build a Rotation Generator - Understanding llTargetOmega
35. Build a DRAGGABLE SCI-FI WINDOW ( UPDATED and OPTIMIZED)
36. Build an Automatic Button Code Generator For 1 Prim Switch Board or hud ( 8 prim version)
37. Build an Automatic Button Code Generator For 1 Prim Switch Board or hud ( 6 prim version)
38. Build a Realistic Draggable shutter door for your shop or Garage
39. BUILD A PARTICLE GENERATOR MACHINE FOR OPENSIM ( OSGRID), STEP BY STEP RIGHT FROM THE SCRATCH Ongoing project NOW AVAILABLE INWORLD from 24 December 2016
40. An interactive English verb conjugation board for Kids and Second language learners Updated on 28 August 2016
41. A Simple Countdown Timer with preset and custom input with some enhancements some more features added , Optimized ....Major Update on 5th November 2016
42. FUN WITH PARTICLE TRAIL Tested in OSG Sandbox too




BLENDER 3D TUTORIALS
1. Very easily and quickly make a 3d mesh model of a bench with an image reference in Blender
2. Make a Shiny texture for opensim & SL with Blender with nodes -Bake texture with specularity
3. Easily make a wrought iron gate or fence for Opensim or Secondlife
4. Proof why Blender is so easy to learn for Opensim and SL Users, contrary to the popular belief- PART ONE
5. icosphere with frame
6. How to find the centre point of dodecahedron polygon
7. A VERY SLOW BLENDER TUTORIAL - BASICS PART 1
8. Easily Create an advanced scene in blender and recreate in opensim-A VERY SLOW Blender Tutorial
9. Professional Multitrack Video Editing With Blender - Part One- A VERY SLOW Blender Tutorial
10. Professional multitrack video editing with Blender - part two A VERY SLOW Blender Tutorial
11. Advanced animation technique using Graph Editor in Blender -make an Audio Spectrum analyzer
12. Make professional 2d cartoons with zero skill with Blender -A VERY SLOW Blender tutorial
13. 2d and 3d Animation basics using keyframes - A VERY SLOW Blender tutorial for my friends
14. Understanding Texturizing in Blender from Opensim or SL perspective ( bad audio)
15. Assign Multiple Materials and textures to your Single Mesh Object- HD VIDEO TUTORIAL
16. Make A wedding ring with Blender -A VERY SLOW BlenderTutorial
17. Quick modelling using an image reference with Blender 2.67- A VERY SLOW Blender Tutorial
18. Making a Fence with Array Modifier- A VERY SLOW Blender tutorial


OPENSIM SPECIFIC TUTORIALS
1. Easily compile Opensim from source code on Linux-HD VIDEO TUTORIAL
2. The Easiest Opensim Installation Tutorial with MySQL Database on Linux
3. Opensim Local Standalone Installation tutorial for windows users
4. How to easily install Diva distro with mysql database as a standalone local test server

ELECTRONICS SIMULATION USING OPENSIM
1. Operational Amplifier Simulation in Virtual World
2. APEX Gainclone City- A 3d representation of APEX Gainclone CLASS AB-A CONJUGATE Audio Amplifier

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Wed Sep 06, 2017 9:53 am, edited 35 times in total.

Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:22 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
Make Animated Mesh model for Secondlife and Opensim


Script 1:
{L_CODE}:
////---------Script starts here ---- copy from here

float animation_speed = 0.5;
integer total_prims;
integer link_counter;

default
{ state_entry() { total_prims = llGetNumberOfPrims(); llSetTimerEvent(animation_speed ); } timer() { link_counter++; llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES); llSetLinkAlpha( link_counter,1.0, ALL_SIDES); if( link_counter == total_prims) { link_counter = 0; } }
}

//// -------- end of script --- copy up to here.


***********************************************

Script 2:
A quick script for randomized mesh animation
{L_CODE}:
////Script starts below this line ----------------------------------------­-------------

float randomized_time = 7.0; // experiment with this time
float animation_speed = 0.5;
integer total_prims;
integer link_counter;

action()
{
    llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
   llSetLinkAlpha( link_counter,1.0, ALL_SIDES);
}

default
{ state_entry() { total_prims = llGetNumberOfPrims(); state warmup; }
}

state warmup
{
     state_entry()
     {
        state trigger;
     } 
}

state trigger
{
     state_entry()
    {
         llSetTimerEvent(animation_speed);
    }

    timer()
    {
        link_counter++;
        action();
       if( link_counter == total_prims)
       {
           link_counter = 0; state wait;
       }
   }
}

state wait
{
     state_entry()
    {
         llSetTimerEvent(llFrand(randomized_time)­);
     }
     changed( integer c)
     {
         if ( c & CHANGED_LINK)
         {
              llResetScript();
          }
      }
     timer()
    {
        state warmup;
    }
}

/////Script ends above this line------------------------------------­------------------


*************************************************************************************************************
Script 3:
Here is another script if you don't want to animate the root Prim in the link Set.

link_counter counts the prim in a linkset one by one.
Root Prim number is 1 in a linkset. And 2 is the number of the first child prim if we link the prims sequentially . Hence I set the initial value of the link_counter to 2. so that it will ignore number 1 ( which is the root prim) ;
{L_CODE}:
/// Script starts here

float animation_speed = 0.25; // change as per your need
integer link_counter = 2; // 2 is the first childprim number in a linkset
integer total_prims;
set_alpha()
{ llSetLinkAlpha(LINK_SET, 0.0,-1); llSetLinkAlpha( LINK_ROOT,1.0,-1); llSetLinkAlpha( link_counter,1.0, -1);
}
default
{ state_entry() { total_prims = llGetNumberOfPrims(); llSetLinkAlpha(LINK_SET, 1.0,-1); llSetTimerEvent(animation_speed ); state forward; }
}
state forward
{ timer() { link_counter++; set_alpha(); if( link_counter == total_prims) { state reverse; } }
}
state reverse
{ timer() { link_counter--; set_alpha(); if( link_counter == 2) { state forward; } }
}

/// script ends here


*******************************************************************************************************
Script 4:
Here is another script for you. Suppose you need to make the root prim and some child prims visible during the animation. Just change the number_of_visible_prims in this script and see the fun. I tested in SL.
{L_CODE}:
///Script starts here

float animation_speed = 0.5;
integer number_of_visible_prims = 2; // how many prims to make visible in your linkset during animation
/*
    example:
    1 = the root prim only
    2 = root prim+ first child prim
    3 = root Prim+ childprim 1 + child prim 2 etc
*/
integer link_counter ;
integer total_prims;set_visible()
{
    integer c;
    while( c<= number_of_visible_prims)
    {
       llSetLinkAlpha( c,1.0, -1);
       ++c;
    }
}
set_alpha()
{
    llSetLinkAlpha(LINK_SET, 0.0,-1);
    set_visible();
    llSetLinkAlpha( link_counter,1.0, -1);
}


default
{
    state_entry()
    {
        link_counter = number_of_visible_prims;
        total_prims = llGetNumberOfPrims();
        llSetLinkAlpha(LINK_SET,1.0,-1);
        llSetTimerEvent(animation_speed );
        state forward;
    }
}

state forward
{
    timer()
    {
        set_alpha();
        link_counter++;
        if( link_counter == total_prims)
        {
            state reverse;
        }
    }
}

state reverse
{
    timer()
    {
       set_alpha();
       link_counter--;
       if( link_counter == number_of_visible_prims + 1)
       {
            state forward;
       } 
    }
}

///script ends here

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Thu Oct 22, 2015 6:27 am, edited 4 times in total.

Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:24 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
GIF like Texture Animation in Secondlife and Opensim

Steps I've covered in this tutorial are the following:

1. Use Blender as a video editor. Extract the frames you want.
2. Import the pictures in gimp. Set up Grid ( Use open as Layers instead of what I've shown here )
3. Resize the pictures. ( You can use an alternate batch image resizer if you know any )
4. Create your tiled image
I've arranged my picture tiles following a sequence like this: from frame 1 to frame 16
1 | 2 | 3 | 4
5 | 6 | 7 | 8
9 | 10 | 11 | 12
13 | 14 | 15 | 16

5. Upload to secondlife or opensim
6. Write your very simple Script. ( I explained in detail in this video ).
7. Tweak the speed if you like.( starting from 1/10 if ( X * Y number of tiles )

Important, please read:
In this tutorial I've created a 4 X 4 tiled texture. But you can create any number of tiles ( like 6 X 6 or 8X8, or 32 X 1 or whatever you like, anything) in your texture. Just write the right number of X and Y tiles in the first part of your script and experiment with animation speed adjustment.
( I've re-written these values in the beginning of the script provided below as global variables for your convenience so that you can easily change the value without damaging the script. :) )

So this is the script below for our 4 X 4 tiled texture, if you are lost.
Youtube has removed the formatting. But a copy paste should work in your situation.

///// Copy below the line --------------------------

{L_CODE}:
integer number_of_X_tiles = 4;
integer number_of_Y_tiles = 4;
integer textured_face = 3;
float animation_speed = 16.0;


default
{
    state_entry()
   {
        integer multiply_XY = number_of_X_tiles * number_of_Y_tiles;
        llSetTextureAnim( ANIM_ON|LOOP| PING_PONG,
                 textured_face ,
                 number_of_X_tiles ,
                 number_of_Y_tiles,
                 0,
                 multiply_XY,
                 animation_speed
       );
    }
}


////// Copy above this line---------------------

Thanks for watching. :)

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Thu Oct 22, 2015 6:30 am, edited 3 times in total.

Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:27 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
Very easily and quickly make a 3d mesh model of a bench with an image reference in Blender

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:29 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
Make a Shiny texture for opensim & SL with Blender with nodes -Bake texture with specularity
This series of Video Tutorials is for my dear friends and Senior Citizens who are very new to Blender 3d modelling. Some professional stuff here. :)

No sound because my non-English speaking friends don't always feel at home with my bad, unintelligible accent, LOL. :mrgreen:

Anyway, my aim is to set them on the track with my level best sincere effort. I am making this tutorial keeping in my mind my own initial frustrations that I faced when I began to learn Blender.

These tutorials are real time and very slow paced on purpose. So some patience is required. Kindly pause/rewind as many times as per your need.

I've used the default interface of Blender so that nothing appears alien to the new learner. I tried to annotate as much as possible. So if you notice you are missing something, kindly go back to my earlier tutorials and you will definitely find that missing reference. I tried to follow gradation in the series.
________________________________________­______________
This tutorial shows how to use a node editor to bake your nice and realistic textures for opensim.
I used Smart UV unwrap to quickly show my viewers how to do it with a very rough model. But you should carefully plan topology and do a manual unwrapping when you will learn more. I will cover that in the forthcoming tutorial.
Meanwhile, feel free to experiment and discover new things yourself. :)

I learned this from several web resources.
It gives you amazing result once you understand it. :) And I'm sure you will love it. :) Many blender professionals work with this method.


_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Sun Oct 18, 2015 12:24 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 18, 2015 4:35 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
How Ray Casting works in Opensim and Secondlife-Tutorial with easy examples

{L_CODE}:
//Script starts here

particle(integer link, key k)
{
    llLinkParticleSystem( link,
    [
        PSYS_PART_FLAGS, 373,
        PSYS_SRC_PATTERN, 2,
        PSYS_PART_START_ALPHA, 1.0,
        PSYS_PART_END_ALPHA, 1.0,
        PSYS_PART_START_COLOR, <0.0, 0.0, 1.0>,
        PSYS_PART_END_COLOR, <0.0, 1.0, 1.0>,
        PSYS_PART_START_SCALE, <0.15, 0.15, 0.0>,
        PSYS_PART_END_SCALE, <1.0, 1.0, 0.0>,
        PSYS_PART_MAX_AGE, 6.0,
        PSYS_SRC_MAX_AGE, 0.0,
        PSYS_SRC_ACCEL, <0.0, 0.0, 2.0>,
        PSYS_SRC_ANGLE_BEGIN, 0.0,
        PSYS_SRC_ANGLE_END, 0.0,
        PSYS_SRC_BURST_PART_COUNT, 30,
        PSYS_SRC_BURST_RATE, 0.16,
        PSYS_SRC_BURST_RADIUS, 1.5,
        PSYS_SRC_BURST_SPEED_MIN, 0.1,
        PSYS_SRC_BURST_SPEED_MAX, 1.0,
        PSYS_SRC_OMEGA, <0.0, 0.0, 0.0>,
        PSYS_SRC_TARGET_KEY,(key)k,
        PSYS_SRC_TEXTURE, ""
    ]);
}

default
{
    touch_start( integer t)
    {
        vector pos = llGetPos();
        list myRay = llCastRay(
            pos,
            pos + <64,0,0>,
            [RC_MAX_HITS,1, RC_DETECT_PHANTOM,1]
            );
        integer something_detected =llList2Integer(myRay,-1);
       
        if( something_detected > 0)
        {
            string target_key = llList2Key(myRay,0);
            vector target_pos = llList2Key(myRay,1);
            string target_name = llKey2Name(target_key);
           
            llOwnerSay(
                    "\ntarget key is " + (string)target_key
                    + "\ntarget position is "+ (string)llList2Key(myRay,1)
                    +"\ntarget name is " +target_name   
            );
           
            particle(LINK_SET, target_key);
            llSleep(3.0);
            llLinkParticleSystem( LINK_SET,[]);
        }
       
        else if( something_detected < 0)
        {     
            llOwnerSay("... error, try again later...");
        }
               
        else
        {
             llOwnerSay("... no objects in the line ...");
        }
    }
}
//Script ends here

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Sun Oct 18, 2015 12:47 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:47 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
Easily make a wrought iron gate or fence for Opensim or Secondlife
The easiest way to make a wrought iron fence using an image or photo reference with blender3d.
This is a step by step, slow paced, easy to understand tutorial for my friends. Everything has been explained clearly.



My respected friend Key (OSG Admin) made an awesome set of Wrought Iron Work. I felt inspired with his work and decided to build a little. Here is the result so far. :)

{L_IMAGE}

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Sun Oct 18, 2015 12:30 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:52 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
Automated Touring Vehicle or Pos Rot Recorder and Player
Long ago, I wrote this script for my dear friends Doremifasolatido and Cuteulala.
There are two versions of this script. The first one One loops through the tour while the second one stops after the tour.

We need to modify the MinTimerInterval = 0.05 under XEngine option in the Opensim.ini file to make it work properly in the Opensim.
Thanks Cuteulala for reminding me the forgotten parameter. :)



Get my Free Script and feel free to experiment. Kindly post your update/ mod back here.

{L_CODE}:
//////Script Starts Here

float interval = 0.1;// speed of recording
                           
//----------------------------------------------------//
integer channel = 0;
integer on;
list rec;
integer rec_length;

//integer listenHandle;

ppf(integer link, list l)
{
     llSetLinkPrimitiveParamsFast( link, l);
}

record()
{
    list details = llGetObjectDetails( llGetOwner() ,[OBJECT_POS, OBJECT_ROT]);
   
    vector root_pos = llList2Vector( details , 0);
    rotation root_rot = llList2Rot( details , 1);
                 
    rec = [root_pos  ] + [root_rot ] +  rec;
    rec_length = llGetListLength(rec)-2 ;
}

default
{
    state_entry()
    {
        llSetStatus( STATUS_PHANTOM,1);
        rec= [];
        llSay(channel,"ready");
        llListen(channel,"",llGetOwner(),"");
    }
       
    on_rez(integer r)
    {
        llResetScript();
    }
   
    listen( integer c, string n, key k, string m)
    {
        if( "start" == m)
        {
            llSetRegionPos( llList2Vector(llGetObjectDetails( llGetOwner(),[OBJECT_POS]),0) );
            llSetRot( llList2Rot(llGetObjectDetails( llGetOwner(),[OBJECT_ROT]),0) );
            llSetTimerEvent(interval);
            llOwnerSay("Recording started..." );
           return;
        }
        else if( "stop" == m)
        {
            llOwnerSay( "Recording done" );
            llSetTimerEvent(0);
            state play;
        }   
    }

   
    timer()
    {
        if( llGetFreeMemory() < 250)
        {
            llOwnerSay("Out of Memory---length is " + (string) (llGetListLength(rec)-2) );
            llOwnerSay( "Recording Limit Exceeded. Recording Stopped." );
            state play;
        }
        record ();
    }
}

state play
{
    state_entry()
    {
       llListen(channel,"","","");
    }
   
    on_rez(integer r)
    {
        llResetScript();
    }
       
       
    listen( integer c, string n, key k, string m)
    {
        llOwnerSay(m);
        if( "play" == m)
        {
            llSetTimerEvent(interval);
        }
        else if( "stop" == m)
        {
            llSetTimerEvent(0.0);
        }
        else if ( "spam" == m)
        {
           llOwnerSay( llDumpList2String(rec,",") );
        }
        /*else if( "home" == m)
        {
           //llSetRegionPos(start_pos);
           llSetTimerEvent(0.0);
        }
       
        else if( "kill" == m)
        {
          llDie();
        }
        else if( "reset" == m)
        {
           llResetScript();
        }
        */         
    }
     
   
    timer()
    {
        ppf( LINK_THIS,[PRIM_POSITION, llList2Vector (rec,rec_length--)]);
        ppf( LINK_THIS,[PRIM_ROTATION, llList2Rot(rec,rec_length--) ]);
     
        if( rec_length <= 1 )
        {
            rec_length =  llGetListLength( rec )- 2;
        }
    }           
}

///// script ends here


Here is another version of the same script. The tour stops and the vehicle awaits the command from owner.
Automated Touring Vehicle or Pos Rot Recorder and Player version 2.0- (stops after the tour and waits)
{L_CODE}:
//////Script Starts Here
// All my works are free for all.
//Kindly no commercial usage. Thanks. 

float interval = 0.1;// speed of recording
float wait_time = 5;// how long to wait after the completion of the tour, adjust as per your need
                           
//----------------------------------------------------//
integer channel = 0;
integer on;
list rec;
integer rec_length;

vector start_pos;

say( string msg)
{
    llOwnerSay(msg);
}

ppf(integer link, list l)
{
     llSetLinkPrimitiveParamsFast( link, l);
}

record()
{
    list details = llGetObjectDetails( llGetOwner() ,[OBJECT_POS, OBJECT_ROT]);
   
    vector root_pos = llList2Vector( details , 0);
    rotation root_rot = llList2Rot( details , 1);
                 
    rec = [root_pos  ] + [root_rot ] +  rec;
    rec_length = llGetListLength(rec)-2 ;
}

default
{
    state_entry()
    {
        llSetStatus( STATUS_PHANTOM,1);
        rec= [];
        llSay(channel,"ready");
        llListen(channel,"",llGetOwner(),"");
    }
       
    on_rez(integer r)
    {
        llResetScript();
    }
   
    listen( integer c, string n, key k, string m)
    {
        if( "start" == m)
        {
            llSetRegionPos( llList2Vector(llGetObjectDetails( llGetOwner(),[OBJECT_POS]),0) );
            llSetRot( llList2Rot(llGetObjectDetails( llGetOwner(),[OBJECT_ROT]),0) );
            llSetTimerEvent(interval);
            say("Recording started..." );
           return;
        }
        else if( "stop" == m)
        {
            say( "Recording done" );
            llSetTimerEvent(0);
            state play;
        }   
    }

   
    timer()
    {
        if( llGetFreeMemory() < 250)
        {
            say("Out of Memory---length is " + (string) (llGetListLength(rec)-2) );
            say( "Recording Limit Exceeded. Recording Stopped." );
            state play;
        }
        record ();
    }
}

state play
{
    state_entry()
    {
       start_pos = llGetPos();
       llListen(channel,"","","");
    }
   
    on_rez(integer r)
    {
        llResetScript();
    }
       
       
    listen( integer c, string n, key k, string m)
    {
        say(m);
        if( "play" == m)
        {
            llSetTimerEvent(interval);
        }
        else if( "stop" == m)
        {
            llSetTimerEvent(0.0);
        }
        else if ( "spam" == m)
        {
           say( llDumpList2String(rec,",") );
        }
        else if( "home" == m)
        {
           llSetRegionPos(start_pos);
           llSetTimerEvent(0.0);
        }
        /*
        else if( "kill" == m)
        {
          llDie();
        }
        */
        else if( "reset" == m)
        {
           llResetScript();
        }
    }
     
   
    timer()
    {
        ppf( LINK_THIS,[PRIM_POSITION, llList2Vector (rec,rec_length--)]);
        ppf( LINK_THIS,[PRIM_ROTATION, llList2Rot(rec,rec_length--) ]);
     
        if( rec_length <= 1 )
        {
            rec_length =  llGetListLength( rec )- 2;
            llSetTimerEvent(0);
            say("Tour Complete");
            state wait;
        }
    }
}

state wait
{
    state_entry()
    {
        llSetTimerEvent( wait_time);
    }
   
    timer()
    {
        llSetTimerEvent(0);
        llSetRegionPos(start_pos);
        say("Going back to the start position.\n Type play to start the tour again");
        state play;
    }
   
    on_rez(integer r)
    {
        llResetScript();
    }           
}
///// script ends here


_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Sun Oct 25, 2015 1:44 am, edited 5 times in total.

Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:54 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
Audio Spectrum Analyser for SL and Opensim-Dancing bar display - Get the Free Script


{L_CODE}:
////script starts here

float duration = 1000; // how long to play
float glow = 0.07;

ppf( integer link, list l)
{
    llSetLinkPrimitiveParamsFast( link,l);
}
integer total;
integer on;   
integer a ;
integer c;
vector color;
setup()
{
    total = llGetNumberOfPrims();
    integer i=2;
    float diff = 0.25;
    while( i <= total )
    {
        ppf(i,[PRIM_POS_LOCAL,<0.25+diff, 0,0>]);
        diff +=0.5;
        ++i;
    }
    ppf( LINK_SET,[
            PRIM_SLICE, <.5,1,0.0>
            , PRIM_PHANTOM, 1
            , PRIM_GLOW,-1, glow
            ,PRIM_TEXTURE, -1, TEXTURE_BLANK, <1,1,0>, <0,0,0>, 0
            ,7, <0.5 ,0.5 ,4> //
        ]);
}


default
{
    state_entry()
    {
        setup();
    }
   
    changed( integer c)
    {
        if ( c & CHANGED_LINK) llResetScript();
    }
    touch_start( integer t)
    {
        float time;
        if( on = on^1)
        {
            time = 0.04; // use 1e-2 or a loop for Secondlife
        }
       
        else
        {
           time = 0;
           ppf( LINK_SET,[PRIM_SIZE,<.5,0.5,0.1> ]);
        }
        llSetTimerEvent(time);
    }
   
    timer()
    {
        a = (integer) llFrand(total);
       
        color = < llFrand(0.7)+0.3,llFrand(0.7)+0.3,llFrand(0.7)+0.3>;
       
        ppf(a+1,[
            PRIM_SLICE,<0, llFrand(1.0),0>
            ,18,-1, color, 1
        ]);
       
        c++;
        if( c >= duration)
        {
            llSetTimerEvent(0);
            ppf(-1,[PRIM_SIZE,<.5,0.5,0.1>]);
            c= 0;
        }
    }
}


////script ends here

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Sun Oct 18, 2015 12:49 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: My experiment with Opensim and some of my Scripts
PostPosted: Sun Oct 18, 2015 4:55 am 
Furious Typer
User avatar

Joined: Sun Oct 18, 2015 4:09 am
Posts: 84
Location: Asia Pacific
Magic Light for fun in the Virtual World


{L_CODE}:
// Script starts here
params( integer link, list l)
{
    llSetLinkPrimitiveParamsFast(link,l);
}

setup()
{
    params( 1,[
PRIM_TYPE,0,0,<0.0, 1.0, 0.0>,0.0,<1.0, -1.0, 0.0>,<0.0, 0.0, 0.0>,<0.0, 0.0, 0.0>,
PRIM_ROT_LOCAL,<0.0, 0.0, 0.0, 1.0>,
PRIM_SIZE,<1.0, 1.0, 1.0> ]);
params( 2,[
PRIM_TYPE,0,0,<0.0, 1.0, 0.0>,0.0,<1.0, -1.0, 0.0>,<0.0, 0.0, 0.0>,<0.0, 0.0, 0.0>,
PRIM_POSITION,<0.0, -1.0, 0.0>,
PRIM_ROT_LOCAL,<0.0, 0.0, 0.0, 1.0>,
PRIM_SIZE,<1.0, 1.0, 1.0> ]);
params( 3,[
PRIM_TYPE,0,0,<0.0, 1.0, 0.0>,0.0,<1.0, -1.0, 0.0>,<0.0, 0.0, 0.0>,<0.0, 0.0, 0.0>,
PRIM_POSITION,<0.0, -2.0, 0.0>,
PRIM_ROT_LOCAL,<0.0, 0.0, 0.0, 1.0>,
PRIM_SIZE,<1.0, 1.0, 1.0> ]);
params( 4,[
PRIM_TYPE,0,0,<0.0, 1.0, 0.0>,0.0,<1.0, -1.0, 0.0>,<0.0, 0.0, 0.0>,<0.0, 0.0, 0.0>,
PRIM_POSITION,<0.0, -3.0, 0.0>,
PRIM_ROT_LOCAL,<0.0, 0.0, 0.0, 1.0>,
PRIM_SIZE,<1.0, 1.0, 1.0> ]); 
params( LINK_SET,[PRIM_COLOR,-1,<1,1,1>,0]);
params( -1,[PRIM_COLOR,0,<1,1,1>,1,  PRIM_GLOW,0,0.5]);
llSetLinkTexture(LINK_SET, TEXTURE_BLANK,-1);
}

slice( float i)
{
    params(LINK_SET,[ PRIM_SLICE,<0, i, 0> ]);
}
float increase ;

default
{
    state_entry()
    {
       setup();
       state begin;
    }
}

state begin
{
    state_entry()
    {
       slice( increase) ;
       llSetTimerEvent(0.05);
    }
   
   
   timer()
   {
       increase+=0.02;
       slice( increase) ;
       if ( increase >= 1)
       {
           state next;
       }   
   }
}

state next
{
   
    timer()
    {
        increase-=0.02;
        slice( increase) ;
        if ( increase <=0)
        {
           state begin;
        }   
    }
}


// Script ends here

_________________
"The size of your audience doesn't matter. Keep up the good work."

Link to my free scripts and tutorials.
http://forums.osgrid.org/viewtopic.php?f=5&t=5544&start=0
I'll be happy if you find anything useful. Thank you.


Last edited by Renoobed Radical on Sun Oct 18, 2015 12:50 pm, edited 2 times in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 8   [ 74 posts ]
Go to page 1, 2, 3, 4, 5 ... 8  Next


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net