Difference between revisions of "User:Kristy Fanshaw/Shorter Vendor System Script"

From Second Life Wiki
Jump to navigation Jump to search
(New page: {{LSL Header}}__TOC__ *Click Here To see my page and more of my scripts if i make any :)) {{box|Pay Script for Reseller vendor| Place this script in a Vendor R...)
 
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{LSL Header}}__TOC__
{{LSL Header}}__TOC__
*[[User:Kristy_Fanshaw|Click Here]]  To see my main page for more scripts, if i'll make any :))
*[[User:Kristy_Fanshaw/Vendor_System_Script|Vendor System Script]] :: Same script with HTTP check
{{box|Copying Permission|
Copyright © 2008 by Kristy Fanshaw


This program is free software: you can redistribute it and/or modify<br>
it under the terms of the GNU General Public License as published by<br>
the Free Software Foundation, either version 3 of the License, or<br>
(at your option) any later version.<br>


*[[User:Kristy_Fanshaw|Click Here]]  To see my page and more of my scripts if i make any :))
This program is distributed in the hope that it will be useful,<br>
but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
GNU General Public License for more details.<br>


 
To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.}}
{{box|Pay Script for Reseller vendor|
{{box|Pay Script for "Reseller Vendor Object"|
Place this script in a Vendor Root prim you've created.}}
Place this script in a Vendor Root prim you've created.<br><br>
What it does:
What it does:
# it asks the owner of the vendor to rezz the update box.
# it asks the owner of the vendor to rezz the update box.
Line 12: Line 23:
# when the email is set, it asks the owner of the vendor to grant debits. If the owner won't do so, the script resets.  
# when the email is set, it asks the owner of the vendor to grant debits. If the owner won't do so, the script resets.  
# when debits are granted the vendor will be active
# when debits are granted the vendor will be active
# if the owner of the vendor touches vendor in active mode, the vendor will tell how many items have been sold since activation.
# if the owner of the vendor touches vendor in active mode, the vendor will tell how many items have been sold since activation.<br>
 
Purchase:
Purchase:
# buyer can pay only the amount of money that is set in "integer gCorrectAmount = price;"
# buyer can pay only the amount of money that is set in "integer gCorrectAmount"
# when buyer pays money, the vendor will send email to server prim with buyers ID in subject line and its own email address in message content.
# when buyer pays money, the vendor will send email to server prim with buyers ID in subject line and its own email address in message content.
# server will give the item to buyer and sends "delivered" notification back to vendor. If the server is not working or there will be some other issues with delivery, then money will be refunded to buyer and vendor shuts down till next update.
# server will give the item to buyer and sends "delivered" notification back to vendor. If the server is not working or there will be some other issues with delivery, then money will be refunded to buyer and vendor shuts down till next update.
# when vendor receives email from server with "delivered" note, then creator of the vendor receives the money.
# when vendor receives email from server with "delivered" note, then creator of the vendor receives the money.


<lsl>////////////////////////////////////////////////////////////////////////////////////////////////
//    Copyright (c) 2008 by Kristy Fanshaw                                                    //
//    This script is part of Vendor System.                                                  //
////////////////////////////////////////////////////////////////////////////////////////////////
//    Vendor System is free software: you can redistribute it and/or modify                  //
//    it under the terms of the GNU General Public License as published by                    //
//    the Free Software Foundation, either version 3 of the License, or                      //
//    (at your option) any later version.                                                    //
//                                                                                            //
//    Vendor System is distributed in the hope that it will be useful,                        //
//    but WITHOUT ANY WARRANTY; without even the implied warranty of                          //
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                          //
//    GNU General Public License for more details.                                            //
//                                                                                            //
//    To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.    //
////////////////////////////////////////////////////////////////////////////////////////////////


<lsl>integer gCorrectAmount = 10;                            // enter your price for fast pay
integer gCorrectAmount = 10;                            // enter the price for fast pay
integer my_profit = 50;                                // how many percent you would like to recieve form the sale
integer my_profit = 50;                                // how many percent you would like to recieve form the sale
string update_box = "update box name";                  // describe the name of the "update box" object that should be rezzed
string update_box = "update box name";                  // describe the name of the "update box" object that should be rezzed
Line 40: Line 66:
         changed(integer change)
         changed(integer change)
             {
             {
                 if(change && CHANGED_OWNER)
                 if(change & CHANGED_OWNER)
                     {
                     {
                         llSetObjectDesc("0");
                         llSetObjectDesc("0");
Line 68: Line 94:
             {
             {
                 llResetScript();
                 llResetScript();
            }
    }
state sens1
    {
        state_entry()
            {
                state sens;
             }
             }
     }
     }
Line 86: Line 119:
             {
             {
                 mail = message;
                 mail = message;
                llListenRemove(listen_handle);
                 llOwnerSay("updated");
                 llOwnerSay("updated");
                 llShout(Ch,"updated");
                 llShout(Ch,"updated");
Line 94: Line 126:
             {
             {
                 llListenRemove(listen_handle);
                 llListenRemove(listen_handle);
                 state sens;
                 state sens1;
             }
             }
         no_sensor ()
         no_sensor ()
Line 120: Line 152:
             }   
             }   
     }  
     }  
state Ready1
    {
        state_entry()
            {
                state Ready;
            }
    }
state Ready
state Ready
     {
     {
Line 139: Line 178:
             {
             {
                 mail = message;
                 mail = message;
                llListenRemove(listen_handle);
                 llOwnerSay("updated");
                 llOwnerSay("updated");
                 llShout(Ch,"updated");
                 llShout(Ch,"updated");
Line 175: Line 213:
                                 llInstantMessage(llDetectedKey(0),"You didn't pay enough, " + llKey2Name(id) + ". Refunding your payment of L$" + (string)amount + ".");
                                 llInstantMessage(llDetectedKey(0),"You didn't pay enough, " + llKey2Name(id) + ". Refunding your payment of L$" + (string)amount + ".");
                                 llGiveMoney(id, amount);
                                 llGiveMoney(id, amount);
                                 state Ready;
                                 state Ready1;
                             }
                             }
                         else
                         else
Line 209: Line 247:
                         llSetText("", <1.0, 1.0, 1.0>, 1.0);
                         llSetText("", <1.0, 1.0, 1.0>, 1.0);
                         llSetTimerEvent(0);
                         llSetTimerEvent(0);
                         state Ready;
                         state Ready1;
                     }   
                     }   
             }
             }
Line 222: Line 260:
                 state default;         
                 state default;         
             }                           
             }                           
}</lsl>
}</lsl>}}
 
