UW Scripts for 5/27

Sounds and simple money handling

You’ll need my folder of sample sounds

// Script 6.1 - Basic sounds

pause() {
	float seconds = 10.0 + llFrand(10.0);
	llSetTimerEvent(seconds);
}

default {
    state_entry() {
        pause();
    }
    timer() {
    	llPlaySound("chickenclucks", 0.5);
    	// llTriggerSound("thunder2", 1.0); 
    	pause();
    }
}
// Script 6.2 repeating sound

default
{
    state_entry()
    {
        llLoopSound("heartbeat", .5);
    }
}

(deleted script 6.3 – talk to me if you’d like to play with it!)

// Script 6.4 Single-object vendor

integer gPrice = 100;  // price in L$

string gProduct; // product name

default
{
	on_rez(integer p) {
		llResetScript();
	}
	
    state_entry() {
        llSetPayPrice(PAY_HIDE, [gPrice, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
        gProduct = llGetInventoryName(INVENTORY_OBJECT,0);
        string title = gProduct+"(L$"+(string)gPrice+")";
        llSetText(title, <1,1,1>, 1.0);
    }
    money(key customer, integer amount) {
        llInstantMessage(customer, "Thank you, "+llKey2Name(customer)+
                         "! Enjoy your purchase of "+gProduct);
        llGiveInventory(customer, gProduct);
    }
}