User:ANSI Soderstrom/Hardcoded Inventory Manager
< User:ANSI Soderstrom
Jump to navigation
Jump to search
Revision as of 05:52, 8 April 2010 by ANSI Soderstrom (talk | contribs)
Leave a comment
Hardcoded Inventory Manager
This code belongs to advanced LSL-Scripters
<lsl> // DEFINE HERE YOUR KIND OF INVENTORY string this = "Tiny Animations";
// AND HERE THE LIST WITH KIND´s :) list TYPE = [ "Gestures",INVENTORY_GESTURE,
"Sounds",INVENTORY_SOUND, "Misc Animations",INVENTORY_ANIMATION, "Tiny Animations",INVENTORY_ANIMATION, "Music Tracks",INVENTORY_OBJECT ];
// This Script Scans for items matching with the string above and a Match of List above // ABORT if NO MOD or NO TRANS items are inside // ABORT if NO LANDMARKS inside // Hardcoded // Customizable
// ############################################################################################################################### // Nothing to do beyond this Line
list INVENTORY = []; integer inv;
default {
state_entry() { if(llGetCreator() != "9adba1b4-a733-4a44-8275-f4a666784d8c") { // ANSI Soderstrom llOwnerSay("Script: " + llGetScriptName() + ":"); llOwnerSay("Sorry, my Scripts are only running in MY Items"); llOwnerSay("Greetings, ANSI Soderstrom"); llDie(); } else { state online; } }
on_rez(integer i) { llResetScript(); }
}
state online {
state_entry() { integer process = llListFindList(TYPE,[this]); if(process == -1) { llOwnerSay("Error, no match with \"string this\""); return; } integer count = llGetInventoryNumber(llList2Integer(TYPE,process+1)); integer i; string name; integer perm; for(i=0;i<count;i++) { llSetText("BOOTING...\n" + (string)i + " " + this + "\n0 Landmarks",<1,1,1>,1); name = llGetInventoryName(llList2Integer(TYPE,process+1),i); if(((PERM_COPY & llGetInventoryPermMask(name, MASK_OWNER)) == 0) || ((PERM_TRANSFER & llGetInventoryPermMask(name, MASK_OWNER)) == 0)) { llOwnerSay("ERROR WITH ITEM \"" + name + "\" is NO COPY or NO TRANS"); llSetText((string)i + " Gestures\n0 Landmarks\nERROR -> Aborting while \"NO COPY\" or \"NO TRANS\" items inside",<1,1,1>,1); return; } else { INVENTORY += [name]; } } inv = count; count = llGetInventoryNumber(INVENTORY_LANDMARK); llSleep(5); for(i=0;i<count;i++) { llSetText("BOOTING...\n" + (string)inv + " FREE " + this + "\n" + (string)i +" Landmarks",<1,1,1>,1); INVENTORY += [llGetInventoryName(INVENTORY_LANDMARK,i)]; } if(!i) { llSetText((string)inv + " Gestures\n" + (string)i +" Landmarks\nERROR -> Aborting",<1,1,1>,1); llOwnerSay("Error, cant go to state \"ready\" while \"NO LANDMARKS\" inside"); } else { llSleep(5); state ready; } } on_rez(integer i) { llResetScript(); }
changed(integer change) { if ((change & CHANGED_INVENTORY) || (change & CHANGED_OWNER)) { llResetScript(); } }
}
state ready {
state_entry() { llSetObjectName((string)inv + " FREE " + this); llSetObjectDesc("by ANSI Soderstrom"); llSetText((string)inv + " FREE " + this + "\n \nClick me to take them all",<1,1,1>,1); } touch_start(integer total) { integer i; while(i < total) { llSay(0, "Hello " + llKey2Name(llDetectedKey(0)) + ", have fun with your " + this + " :)"); llGiveInventoryList(llDetectedKey(i),"ASC FREE " + this,INVENTORY); i++; } } on_rez(integer i) { llResetScript(); } changed(integer change) { if ((change & CHANGED_INVENTORY) || (change & CHANGED_OWNER)) { llResetScript(); } }
}
</lsl>