[colug-432] LslLint ( was compiler compiler )

Vince Herried Vince at PlanetVince.com
Wed Sep 5 20:02:58 EDT 2012


Thanks for the replies.
Sure would be nice to be able to 'port' the existing haskell code to C or
C++ or Java.
>From what I've seen of haskell I  can't make heads or tails of it.

Shameless plug for Second Life(SL).  It has really affected my first life.
Prompting me to continue to program, to struggle with gimp, and to learn to
use
blender(used to make complex objects for import into SL), an open source 3d
modelling package.
Some time back a blender demo was planned for colug and I wanted to see it
as I was struggling.
Unfortunately the blender demo was cancelled.  Since them I've watched many
youtube videos and
can make simple objects.

I have been thinking it would be fun to give a demo of using blender to
create an object and import into
SL for colug.

Here is a simple example of a working lsl script I wrote recently.

---------start---------------
string  Version = "1.0";
string  Help    = "HairLock ReadMe";
string ArrivalSound = "5dfc8d49-344a-1810-5193-1ec067c14d3f";
key Owner;
integer State;
integer Main = 0;
integer Sounds = 1;
integer Particles = 2;

integer SoundOn = TRUE;
integer ParticlesOn = TRUE;
integer locked;
integer Channel;
integer ListenToken;
list    ParticleList;
list    SoundsList;

Menu(key Agent) {
    list Buttons;
    string Message;
    Message = llKey2Name(Owner) + "'s Hair.  " + Version;
    if ( State == Main ) {
        if (locked ) Buttons += "Unlock";
        else Buttons += "Lock";
        Buttons += "Particles";
        Buttons += "Help";

        Buttons += "Sound";
        Buttons += "Test";

    } else if ( State == Sounds ) {
        if ( SoundOn ) Buttons += "Off";
        else Buttons += "On";
        Buttons += "^";
    } else if ( State = Particles ) {
        if ( ParticlesOn ) Buttons += "Off";
        else Buttons += "On";

        Buttons += "^";
    }
    llDialog(Agent,Message,Buttons,Channel);
    ListenToken = llListen(Channel,"",Agent,"");
}

TelePort() {
    if ( SoundOn ) {
        llPreloadSound(ArrivalSound);
    }
    if ( ParticlesOn ) {
        //BlueShine();
        LightOfGod();
    }
    llSetTimerEvent(2.0);
}

BlueShine()
{
    llParticleSystem([
            PSYS_PART_FLAGS, PSYS_PART_EMISSIVE_MASK |
PSYS_PART_TARGET_POS_MASK | PSYS_PART_INTERP_COLOR_MASK |
PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK |
PSYS_PART_FOLLOW_SRC_MASK,
            PSYS_PART_MAX_AGE, 3.818628,
            PSYS_PART_FLAGS, 337,
            PSYS_PART_START_COLOR, <1.00000, 0.00000, 1.00000>,
            PSYS_PART_END_COLOR, <0.00000, 1.00000, 1.00000>,
            PSYS_PART_START_SCALE, <0.10000, 0.10000, 0.00000>,
            PSYS_PART_END_SCALE, <0.50000, 0.60000, 0.00000>,
            PSYS_SRC_PATTERN, 2,
            PSYS_SRC_BURST_RATE, 1.000000,
            PSYS_SRC_ACCEL, <0.00000, 0.00000, 0.00000>,
            PSYS_SRC_BURST_PART_COUNT, 27,
            PSYS_SRC_BURST_RADIUS, 8.000000,
            PSYS_SRC_BURST_SPEED_MIN, 1.000000,
            PSYS_SRC_BURST_SPEED_MAX, 1.000000,
            PSYS_SRC_TARGET_KEY, llGetKey(),
            PSYS_SRC_INNERANGLE, 3.000000,
            PSYS_SRC_OUTERANGLE, 3.000000,
            PSYS_SRC_OMEGA, <0.00000, 0.00000, 0.00000>,
            PSYS_SRC_MAX_AGE, 0.0,
            PSYS_SRC_TEXTURE, "",
            PSYS_PART_START_ALPHA, 1.000000,
            PSYS_PART_END_ALPHA, 1.000000

                ]);
}

