Jump to content

NymphaeaMK

Resident
  • Posts

    3
  • Joined

  • Last visited

Posts posted by NymphaeaMK

  1. Hello,

    I need your help. I've this script and I need to modify in order to allow it to split a 100% percentage to another avatar.
    The point is that this script opens a menu window that makes it possible to buy the item as a gift,
    for this reason I can't use a simple vendor script with the percentage split.

     

    I copy the script here. Can anyone please modify it for me? I really can't make it work.
    I'd like to reward the first one that will make it work, so please contact me inworld ( NymphaeaMK Resident )
    or specify your name inworld and I'll be glad to offer you 50 L$

    Thank you in advance for your help.

    xxx Nym

     

    //STRINGS
    string sBUTTON_BUY = "BUY NOW";
    string sBUTTON_GIFT = "SEND AS GIFT";
    string sBUTTON_INFO = "INFORMATION";

    string sMESSAGE_BUY = "Right click this vendor and click pay to buy this product.";
    string sMESSAGE_BUY_SUCCESS = "Item successfully delivered!";
    string sMESSAGE_GIFT = "Enter the full name of the recipient in local chat.";
    string sMESSAGE_GIFT_SUCCESS = "Item successfully delivered to the recipient ";
    string sMESSAGE_INFO = "Notecard is being sent.";
    string sMESSAGE_BUY_FOR_GIFTED = "Avatar found. Right click this vendor and click pay to send this item now.";

    string sDIALOGMESSAGE = "Please choose:";

    string sERROR = "Name not found!"; //Name2key-error.

    float fTIMEOUT_RESERVED = 60; //Seconds before time out.
    float fTIMEOUT_NAME2KEY = 30; //Seconds before name2key times out.
    string sTIMEOUT = "Timed out.";

    vector vRESERVED_COLOR = <1.0, 1.0, 1.0>;
    float fRESERVED_ALPHA = 1.0;
    string sRESERVED = "Vendor is in use.";

    integer iCHANNEL_NAME2KEY = PUBLIC_CHANNEL;
    integer iCHANNEL_DIALOG = -4787644;

    string sINVALID_AMOUNT = "Invalid amount!";

    dialog(key kAvatar)
    {
        llDialog(kAvatar, sDIALOGMESSAGE, [sBUTTON_BUY, sBUTTON_GIFT, sBUTTON_INFO], iCHANNEL_DIALOG);
    }

    string sPURCHASE_IM = " just bought ";
    string sPURCHASE_IM2 = " at a price of ";
    string sPURCHASE_IM3 = " L$ in region ";
    ownerPurchaseIM(string sItemname, string sAvatarname)
    { //Send IM to owner.
        string sPrice = (string)((integer)llGetObjectDesc());
        string sSLURL = llGetRegionName() + getSLURLPos(llGetPos());
        llInstantMessage(llGetOwner(), sAvatarname + sPURCHASE_IM + sItemname + sPURCHASE_IM2 + sPrice + 
        sPURCHASE_IM3 + sSLURL);
    }
    string getSLURLPos(vector v)
    { //Returns SL-url-pos.
        return " (" + (string)((integer)(v.x)) + "," + (string)((integer)(v.y)) + "," + (string)((integer)(v.z)) + ")";
    }

    string sURL   = "http://w-hat.com/name2key"; //Name2key url.
    key reqid;

    integer iMAXLEN = 100;
    string sPARAM = "?terse=1&name=";
    httpdb_load(string sNAME)
    { //Perform name2key search.
      reqid = llHTTPRequest(sURL + sPARAM + llEscapeURL(sNAME), [HTTP_BODY_MAXLENGTH, iMAXLEN], "" );
    }

    key kUSER; //Globals.
    string sGIFTEDNAME;
    integer iREADY_FOR_PAYMENT = FALSE;
    key kGIFTED;
    integer iLISTEN;
    default
    {
        state_entry()
        { //Request debit-permission from owner.
            llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
            llSetTimerEvent(0.0); //Stop timer.
            llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
        }

        changed(integer change)
        { //Reset when changing owner.
            if (change & CHANGED_OWNER)
            {
                llResetScript();
            }
        }

        run_time_permissions(integer perm)
        {
            if (perm & PERMISSION_DEBIT)
            { //Permissions granted, go to state perm.
                state perm;
            }
        }

        on_rez(integer start_param)
        {
            if (!(llGetPermissions() & PERMISSION_DEBIT) || llGetPermissionsKey() != llGetOwner())
            { //Permissions invalid.
                llResetScript();
            }
        }
    }
    state perm
    {
        state_entry()
        { //Permissions given.
            llSetTimerEvent(0.0); //Stop timer.
            kUSER = NULL_KEY; //Reset key.
            sGIFTEDNAME = ""; //Reset name.
            llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
            llSetText("", vRESERVED_COLOR, fRESERVED_ALPHA);
        }

        touch_start(integer total_number)
        {
            kUSER = llDetectedKey(0);
            state inuse;
        }

        changed(integer change)
        { //Reset when changing owner.
            if (change & CHANGED_OWNER)
            {
                llResetScript();
            }
        }
    }
    state inuse
    {
        state_entry()
        { //Set up timeout for in-use-state.
            iREADY_FOR_PAYMENT = FALSE; //Reset ready-flag.
            kGIFTED = NULL_KEY; //Reset gifted-key.
            llSetPayPrice(PAY_HIDE, [(integer)llGetObjectDesc(), PAY_HIDE, PAY_HIDE, PAY_HIDE]);
            llSetTimerEvent(fTIMEOUT_RESERVED);
            llSetText(sRESERVED, vRESERVED_COLOR, fRESERVED_ALPHA);
            llListenRemove(iLISTEN);
            iLISTEN = llListen(iCHANNEL_DIALOG, "", kUSER, "");
            dialog(kUSER);
        }
        listen(integer channel, string name, key id, string message)
        {
            if (channel == iCHANNEL_DIALOG && id == kUSER)
            { //Correct channel and user.
                if (message == sBUTTON_BUY)
                { //Buy-option chosen.
                    llSay(PUBLIC_CHANNEL, sMESSAGE_BUY);
                }
                else if (message == sBUTTON_GIFT)
                { //Gift-option chosen.
                    state name2key;
                }
                else if (message == sBUTTON_INFO)
                { //Info-notecard-option chosen.
                    if (llGetInventoryNumber(INVENTORY_NOTECARD) > 0)
                    {
                        llGiveInventory(kUSER, llGetInventoryName(INVENTORY_NOTECARD, 0));
                        llSay(PUBLIC_CHANNEL, sMESSAGE_INFO);
                    }
                }
            }
        }
        touch_start(integer num_detected)
        {
            if (llDetectedKey(0) != kUSER)
            { //Error message (non-user).
                llRegionSayTo(llDetectedKey(0), PUBLIC_CHANNEL, sRESERVED);
            }
            else
            { //Dialog.
                dialog(kUSER);
            }
        }
        money(key id, integer amount)
        {
            string sItem;
            if (amount != (integer)llGetObjectDesc())
            { //Invalid amount!
                llTransferLindenDollars(id, amount);
                llSay(PUBLIC_CHANNEL, sINVALID_AMOUNT);
                return;
            }
            else
            {
                if (llGetInventoryNumber(INVENTORY_OBJECT) > 0)
                { //Give item.
                    sItem = llGetInventoryName(INVENTORY_OBJECT, 0);
                    llGiveInventory(kUSER, sItem);
                }
                llSay(PUBLIC_CHANNEL, sMESSAGE_BUY_SUCCESS);
                ownerPurchaseIM(sItem, llKey2Name(kUSER));
                state perm; //Return to state perm.
            }
        }
        timer()
        { //Time's up for user. Go back to state perm.
            state perm;
        }
        changed(integer change)
        { //Reset when changing owner.
            if (change & CHANGED_OWNER)
            {
                llResetScript();
            }
        }
    }

    state name2key
    {
        state_entry()
        { //Setting up listener for name2key-query.
            iREADY_FOR_PAYMENT = FALSE; //Reset ready-flag.
            kGIFTED = NULL_KEY; //Reset gifted-key.
            llListen(iCHANNEL_NAME2KEY, "", kUSER, "");
            llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
            llSetTimerEvent(fTIMEOUT_NAME2KEY);
            llSay(PUBLIC_CHANNEL, sMESSAGE_GIFT);
        }
        listen(integer channel, string name, key id, string message)
        {
            if (channel == iCHANNEL_NAME2KEY && id == kUSER)
            { //User said name.
                sGIFTEDNAME = message;
                httpdb_load(sGIFTEDNAME);
            }
        }
        money(key id, integer amount)
        {
            string sItem;
            if (!iREADY_FOR_PAYMENT)
            { //Not ready for payment.
                return;
            }
            else
            {
                if (amount != (integer)llGetObjectDesc())
                { //Invalid amount!
                    llTransferLindenDollars(id, amount);
                    llSay(PUBLIC_CHANNEL, sINVALID_AMOUNT);
                    return;
                }
                else
                {
                    if (llGetInventoryNumber(INVENTORY_OBJECT) > 0)
                    { //Give item.
                        sItem = llGetInventoryName(INVENTORY_OBJECT, 0);
                        llGiveInventory(kGIFTED, sItem);
                    }
                    llSay(PUBLIC_CHANNEL, sMESSAGE_GIFT_SUCCESS + sGIFTEDNAME);
                    ownerPurchaseIM(sItem, llKey2Name(kUSER));
                    state perm; //Return to state perm.
                }
            }
        }
        timer()
        { //Timeout of name2key (user did not enter name in chat, or name2key did not return a result).
            llSay(PUBLIC_CHANNEL, sTIMEOUT);
            state inuse;
        }
        changed(integer change)
        { //Reset when changing owner.
            if (change & CHANGED_OWNER)
            {
                llResetScript();
            }
        }
        http_response(key id, integer status, list meta, string body)
        { //Response from Name2Key-request.
            if (id == reqid)
            {
                reqid = NULL_KEY;
                if((key)body == NULL_KEY)
                { //No key found.
                    llSay(PUBLIC_CHANNEL, sERROR);
                }
                else
                { //Key found.
                    llSetPayPrice(PAY_HIDE, [(integer)llGetObjectDesc(), PAY_HIDE, PAY_HIDE, PAY_HIDE]);
                    llSay(PUBLIC_CHANNEL, sMESSAGE_BUY_FOR_GIFTED);
                    kGIFTED = (key)body;
                    iREADY_FOR_PAYMENT = TRUE;
                }
            }
        }
    }

  2. Hello everyone,
    we are a team and we are looking for an expert scripter which should be able to script a new breedable.
    It is possible to modify a pre-made script by adding some features such as genetic.
    It is also possible to make a new script.

    For each option we will offer a different pay.
    If you wish to cooperate for a long term, we can discuss about it.

    Please answer here or drop a NC.

    Best,
    NymphaeaMK
×
×
  • Create New...