/////////////////////////////////////////////////////////////////////////// // 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. // /////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // --------------------- INTERNALS -------------------- // integer comHandle; integer jingle = 1; integer volume = 10; key sound = "ed124764-705d-d497-167a-182cd9fa2e6c"; init() { if(llGetInventoryNumber(INVENTORY_SOUND)) sound = llGetInventoryName(INVENTORY_SOUND, 0); comHandle = llListen(1, "", llGetOwner(), ""); llOwnerSay("Jingle is now listening on channel 1."); llOwnerSay("Type /1 jhelp in main chat for a list of commands."); } default { state_entry() { init(); } on_rez(integer num) { init(); } changed(integer change) { if(change & CHANGED_INVENTORY) llResetScript(); } listen(integer chan,string name,key id,string mes) { if(id != llGetOwner()) return; if(mes == "jhelp") { llOwnerSay("------- START JINGLE COMMANDS -------"); llOwnerSay("To turn the jingle on:"); llOwnerSay("/1 jingle on"); llOwnerSay("To turn the jingle off:"); llOwnerSay("/1 jingle off"); llOwnerSay("To change the jingle volume (from 1 to 10):"); llOwnerSay("/1 jvolume 7"); llOwnerSay("------- END JINGLE COMMANDS -------"); return; } if(mes == "jingle on") { jingle = 1; llOwnerSay("Jingle is now on."); return; } if(mes == "jingle off") { jingle = 0; llOwnerSay("Jingle is now off."); return; } if(llList2String(llParseString2List(mes, [" "], [""]), 0) == "jvolume") { integer tmpVolume = llList2Integer(llParseString2List(mes, [" "], [""]), 1); if(tmpVolume < 1) { volume = 1; jump say_volume; } if(tmpVolume > 10) { volume = 10; jump say_volume; } volume = tmpVolume; @say_volume; llOwnerSay("Volume is now: " + (string)volume); return; } } moving_start() { if(jingle) llPlaySound(sound, ((float)volume/10.0)); comHandle = llListen(0, "", llGetOwner(), ""); } moving_end() { llStopSound(); llListenRemove(comHandle); } }