LightOfGod()
{
    llParticleSystem([
            PSYS_PART_FLAGS,
PSYS_PART_EMISSIVE_MASK|PSYS_PART_INTERP_COLOR_MASK |
PSYS_PART_INTERP_SCALE_MASK | PSYS_PART_FOLLOW_VELOCITY_MASK,
            PSYS_PART_START_COLOR, <1.0, 1.0, 1.0>,
            PSYS_PART_END_COLOR, <1.0, 1.0, 1.0>,
            PSYS_SRC_ACCEL, <0.0, 0.0, 0.0>,
            PSYS_PART_START_SCALE, <.4, 30.1, 0.0>,
            PSYS_PART_END_SCALE, <0.1, 30.0, 0.0>,
            PSYS_PART_START_ALPHA,      1.0,
            PSYS_PART_END_ALPHA,        0.0,       //This sets the size
(scale) of the particles to 0.5m
            PSYS_PART_MAX_AGE, 5.0,                     //This gives us the
lifetime of the particles
            PSYS_SRC_BURST_RATE, 0.1,
            PSYS_SRC_BURST_RADIUS,      1.0,                    //There's a
new burst every 1.0 seconds
            PSYS_SRC_BURST_SPEED_MIN, 0.30,                //The minimum
speed of the particles (in m/s)
            PSYS_SRC_BURST_SPEED_MAX, 2.0,                //The maximum
speed - so they move slowly
            PSYS_SRC_BURST_PART_COUNT, 1000,                //How many
particles to make
            PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE    //The pattern we
use, this is all round the prim.
            ]);
}


default {
    state_entry() {
        locked=FALSE;
        Channel = (integer)(llFrand(-64760) - 1000.0);
        Owner = llGetOwner();
    }

    touch_start(integer num) {
        if ( Owner != llDetectedKey(0) ) return;
        Menu( llDetectedKey(0) );
    }

    on_rez(integer num)
    {
        Owner = llGetOwner();
        if (locked) llOwnerSay("@detach=n");
    }
    changed(integer change)
    {
        if ( CHANGED_TELEPORT & change )
        {
            TelePort();
        }
    }
    timer() {
        llSetTimerEvent(0.0);
        if ( SoundOn )  llPlaySound(ArrivalSound,10.0);
        // shut off Particles if any
        llParticleSystem([]);
    }
    listen(integer chan,string name,key id,string msg) {
        llListenRemove(ListenToken);
        if ( "^" == msg ) {
            State = Main;
            Menu(id);
            return;
        }
        if ( State == Main ) {
            if ( "Lock" == msg ) {
                llOwnerSay("@detach=n");
                locked = TRUE;
                llOwnerSay("Locked");
            } else if ("Unlock" == msg ) {
                llOwnerSay("@detach=y");
                locked = FALSE;
                llOwnerSay("Unlocked");
            } else if ("Sound" == msg ) {
                State = Sounds;
                Menu(id);
            } else  if ("Particles" == msg ) {
                State = Particles;
                Menu(id);
            } else if ( "Help" == msg ) {
                llGiveInventory(id,Help);
            } else if ( "Test" == msg ) {
                TelePort();
            }
            return;
        } else if ( State == Sounds ) {
            if ( "On" == msg ) {
                SoundOn=TRUE;
            } else if ("Off" == msg ) {
                SoundOn=FALSE;
            }
            State = Main;
            Menu(id);
            return;
        }else if ( State == Particles ){
            if ( "On" == msg ) {
                ParticlesOn=TRUE;
            } else if ( "Off" == msg ) {
                ParticlesOn=FALSE;
            }
            State = Main;
            Menu(id);
            return;
        } else {
            llOwnerSay("Unknown State");
        }
        llOwnerSay("Unknown Button \"" + msg + "\".");

    }
}
--------------------------------------end--------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.colug.net/pipermail/colug-432/attachments/20120905/5135c963/attachment-0001.html 


More information about the colug-432 mailing list