Difference between revisions of "User:Kristy Fanshaw"

From Second Life Wiki
Jump to navigation Jump to search
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Pay Script for Reseller vendor==
{{LSL Header}}
Place this script in a Vendor Root prim.


What it does:
==About: Kristy Fanshaw==
Custom content creator.


1) it asks the owner of the vendor to rezz the update box.
==Contibutions==
2) update box will define the URL from where it can aquire the email address of the vendor. (the webpage body should contain only pure address - no html code)
Scripts i've made
3) when the URL is set, it asks the owner of the vendor to grant debits. If the owner won't do so, the script resets.
4) When debits are granted the vendor will be active


Purchase:
*[[User:Kristy_Fanshaw/Vendor_System_Script|Vendor System Script]] :: Helps to create vendor for resellers with money split and always up-to-date content.


1) buyer can pay only the amount of money that is set in "integer gCorrectAmount = price;"
*[[User:Kristy_Fanshaw/Shorter_Vendor_System_Script|Shorter Vendor System Script]] :: Helps to create vendor for resellers with money split and always up-to-date content. (without HTTP check)


*[[Online Indicator|Online Indicator]] :: Will show if the user is online or not. Displays users profile picture and allows to send IM's to user. Also gives a link to open the users profile.
 
 
<lsl>
integer gCorrectAmount = 10;                      //enter your price for fast pay
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
integer totalsold = 0;
integer totalamount = 0;
key OWNER;
key CREATOR;
key ID;
string url;
key http_request_id;
integer listen_handle;
integer buyer_paid;
string mail;
integer Ch;
 
 
default
    {
        changed(integer change)
            {
                if(change && CHANGED_OWNER)
                    {
                        llResetScript();
                    }
            }
        on_rez(integer start_param)
            {
                llResetScript();
            }
        state_entry()
            {
                OWNER = llGetOwner();
                CREATOR = llGetCreator();
                Ch =  ( -1 * (integer)("0x"+llGetSubString((string)llGetCreator(),-7,-1)) );
                llSetPayPrice(PAY_HIDE, [gCorrectAmount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
                llSetText("To start vendor, rezz '" + update_box + "'.", <1.0, 1.0, 1.0>, 1.0);
                llSensorRepeat(update_box, NULL_KEY , SCRIPTED, 10 , PI, 10);
            }
        sensor (integer numberDetected)
            {
                state sens;
            }
        no_sensor ()
            {
                llResetScript();
            }
    }
state sens
    {
        on_rez(integer start_param)
            {
                llResetScript();
            }
        state_entry()
            {
                llSetText("Updating", <1.0, 1.0, 1.0>, 1.0); 
                llShout(Ch,"update");
                listen_handle = llListen(Ch,update_box, NULL_KEY, "");
                llSensorRepeat(update_box, NULL_KEY , SCRIPTED, 10 , PI, 5);
            }
        listen( integer channel, string name, key id, string message )
            {
                url = message;
                llListenRemove(listen_handle);
                llOwnerSay("updated");
                llShout(Ch,"updated");
                llListenRemove(listen_handle);   
            }
        sensor (integer numberDetected)
            {
                llListenRemove(listen_handle);
                state sens;
            }
        no_sensor ()
            {
                llSetText("Touch to grant debit permission.", <1.0, 1.0, 1.0>, 1.0);
            }
        touch_start(integer total_number)
            {
                llRequestPermissions(OWNER, PERMISSION_DEBIT);
            }
        run_time_permissions(integer Permission)
            {
                if(Permission == PERMISSION_DEBIT)
                    {
                        llOwnerSay("Starting vendor.");
                        llSetText("", <1.0, 1.0, 1.0>, 1.0);
                        state Ready;
                    }
                else
                    {
                        llOwnerSay ( "To share proceeds I must have give money(DEBIT) permissions");
                        llOwnerSay ( "Try again");
                        llResetScript();
                    }
            } 
    }
state Ready
    {
        on_rez(integer start_param)
            {
                llResetScript();
            }
        state_entry()
            {
                llSensorRepeat(update_box, NULL_KEY , SCRIPTED, 10 , PI,30);
            }
        sensor (integer numberDetected)
            {
                llSetText("Updating", <1.0, 1.0, 1.0>, 1.0);
                llShout(Ch,"update");
                listen_handle = llListen(Ch,update_box, NULL_KEY, "");
            }
        listen( integer channel, string name, key id, string message )
            {
                url = message;
                llListenRemove(listen_handle);
                llOwnerSay("updated");
                llShout(Ch,"updated");
                llSetText("", <1.0, 1.0, 1.0>, 1.0);
                llListenRemove(listen_handle);
            }
        touch_start(integer total_number)
            {
                if (llDetectedOwner(0) == OWNER)
                    {
                        llOwnerSay((string)totalsold +" units have been sold since object rez. ");
                    }
                else
                    {
                        llInstantMessage(llDetectedKey(0), "Right-click and pay to purchase.");
                    }
            }
        money(key id, integer amount)
            {
                ID =id;
                buyer_paid = amount;
                    {
                        if (amount == gCorrectAmount)
                            {
                                llInstantMessage(id, "Thank you " + llKey2Name(id) + " for your purchase.");
                                llInstantMessage(id,"Server initialises your request .....");
                                http_request_id = llHTTPRequest(url, [], "");
                            }
                        else if (amount < gCorrectAmount)
                            {
                                llInstantMessage(llDetectedKey(0),"You didn't pay enough, " + llKey2Name(id) + ". Refunding your payment of L$" + (string)amount + ".");
                                llGiveMoney(id, amount);
                                state Ready;
                            }
                        else
                            {
                                integer refund = amount - gCorrectAmount;
                                llInstantMessage(llDetectedKey(0),"You paid too much, " + llKey2Name(id) + ". Your change is L$" + (string)refund + ".");
                                llGiveMoney(id, refund);
                                llInstantMessage(id, "Thank you " + llKey2Name(id) + " for your purchase.");
                                llInstantMessage(id,"Server initialises your request .....");
                                http_request_id = llHTTPRequest(url, [], "");
                            }
                    }
            }
        http_response(key request_id, integer status, list metadata, string body)
            {
                mail =body;
                    {
                        if (request_id == http_request_id)
                            {
                                if(llGetSubString(body, -19, -1) == "@lsl.secondlife.com")
                                    {
                                        llInstantMessage(ID,"Request initialised.");
                                        llInstantMessage(ID,"Sending your requested items .....");
                                        llSetText("Purchase in progress...\n\nPlease Wait...", <1.0, 1.0, 1.0>, 1.0);
                                        llSetPayPrice(PAY_HIDE,[ PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
                                        llEmail( body, ID, (string)llGetKey()+"@lsl.secondlife.com" );
                                        llSetTimerEvent(5);
                                        llGetNextEmail("", "");   
                                    }
                                else
                                    {
                                        llGiveMoney(ID, buyer_paid);
                                        llInstantMessage(ID, "Vendor is outdated");
                                        llInstantMessage(OWNER, "Your Vendor in " + llGetRegionName() + " sim can't deliver items. Please update your Vendor.");
                                        llResetScript(); 
                                    }
                            }
                    }
            }
        email( string time, string address, string subj, string message, integer num_left )
            {   
                if (subj == "delivered")
                    {
                        float profit = my_profit / 100;
                        float calc = buyer_paid + 0.0;
                        float a = calc * profit;
                        float b = buyer_paid - a;
                        llGiveMoney( CREATOR, (integer)a );
                        llInstantMessage(ID,"Accept your purchased items");
                        totalsold = totalsold + 1;
                        totalamount = buyer_paid * totalsold;
                        llInstantMessage(OWNER, (string)llKey2Name(ID) + " has paid " + (string)buyer_paid + "L$ in "+ llGetRegionName() + " and you have recived " + (string)llRound(b) + "L$ from this sale");
                        llInstantMessage(CREATOR, (string)llKey2Name(ID) + " has paid " + (string)buyer_paid + "L$ in "+ llGetRegionName() + " and you have recived " + (string)llRound(a) + "L$ from this sale");
                        llSetPayPrice(PAY_HIDE,[gCorrectAmount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
                        llSetText("", <1.0, 1.0, 1.0>, 1.0);
                        llSetTimerEvent(0);
                        state Ready;
                    } 
            }
        timer()
            {     
                llGiveMoney(ID, buyer_paid);
                llInstantMessage(ID, "Vendor couldn't deliver items ... your money is refunded");
                llInstantMessage(OWNER, "Your Vendor in " + llGetRegionName() + " sim can't deliver items. Please update your Vendor.");
                llSetPayPrice(PAY_HIDE,[gCorrectAmount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
                llSetText("", <1.0, 1.0, 1.0>, 1.0);
                llSetTimerEvent(0);
                state default;       
            }                         
}

Latest revision as of 10:07, 15 January 2009

About: Kristy Fanshaw

Custom content creator.

Contibutions

Scripts i've made

  • Vendor System Script :: Helps to create vendor for resellers with money split and always up-to-date content.
  • Online Indicator :: Will show if the user is online or not. Displays users profile picture and allows to send IM's to user. Also gives a link to open the users profile.