User:Kuraiko Yoshikawa/sandbox/LSL Goodies/KVNSB
Unfinished! | |
This page is unfinished o.o Don't use this Stuff!!! |
Intro
Inspired by Zai's LSL Goodies I will publish from time to time some (helpfull) Scripts.
I'm not a LSL Guru but all scripts are tested and i hope they work fine. o.o
Since these are contributions to the SL Wiki, all scripts are released under Creative Commons Attribution-Share Alike 3.0 License. KVNSB (Kuraiko's VendorBox is not a Simple Box :P)
Summary:
Das KVNSB kann alles Verkaufen! Egal ob du Scripte (du solltest sie auf not running setzen um komplikationen mit dem/den Vendor Script(s) vorzubeugen), Notecards, Landmarks Bodypars, Texturen, Gestures oder Sounds O_O es verkauft ALLES nur keine Freebies XD (wird vieleicht in einer folgenden Version ein Workaround eingebaut) der Preis muss also mindestens auf 1L$ stehen.
Was kann das KVNSB ausser alles Verkaufen?
Ich glaube das war das wichtigste! Solltest du das KVNSB Neustarten wollen (weil du z.B. die permission debit Anfrage abgelehnt hast oder etwas am Inventar geändert hast (nach Inventar änderungen MUSST du das KVNSB Neustarten ansonsten is der neue Inventar Inhalt dem Script nicht bekannt!) drücke einfach auf den Prim und halte mindestens 5 Sekunden den Left-Click. The Main Script (.VEND) integer gPrice = 10; // set the price of the product in L$ string gFolder = "Advanced Vendor Box"; // set the folder name that you want be created in the consumer inventory o.o integer gNotify = TRUE; // when you will notified on a purchase then set this to TRUE (the box send you a Mail) string gMail = "foobar@example.com"; // is notify TRUE then set your Mail Addy here string gNoteCard = ""; // have you a Info Notecard? Set the name of it. You haven't a Info notecard? Let it blank (example: string gNoteCard = "";) integer gGiveNC = FALSE; // Give the Notecard with other Inventory Content to the purchaser? When YES set it to TRUE // otherwise notecard is only for information on touch string gHover = "I'm a KVNSB test box\nTouch me hard :P\nBuy me!!!\nPlease *_*"; // set a hover text... let it blank for no hover! (i hate hover text o.O) (\n = new line) vector gHoverColor = <255,255,255>; // set the hovertext color in RGB values (example: <255,255,255> for white) //-------------------\\ // Advance Variables \\ //-------------------\\ integer gMailScripts = 5; // How many .MAIL <ID> scripts are in the PRIM inventory? //-------------------\\ // No Edit Variables \\ //-------------------\\ integer gPerms = FALSE; integer gTime; list gInventory; integer gListLength; integer gAktMail = 1; default { run_time_permissions(integer perm) { if (perm & 0x2) { gPerms = TRUE; state createInventory; } else { llSetText("Offline", <1,0,0>, 1.0); } } state_entry() { llSetText("Please Accept PERMISSION DEBIT", <0,1,0>, 1.0); if(!gNotify) gNotify = 0; if (llGetInventoryNumber(-1) > 1 + gMailScripts) llRequestPermissions(llGetOwner(), 0x2); else llSetText("Offline ~ Nothing @ Inventory o.O", <1,0,0>, 1.0); llResetTime(); } touch_start (integer t) { if (llDetectedKey(0) == llGetOwner()) { gTime = llGetUnixTime(); } } touch(integer t) { if (llDetectedKey(0) == llGetOwner()) { if (llGetUnixTime()-gTime > 5) { llResetScript(); } } } } state createInventory { state_entry() { llSetText("Read Inventory", <1,0.5,0>, 1.0); integer length = llGetInventoryNumber(-1); integer x; for (x = 0; x < length; x++) { if(llGetInventoryName(-1, x) == llGetScriptName()) { } else if (gNoteCard != "" && gGiveNC == TRUE && llGetInventoryName(-1, x) == gNoteCard) { gInventory += gNoteCard; } else { if (llGetInventoryName(-1, x) == gNoteCard || llGetSubString(llGetInventoryName(-1, x), 0, 5) == ".MAIL " ) { } else gInventory += llGetInventoryName(-1, x); } } state online; } } state online { state_entry() { llSetText(gHover, gHoverColor/255, 1.0); llSetPayPrice(gPrice, [gPrice, -1, -1]); } money(key giver, integer amount) { if (amount == gPrice) { llGiveInventoryList(giver, gFolder, gInventory); llWhisper(0, "Thanks " + llKey2Name(giver) + "!"); if (gAktMail == gMailScripts) gAktMail = 1; if(gNotify) { llMessageLinked(LINK_THIS, gAktMail, "[PURCHASER]: " + llKey2Name(giver) + "\n[PURCHASED ITEMS]: " + llList2CSV(gInventory), (key)gMail); ++gAktMail; }
} else if (amount > gPrice) { integer back = amount - gPrice; llGiveInventoryList(giver, gFolder, gInventory); llMessageLinked(LINK_THIS, 22, "You have payed too much. The excess amount will be refunded to you.", giver); llWhisper(0, "You have payed to much. The excess amount will be refunded to you."); llGiveMoney(giver, back); if (gAktMail == gMailScripts) gAktMail = 1; if(gNotify) { llMessageLinked(LINK_THIS, gAktMail, "[PURCHASER]: " + llKey2Name(giver) + "\n[PURCHASED ITEMS]: " + llList2CSV(gInventory), (key)gMail); ++gAktMail; } } else { llMessageLinked(LINK_THIS, 20, "Sorry, it's not enough.", giver); llWhisper(0, "Sorry, it's not enough."); llGiveMoney(giver, amount); } } touch_start(integer t) { if (llDetectedKey(0) == llGetOwner()) { gTime = llGetUnixTime(); } else { if(gNoteCard != "" && ~llGetInventoryType(gNoteCard) ) { llGiveInventory(llDetectedKey(0), gNoteCard); } else { llWhisper(0, "Sorry no information for this item found."); } } } touch(integer t) { if (llDetectedKey(0) == llGetOwner()) { if (llGetUnixTime()-gTime > 5) { llResetScript(); } } } } </lsl>
The Mail Script (.MAIL ID (example: .MAIL 01 (this format is very important!!! > "(dot)MAIL whitespace number" begin by one) default { state_entry() { gID = (integer)llGetSubString(llGetScriptName(), 5, -1); } link_message(integer send_num, integer num, string lmsg, key id) { if (num == gID) { llEmail(id, "[SOLD]: " + llGetObjectName(), lmsg); } } } </lsl> |
Sandbox SL Chatlog Wikifier | Kurai's LSL Goodies | Zai's LSL Goodies Lovely Stuff Zai's Page |