Categoria: linden script


LSL-Editor è un editor di script e compilatore per LSL (Secondlife) che ti consente anche di eseguire LSL scripts. Non è necessario avere un SecondLife viewer oppure una SecondLife grid.

Sito web: http://www.lsleditor.org/ 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

Con questa riga di codice, verifichiamo se l'utente corrente, ha i permessi necessari per eseguire un blocco di codice

if( llDetectedOwner( 0 ) == llGetOwner() ) { 
//esegui codice qui
}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

integer CHANNEL = 42; // dialog channel
list MENU_MAIN = ["Floor 1", "Floor 2", "Floor 3", "Floor 4", "Floor 5", "Floor 6", "Floor 7"]; // the main menu
float BOTTOM = 27.300;
float FLOOR_HEIGHT = 10;
float SPEED = 1;
float target;
default
{
    state_entry()
    {
        llListen(CHANNEL, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
        llSitTarget(<0,-0.5,0.5>, llEuler2Rot(<0,0,-90>) );
        llSetText("Sit Here to Ride Elevator",<0,0,0>,1.0);
        target = BOTTOM;
    }   
    listen(integer channel, string name, key id, string message)
    {
        integer idx = llListFindList(MENU_MAIN, [message]);
        if( idx!=-1 )
        {
            llSay(0,"Elevator heading to " + message + "." );
            target = BOTTOM + (idx*10);
            state moving;
        }
    }
    changed(integer Change)
    {
        llDialog(llAvatarOnSitTarget(), "Where to?", MENU_MAIN, CHANNEL);
    }   
}
state moving
{     
    state_entry()
    {
        llSetTimerEvent(0.1);
    }   
    timer()
    {
        vector pos = llGetPos();
        pos.x = 50.500;
        pos.y = 90.740;       
        if( pos.z!=target )
        {
            if( pos.z>target )
            {
                pos.z = pos.z - SPEED;
            }
            else
            {
                pos.z = pos.z + SPEED;
            }
        }       
        if(  llFabs(pos.z - target) < SPEED )
        {
            pos.z = target;
            llSetTimerEvent(0);
            llSetPos(pos);
            llSay(0,"Elevator has reached its target." );
            state default;
        }          
        llSetPos(pos);       
    }
}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

Default
{
touch_start(integer total_number)
{
llGiveInventory(llDetectedKey(0, "My Notecard");
}
}

Dove "My Notecard" è il nome dell'oggetto nel'inventario

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

 

http://wiki.secondlife.com/wiki/LSL_Portal
http://www.lslwiki.net
http://del.icio.us/signore/documentation
http://rpgstats.com
http://www.kan-ed.org/second-life/using-LSL.html
http://forums.secondlife.com/forumdisplay.php?f=54
http://digilander.libero.it/morpheus.19 … nguage.htm

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

Unari
Un operatore unario è un operatore aritmetico che modifica un valore come ad esempio:

integer contatore = 1;
contatore++;
llSay(0, (string)contatore);

Binari
Gli operatori binari sono operatori aritmetici  in cui interagiscono due valori:

integer a = 5;
integer b = 2;
integer c = a + b;

Booleani
Un operatore booleano genera TRUE (1) o FALSE (0):

 

Logici
Sono operatori che congiungono AND o divergono OR. Ad esempio:

integer a = 5;
integer b = 2;
integer c = a | b;
integer d = a & b;

Assegnamento
Questo operatore assegna un valore a un tipo. Ad esempio:

integer a = 5;

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

Integer

Un intero è un numero che va da -2,147,483,648 a 2,147,483,647. Ad esempio possiamo definire degli interi:

integer eta = 235632;
integer numerocase = 0;

Float 

I numeri in virgola mobile o float sono dei numeri caratterizzati dalla presenza del punto ".". Ad esempio:

float e = 2.718128;

String

Una stringa è una sequenza di caratteri alfanumerica. Ad esempio:

string nome = "sandro strascuzzi";
string carattere = "g";

Vector 

Un vettore è un valore costituito da tre componenti x, y e z. Esso è usato per la posizione, la velocità, l'acelerazione o il colore. Ad esempio:

vector pos = <23.3, 154.3, 2>;
vector vel;
vel.x = 12.1;
vel.y = 23.2;
vel.z = 36.6;

Rotation 

Una rotazione è costituita da 4 float: x, y, z, s. Ad esempio:

rotation rot = <32, 2, -9, 128>;

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

 

Per noi appassionati di second life, questo sito: http://www.lslwiki.net/lslwiki/wakka.php?wakka=HomePage rapprensenta un punto di riferimento per quanto riguarda tutorials, esempi pratici e community.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

 

Nell'articolo http://eowyn.bigpondhosting.com/SecondLife/SecondLife_WindMill_1.html viene illustrato passo dopo passo come funziona il meccanimo di rotazione per second life, dando concetti sulla rotazione di corpi, vettori, angoli e radianti.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

Per far ruotare un oggetto in second life con linden script, occorre selezionarlo ed editarlo. Nella parte relativa agli script scriviamo: 

default
{
    state_entry()
    {
       llTargetOmega(<0,0,1>,PI/4,1.0);
    }
}

Dove il parametro PI/4 indica di quanti radianti deve ruotare. Per farlo girare piu velocemente, occorre aumentare questo valore: PI , PI*2 etc, per farlo ruotare piu lentamene PI/6, PI/8 etc

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati