Difference between revisions of "User:Kuraiko Yoshikawa/sandbox/LSL Goodies/KVNSB"

From Second Life Wiki
Jump to navigation Jump to search
m
m (Forgot to add the category :P)
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{#vardefine:header|{{#var:header}}
{{User:Kuraiko_Yoshikawa/sandbox/Menu_Bar}}
{{multi-lang}}
<!--{{#vardefine:header|{{#var:header}}
{{{!}} style="background-color:#AAAAAA; margin-bottom:10px;" cellpadding="3" cellspacing="1"
{{{!}} style="background-color:#AAAAAA; margin-bottom:10px;" cellpadding="3" cellspacing="1"
{{!}} style="background:#F9F9F9;" valign="top" rowspan="2" {{!}} [[Image:Emblem-important-red.png]]
{{!}} style="background:#F9F9F9;" valign="top" rowspan="2" {{!}} [[Image:Emblem-important-red.png]]
Line 6: Line 8:
{{!}} style="background:#F9F9F9;" {{!}}
{{!}} style="background:#F9F9F9;" {{!}}
This page is unfinished o.o Don't use this Stuff!!!
This page is unfinished o.o Don't use this Stuff!!!
{{!}}} }}{{#if:{{{inline|}}}<noinclude>t</noinclude>|{{#var:header}}}}
{{!}}} }}{{#if:{{{inline|}}}<noinclude>t</noinclude>|{{#var:header}}}}-->
<table>
 
<tr>
<div id="box" style="background-color: #e8dcfb;">
<td>
<div id="box" style="background-color: #e8dcfb; min-width: 700px;">
<div style="background-color: #cfc0e0; font-size: 1.2em; font-weight: bold; border-bottom: black 1px dashed;">Intro</div>
<div style="background-color: #cfc0e0; font-size: 1.2em; font-weight: bold; border-bottom: black 1px dashed;">Intro</div>
<div style="padding: 10px 10px 10px 10px;">
<div style="padding: 10px 10px 10px 10px;">
Inspired by [[User:Zai Lynch/Sandbox/LSL Goodies|Zai's LSL Goodies]] I will publish from time to time some (helpfull) Scripts.
Inspired by [[User:Zai Lynch/Sandbox/LSL Goodies|Zai's LSL Goodies]] I will publish from time to time some (helpfull) scripts.
<p>
<p>
I'm not a LSL Guru but all scripts are tested and i hope they work fine. o.o
I'm not a LSL Guru but all scripts are tested and I hope they're working fine. o.o
<br>
<br>
Have you anyway problems with one of my scripts send me a InWorld IM or post it in the talk page!
In case you got problems with one of my scripts nevertheless, send me an InWorld IM or post it at the [[{{TALKPAGENAME}}|talk page]]!
</p>
</p>
<p>Since these are contributions to the SL Wiki, all scripts are released under [http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-Share Alike 3.0 License].
<p>Since these are contributions to the SL Wiki, all scripts are released under [http://creativecommons.org/licenses/by-sa/3.0/ Creative Commons Attribution-Share Alike 3.0 License].
Line 24: Line 24:
</div>
</div>


<div id="box" style="background-color: #e8dcfb; min-width: 700px;">
<div id="box" style="background-color: #e8dcfb;">
<div style="background-color: #cfc0e0; font-size: 1.2em; font-weight: bold; border-bottom: black 1px dashed;">KVNSB (Kuraiko's VendorBox is not a Simple Box :P)</div>
<div style="background-color: #cfc0e0; font-size: 1.2em; font-weight: bold; border-bottom: black 1px dashed;">KVNSB (Kuraiko's VendorBox is not a Simple Box :P)</div>
<div style="padding: 10px 10px 10px 10px;">
<div style="padding: 10px 10px 10px 10px;">
<div id="box" style="background-color: #f9f9f9; min-width: 700px;">
<div id="box" style="background-color: #f9f9f9;">
<div style="background-color: #cfc0e0; font-size: 1.2em; font-weight: bold; border-bottom: black 1px dashed;">Summary:</div>
<div style="background-color: #cfc0e0; font-size: 1.2em; font-weight: bold; border-bottom: black 1px dashed;">Summary:</div>
<div style="padding: 10px 10px 10px 10px;">
<div style="padding: 10px 10px 10px 10px;">
Das KVNSB kann <b>alles</b> 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 <b>ALLES</b> nur keine Freebies XD (wird vieleicht in einer folgenden Version ein Workaround eingebaut) der Preis muss also mindestens auf 1L$ stehen.
The KVNSB can sell '''anything'''! No matter if you're selling scripts (set them not running to avoid complications with the vendors scripts), notecards, landmarks, bodyparts, textures, gestures or sounds O_O. It sells '''anything''' except freebies XD (might be released in a future workaround). The price got to be set to at least 1L$.
<p>
<p>
Was kann das KVNSB ausser alles Verkaufen?<br>
What is the KVNSB able to do beside selling anything?<br>
*Alles Verkaufen ;P
*Selling anything ;P
*Items müssen nicht Geboxed werden sie werden als Inventar Folder übertragen desen Name frei im Script wählbar ist
*There's no need to box items. They'll become delivered in an inventory folder which name you're able to choose in the script.
*Benachrichtigung per Email über einen verkauf (wenn gewünscht -> deaktivierbar)
*Sales notification via eMail (disactable if favoured).
*@Touch eine definierbare Notecard senden
*Sends a defined notecard if touched.
*diese Notecard vom Verkauf auschließen (also sie wird nicht mit den Anderen Items übertragen)
*Setting to not include the notecard in the sale itself (won't become delivered with the other items).
*die Vendor Scripte werden auch nicht mit dem Kauf übertragen!
*Vendorscripts won't become delivered in a sale.
*ein belibiger Hovertext mit beliebiger Farbe (RGB Wert) kann gesetzt werden
*A choosable hovertext with a chooseable color (RGB value).
 
</p>
</p>
Ich glaube das war das wichtigste!<br>
This might be the most important features (IMHO)!<br>
Ahja beim Starten fragt dich das KVNSB nach der Erlaubnis Lindendoller von deinem Konto abzubuchen dies musst du akzeptieren ansonsten schaltet es in den Offline Modus! Es wird dir nicht einfach Geld von deinem Konto abgezogen dies ist nur nötig da manchmal bei hohen Lags das Eingabefeld bei dem PayDialog auftauchen kann und jemand dir zu wenig oder zu viel Bezahlen könnte. Sollte dies passieren reagiert das Script darauf und gibt bei zu viel den Restbetrag zurück und bei zu wenig den ganzen Betrag der ja zu wenig war...
Oh, while starting, the KVNSB will ask you for a debit permission to transfer L$ from your account. You got to accept this or the vendor will switch to it's offline mode. It won't just transfer money from your account. It's only needed since, during high lags, the PayDialog might give the ability to enter any value and someone can pay you to few or to much money. In this case, the script will react and return the spare amount to the costumer in case (s)he payed to much or return it all in case (s)he payed to few...
<p>
<p>
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.
If you'd like to restart the KVNSB (e.g. because you denied the permission debit request or changed the inventory (after an inventory change you GOT to restart the KVNSB or the script won't know about the new items!)) just press the prim and hold it pressed for at least 5 seconds.
</p>
</p>
</div>
</div>
</div>
</div>
<b>The Main Script (.VEND)</b><br>
<b>The Main Script (.VEND)</b><br>
<lsl>
<syntaxhighlight lang="lsl2">
//-------------------------------------------------//
//-------------------------------------------------//
//                  KVNSB 0.1                    \\
//                  KVNSB 0.1                    \\
Line 60: Line 61:


integer gPrice = 10;                    // set the price of the product in L$
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
string gFolder = "Advanced Vendor Box"; // set the name of folder you'd like to see
integer gNotify = TRUE;                // when you will notified on a purchase then set this to TRUE (the box send you a Mail)
                                        // created in the customers inventory o.o
string gMail = "foobar@example.com";    // is notify TRUE then set your Mail Addy here
 
integer gNotify = TRUE;                // if you'd like to get a notification when an item is purchased
                                        // then set this value to TRUE (the box will send you a mail)


string gNoteCard = "";                  // have you a Info Notecard? Set the name of it. You haven't a Info notecard? Let it blank (example: string gNoteCard = "";)
string gMail = "foobar@example.com";    // is notify TRUE then set your mail addy here
integer gGiveNC = FALSE;                // Give the Notecard with other Inventory Content to the purchaser? When YES set it to TRUE  
 
string gNoteCard = "";                  // have you got an info notecard? Set the name of it.  
                                        // You have no info notecard? Leave it blank  
                                        //(example: string gNoteCard = "";)
 
integer gGiveNC = FALSE;                // Give the notecard with other inventory
                                        // content to the customer? When YES set it to TRUE  
                                         // otherwise notecard is only for information on touch
                                         // 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)
 
// set a hover text... leave it blank for no hover! (i hate hover text o.O) (\n = new line)
string gHover = "I'm a KVNSB test box\nTouch me hard :P\nBuy me!!!\nPlease *_*";
vector gHoverColor = <255,255,255>;    // set the hovertext color in RGB values (example: <255,255,255> for white)
vector gHoverColor = <255,255,255>;    // set the hovertext color in RGB values (example: <255,255,255> for white)


Line 185: Line 196:
             if(gNotify)
             if(gNotify)
             {
             {
                 llMessageLinked(LINK_THIS, gAktMail, "[PURCHASER]: " + llKey2Name(giver) + "\n[PURCHASED ITEMS]: " + llList2CSV(gInventory), (key)gMail);   
                 llMessageLinked(LINK_THIS, gAktMail, "[PURCHASER]: "  
                + llKey2Name(giver) + "\n[PURCHASED ITEMS]: " + llList2CSV(gInventory), (key)gMail);   
                 ++gAktMail;
                 ++gAktMail;
             }
             }
Line 204: Line 216:
             if(gNotify)
             if(gNotify)
             {
             {
                 llMessageLinked(LINK_THIS, gAktMail, "[PURCHASER]: " + llKey2Name(giver) + "\n[PURCHASED ITEMS]: " + llList2CSV(gInventory), (key)gMail);  
                 llMessageLinked(LINK_THIS, gAktMail, "[PURCHASER]: "  
                + llKey2Name(giver) + "\n[PURCHASED ITEMS]: " + llList2CSV(gInventory), (key)gMail);  
                 ++gAktMail;
                 ++gAktMail;
             }
             }
Line 246: Line 259:
}
}


</lsl>
</syntaxhighlight>
<b>The Mail Script</b> (.MAIL ID (example: .MAIL 01 (this format is very important!!! > "(dot)MAIL whitespace number" begin by one)<br>
<b>The Mail Script</b> (.MAIL ID (example: .MAIL 01 (this format is very important!!! > "(dot)MAIL whitespace number" begin by one)<br>
Is gNotify TRUE you must copy as many as 1 (one) of the follow script (standart is 5 (five)) have you lesser five change the integer gMailScripts @ Advance Variables
Is gNotify TRUE you must copy as many as 1 (one) of the follow script (standart is 5 (five)). In case you got less than five, change the integer gMailScripts @ Advance Variables.
<lsl>
<syntaxhighlight lang="lsl2">
integer gID;
integer gID;


Line 269: Line 282:
}
}


</lsl>
</syntaxhighlight>
</div>
</div>
</div>
</div>
</td>
 
<td style="vertical-align: top;">
[[Category:LSL Examples]]
{{User:Kuraiko_Yoshikawa/sandbox/Menu Bar}}
</td>
</tr>
</table>

Latest revision as of 12:42, 30 November 2023

Inv item object.png Sandbox Inv item script.png SL Chatlog Wikifier | Inv folder object.png Kurai's LSL Goodies | Inv item script.png Zai's LSL Goodies Lovely Stuff Heart icon.png Zai's Page

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're working fine. o.o
In case you got problems with one of my scripts nevertheless, send me an InWorld IM or post it at the talk page!

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:

The KVNSB can sell anything! No matter if you're selling scripts (set them not running to avoid complications with the vendors scripts), notecards, landmarks, bodyparts, textures, gestures or sounds O_O. It sells anything except freebies XD (might be released in a future workaround). The price got to be set to at least 1L$.

What is the KVNSB able to do beside selling anything?

  • Selling anything ;P
  • There's no need to box items. They'll become delivered in an inventory folder which name you're able to choose in the script.
  • Sales notification via eMail (disactable if favoured).
  • Sends a defined notecard if touched.
  • Setting to not include the notecard in the sale itself (won't become delivered with the other items).
  • Vendorscripts won't become delivered in a sale.
  • A choosable hovertext with a chooseable color (RGB value).

This might be the most important features (IMHO)!
Oh, while starting, the KVNSB will ask you for a debit permission to transfer L$ from your account. You got to accept this or the vendor will switch to it's offline mode. It won't just transfer money from your account. It's only needed since, during high lags, the PayDialog might give the ability to enter any value and someone can pay you to few or to much money. In this case, the script will react and return the spare amount to the costumer in case (s)he payed to much or return it all in case (s)he payed to few...

If you'd like to restart the KVNSB (e.g. because you denied the permission debit request or changed the inventory (after an inventory change you GOT to restart the KVNSB or the script won't know about the new items!)) just press the prim and hold it pressed for at least 5 seconds.

The Main Script (.VEND)

//-------------------------------------------------//
//                   KVNSB 0.1                     \\
// (KVNSB Kuraiko's VendorBox is not a Simple Box) //
//               released under                    \\
// Creative Commons Attribution-Share Alike 3.0    //
//            by Kuraiko Yoshikawa                 \\
//      Contact: kuraiko.yoshikawa@gmail.com       //
//-------------------------------------------------\\

integer gPrice = 10;                    // set the price of the product in L$
string gFolder = "Advanced Vendor Box"; // set the name of folder you'd like to see 
                                        // created in the customers inventory o.o

integer gNotify = TRUE;                 // if you'd like to get a notification when an item is purchased 
                                        // then set this value to TRUE (the box will send you a mail)

string gMail = "foobar@example.com";    // is notify TRUE then set your mail addy here

string gNoteCard = "";                  // have you got an info notecard? Set the name of it. 
                                        // You have no info notecard? Leave it blank 
                                        //(example: string gNoteCard = "";)

integer gGiveNC = FALSE;                // Give the notecard with other inventory 
                                        // content to the customer? When YES set it to TRUE 
                                        // otherwise notecard is only for information on touch

// set a hover text... leave it blank for no hover! (i hate hover text o.O) (\n = new line)
string gHover = "I'm a KVNSB test box\nTouch me hard :P\nBuy me!!!\nPlease *_*"; 
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();
            }
        }
    }
}

The Mail Script (.MAIL ID (example: .MAIL 01 (this format is very important!!! > "(dot)MAIL whitespace number" begin by one)
Is gNotify TRUE you must copy as many as 1 (one) of the follow script (standart is 5 (five)). In case you got less than five, change the integer gMailScripts @ Advance Variables.

integer gID;

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);
        }
    }
}