Table of Contents

ChangeLog

4 January 2011

  • Changed state_entry to attach for Spica Resident to void errors.

Introduction

This script was tested and works on OpenSim version 0.7.4!

I've been given a challenge to see how fast I can create a bubble gum effect with sounds and animation. I thought to share this one with everybody. To use it, just create a default prim and set it to a sphere shape. Set a texture if you want, a color and set the transparency to 45% or so to make it look like a gum bubble but don't change the size of the sphere prim. After that, attach the newly created sphere prim to your mouth attachment point and drop this script inside it. That's it. Have fun chewing and making bubbles. :-)

Code

bubble_gum.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
init() {
    llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
    llPreloadSound("ff0600f0-d8f4-20f6-52ec-a03bc520fee3");
    llSetPos(<0,0,0>);
    llSetScale(<0,0,0>);
}
 
default {
    on_rez(integer num) {
        if(llGetAttached()) init();
    }
    state_entry() {
        if(llGetAttached()) init();
    }
    attach(key id) {
        init();
    }
    run_time_permissions(integer perm) {
        if (perm & PERMISSION_TRIGGER_ANIMATION) llSetTimerEvent(5 + (integer)llFrand(14));
    }
    timer() {
        llSetTimerEvent(.0);
        llStartAnimation("express_kiss");
        float itra;
        for(itra=.004; itra<.06; itra+=.004) { 
            llSetScale(<itra,itra,itra>);
            llSetPos(llGetLocalPos()+<.0007,.0,.0>);
 
        }
        llPlaySound("ff0600f0-d8f4-20f6-52ec-a03bc520fee3", 1);
        llStopAnimation("express_kiss");
        llSetScale(<0,0,0>);
        llSetPos(<0,0,0>);
        llSetTimerEvent(5 + (integer)llFrand(14));
    }
}