{{box|Updater Script for "Reseller Vendor Update Object"|
{{box|Updater Script for Reseller vendor|
Place this script in a box you've created.<br><br>
Place this script in a box you've created.}}
What it does:
What it does:
# when rezzed next to the vendor, it will try to update the vendors mail string.
# when rezzed next to the vendor, it will try to update the vendors mail string.
# when vendor gets the email address, the updater dies. It doesn't die until the vendor is updated.
# when vendor gets the email address, the updater dies. It doesn't die until the vendor is updated.


<lsl>string mail = "00000000-0000-0000-0000-000000000000@lsl.secondlife.com";                  // Write here the server email address which is "serverobject-prim-key@lsl.secondlife.com"
<lsl>////////////////////////////////////////////////////////////////////////////////////////////////
//    Copyright (c) 2008 by Kristy Fanshaw                                                    //
//    This script is part of Vendor System.                                                  //
////////////////////////////////////////////////////////////////////////////////////////////////
//    Vendor System is free software: you can redistribute it and/or modify                  //
//    it under the terms of the GNU General Public License as published by                    //
//    the Free Software Foundation, either version 3 of the License, or                      //
//    (at your option) any later version.                                                    //
//                                                                                            //
//    Vendor System is distributed in the hope that it will be useful,                        //
//    but WITHOUT ANY WARRANTY; without even the implied warranty of                          //
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                          //
//    GNU General Public License for more details.                                            //
//                                                                                            //
//    To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.    //
////////////////////////////////////////////////////////////////////////////////////////////////
 
string mail = "00000000-0000-0000-0000-000000000000@lsl.secondlife.com";                  // Write here the server email address which is "serverobject-prim-key@lsl.secondlife.com"
string update_box = "update box name";                                                    // Write here the name you like, but be sure the name here matches with a name in vendor script
string update_box = "update box name";                                                    // Write here the name you like, but be sure the name here matches with a name in vendor script
integer Ch;
integer Ch;
Line 253: Line 307:
                     {
                     {
                         llDie();
                         llDie();
                    }
            }
}</lsl>}}
{{box|Server Script and Mailer Script for "Server Object"|
Place these scripts into a box you've created as a server prim.<br>
Place the object you'd like to sell into this prim - only one object<br><br>
Server Script:
# when rezzed, it will tell you it's email address.
# when this scrpt gets an email from the vendor, it gives the inventory item to buyer and asks mailer script to send a note back to vendor that the delivery is done.
# when touched by the owner, it says totalsold.
<lsl>////////////////////////////////////////////////////////////////////////////////////////////////
//    Copyright (c) 2008 by Kristy Fanshaw                                                    //
//    This script is part of Vendor System.                                                  //
////////////////////////////////////////////////////////////////////////////////////////////////
//    Vendor System is free software: you can redistribute it and/or modify                  //
//    it under the terms of the GNU General Public License as published by                    //
//    the Free Software Foundation, either version 3 of the License, or                      //
//    (at your option) any later version.                                                    //
//                                                                                            //
//    Vendor System is distributed in the hope that it will be useful,                        //
//    but WITHOUT ANY WARRANTY; without even the implied warranty of                          //
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                          //
//    GNU General Public License for more details.                                            //
//                                                                                            //
//    To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.    //
////////////////////////////////////////////////////////////////////////////////////////////////
string my_address = "my.email@email.com";      // Write here the email, where you want to recieve the message with new server email address.
integer total_mailers = 5;                      // How many mailer scripts you have in server prim. 5 mailer scripts are Recomended min. because of llEmail function.
integer mailer = 1;                           
default
    {
        changed(integer change)
            {
                if(change && CHANGED_OWNER)
                    {
                        llSetObjectDesc("0");
                        llResetScript();
                    }     
            }
        on_rez(integer start_parameter)
            {
                llOwnerSay("new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
                llEmail(my_address,llGetObjectName() , "my new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
                llOwnerSay("message with new address is sent to your email");
            }
        state_entry()
            {             
                llSetObjectName(llGetInventoryName(INVENTORY_OBJECT,0));
                llSetText(llGetObjectName(),<1,1,1>,1);
                totalsold = (integer)llGetObjectDesc();
                llOwnerSay("new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
                llEmail(my_address,llGetObjectName() , "my new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
                llOwnerSay("message with new address is sent to your email");
                llSetTimerEvent(5.0);             
            }
        timer()
            {
                llGetNextEmail("", "");
            }
        email( string time, string address, string subj, string message, integer num_left )
            {
                llGiveInventory(subj,llGetInventoryName(INVENTORY_OBJECT,0) );
                message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") +1);
                llMessageLinked(LINK_THIS, mailer, message, "");
                if (mailer <= total_mailers)
                    {
                        mailer = mailer + 1;
                    }
                if (mailer >= total_mailers + 1)
                    {
                        mailer = 1; 
                    }
                totalsold = totalsold + 1;
                llSetObjectDesc((string)totalsold);
                llGetNextEmail("", "");
            }
        touch_start(integer total_number)
            {
                if (llDetectedOwner(0) == llGetOwner())
                    {
                        llOwnerSay((string)totalsold +" units have been sold since server update. ");
                    }
                else
                    {
                        llInstantMessage(llDetectedKey(0), "please don't touch");
                     }
                     }
             }
             }
}</lsl>
}</lsl>
Mailer script.<br>
# Make as many numbers of mailer sciprts you need and place them into server object.<br>
# Name them with numbers starting from number "1".<br>
# Don't skip any numbers: if you have 5 mailer scripts in your server object then their names should be 1, 2, 3, 4 and 5.
<lsl>////////////////////////////////////////////////////////////////////////////////////////////////
//    Copyright (c) 2008 by Kristy Fanshaw                                                    //
//    This script is part of Vendor System.                                                  //
////////////////////////////////////////////////////////////////////////////////////////////////
//    Vendor System is free software: you can redistribute it and/or modify                  //
//    it under the terms of the GNU General Public License as published by                    //
//    the Free Software Foundation, either version 3 of the License, or                      //
//    (at your option) any later version.                                                    //
//                                                                                            //
//    Vendor System is distributed in the hope that it will be useful,                        //
//    but WITHOUT ANY WARRANTY; without even the implied warranty of                          //
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                          //
//    GNU General Public License for more details.                                            //
//                                                                                            //
//    To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.    //
////////////////////////////////////////////////////////////////////////////////////////////////
                       
string mailer_num;
default
    {
        link_message(integer sender_num, integer num, string msg, key id)
            {
                mailer_num = llGetScriptName();
                if (num == (integer)mailer_num)
                    {
                        llEmail(msg,"delivered", (string)num);
                    }
            }
}</lsl>}}

Latest revision as of 02:51, 8 April 2009

Copying Permission

Copyright © 2008 by Kristy Fanshaw

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.

Pay Script for "Reseller Vendor Object"

Updater Script for "Reseller Vendor Update Object"

Server Script and Mailer Script for "Server Object"