Texture Particle Poofer
De DigiWiki.
Description
This is a generic dialog-based particle-texture poofer. It will allow you to select an avatar, a texture in the object's inventory and for how many seconds to poof the avatar with the texture. It uses the endless menus from Giver in order to support an endless amount of loaded textures and avatars.
Setup
- Create a primitive.
- Drop this script inside it.
- Open the primitive and add textures to it.
You are set. Just click the primitive and use the menus to select your options.
Code
////////////////////////////////////////////////////////// // [K] Kira Komarov - 2011, License: GPLv3 // // Please see: http://www.gnu.org/licenses/gpl.html // // for legal details, rights of fair usage and // // the disclaimer and warranty conditions. // ////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////// // INTERNALS // ////////////////////////////////////////////////////////// list menu_items = []; list key_items = []; integer mitra = 0; list cList = []; list tgtKeys = []; list tgtNames = []; string texName = ""; integer o = 0; integer comHandle = 0; integer comChannel = 0; list mFwd() { if(mitra+1>llGetListLength(menu_items)) return cList; cList = llListInsertList(llListInsertList(llList2List(menu_items, ++mitra, (mitra+=9)), ["<= Back"], 0), ["Next =>"], 2); return cList; } list mBwd() { if(mitra-19<0) return cList; cList = llListInsertList(llListInsertList(llList2List(menu_items, (mitra-=19), (mitra+=9)), ["<= Back"], 0), ["Next =>"], 2); return cList; } init() { llParticleSystem([]); comChannel = ((integer)("0x"+llGetSubString((string)llGetKey(),-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF; } default { state_entry() { init(); } on_rez(integer param) { init(); } timer() { llSetTimerEvent(0); llParticleSystem([12,texName,5,<0.2,0.2,0.2>,6,<0.45,0.45,0.45>,1,<1.0,1.0,1.0>,3,<1.0,1.0,1.0>,2,((float)1.0),4,((float)1.0),15,((integer)2),13,((float)0.8),7,((float)5.0),9,((integer)8),17,((float)0.5),18,((float)0.5),16,((float)0.5),22,(((float)0.4) * 3.14159274),23,(((float)0.0) * 3.14159274),8,<0.0,0.0,-0.1>,0,((integer)335),20,llList2Key(tgtKeys,0)]); if(!--o) { llSetTimerEvent(0); llParticleSystem([]); return; } llSetTimerEvent(1); } touch_start(integer num) { llOwnerSay("Please wait, scanning for avatars..."); llSensor("", "", AGENT, 96, TWO_PI); } sensor(integer num) { integer itra; for(itra=0, mitra=0, tgtKeys=[], tgtNames=[], menu_items=[]; itra<num; ++itra) { string name = llDetectedName(itra); if(llDetectedKey(itra) != NULL_KEY) { tgtKeys += llDetectedKey(itra); tgtNames += llGetSubString(name, 0, 23); menu_items += llGetSubString(name, 0, 23); } } if(!llGetListLength(menu_items)) { llOwnerSay("Sorry, I could not find anybody around to poof."); return; } cList = llListInsertList(llListInsertList(llList2List(menu_items, mitra, (mitra+=9)), ["<= Back"], 0), ["Next =>"], 2); comHandle = llListen(comChannel+1, "", llGetOwner(), ""); llDialog(llGetOwner(), "Please select an avatar to poof from the list below:\n", cList, comChannel+1); } listen(integer channel, string name, key id, string message) { if(message == "<= Back") { llDialog(id, "Please browse the available items:\n", mBwd(), channel); return; } if(message == "Next =>") { llDialog(id, "Please browse the available items:\n", mFwd(), channel); return; } if(channel == comChannel+1) { llListenRemove(comHandle); integer itra=llGetListLength(tgtNames)-1; do { if(llGetSubString(message,0,23) == llList2String(tgtNames, itra)) { tgtKeys = (list)llList2Key(tgtKeys, itra); jump found_target; } } while(--itra>=0); @found_target; for(itra=0, mitra=0, menu_items=[]; itra<llGetInventoryNumber(INVENTORY_TEXTURE); ++itra) { menu_items += llGetSubString(llGetInventoryName(INVENTORY_TEXTURE, itra), 0, 23); } if(!llGetListLength(menu_items)) { llOwnerSay("Sorry, I have no textures loaded in my inventory. Drop some textures in my inventory first."); return; } cList = llListInsertList(llListInsertList(llList2List(menu_items, mitra, (mitra+=9)), ["<= Back"], 0), ["Next =>"], 2); comHandle = llListen(comChannel+2, "", llGetOwner(), ""); llDialog(llGetOwner(), "Please select a texture to poof an avatar with:\n", cList, comChannel+2); return; } if(channel == comChannel+2) { integer itra=llGetInventoryNumber(INVENTORY_TEXTURE)-1; do { if(llGetSubString(llGetInventoryName(INVENTORY_TEXTURE, itra), 0, 23) == message) { texName = llGetInventoryName(INVENTORY_TEXTURE, itra); jump found_texture; } } while(--itra>=0); @found_texture; llListenRemove(comHandle); for(itra=2, mitra=0, menu_items=[]; itra<512; itra=itra<<1) { menu_items += (string)itra; } cList = llListInsertList(llListInsertList(llList2List(menu_items, mitra, (mitra+=9)), ["<= Back"], 0), ["Next =>"], 2); comHandle = llListen(comChannel+3, "", llGetOwner(), ""); llDialog(llGetOwner(), "Please select the number of seconds the avatar will be poofed:\n", cList, comChannel+3); return; } if(channel == comChannel+3) { llListenRemove(comHandle); o = (integer)message; llSetTimerEvent(2); } } }