Edie_Shoreland icon

Candybags: Candybags HUD

Edie_Shoreland | PRO | 03/03/19 04:26:48 AM UTC | 0 ⭐ | 9567 👁️ | Never ⏰ | []
Linden Scripting |

0 B

|

None

|

0 👍

/

0 👎

//Scripts for Candybags by NawtieNitey "NaNi" October 2014
//Revised for Pastebin.com  March 2019
 
//Rez a prim. Name it "Candybags HUD". Create a note-
//card, and paste the information from "Candybags
//Notecard" into the new notecard. Name the notecard
//"Dialog Button Menu" and place a copy inside the HUD.
//Put some prizes into the HUD. Put this script in it. 
//Take the prim/HUD back into inventory and right click
//it. Select "Attach as HUD" and select a spot on your
//screen to place it.
 
key notecardQueryId;
 
//the script will be looking for a notecard named
//"Dialog Button Menu" so make sure your HUD has a
//notecard with that exact name. Case matters!
string notecardName = "Dialog Button Menu";
 
list cardstuff;
integer notecardLine;
 
 
key el_touchy; //The person touching you
integer chanl;
integer randomIndex;
key last_touch;
 
say(string inputString)
{
    llOwnerSay(inputString);
}
 
 
 
default
{
    state_entry()
    {
        //set up a unique channel between two attachments based on the wearer's
        //UUID to prevent the objects accidentally communicating with others who
        //may be using the same devices
        string uniq_chan = (string)llGetOwner( ); //get the wearer's key
        uniq_chan = "0x" + (llGetSubString(uniq_chan, 6, 7)) + (llGetSubString(uniq_chan, 11, 12));
        integer poschan = (integer)uniq_chan; //establish a channel using parts of that key.
        chanl = 0 - poschan; //make the channel a negative value
        //  llSay (0, (string)chanl);
    
        llSetTimerEvent(1800.0);
        //The script will look for your notecard, if it doesn't find what it's
        //looking for, the script will let you know.
        if (llGetInventoryKey(notecardName) == NULL_KEY)
        {
            llOwnerSay( "Notecard '" + notecardName + "' missing or unwritten");
            return;
        }
        //Otherwise it will read and store the choices for menu
        //buttons into memory
        notecardQueryId = llGetNotecardLine(notecardName, notecardLine);
        //Then it will establish communication with the script in
        //your prim breasts.
        llListen(chanl, "", NULL_KEY, "");
 
    }
 
    on_rez(integer num)
    {
        llResetScript();                                
    }
 
    changed(integer change)
    {
        if (change == CHANGED_INVENTORY)
        {
            llResetScript();                            
        }
    }
    
    timer()
    {
        //If no one touches your breasts before the timer runs out, this will
        //clear the UUID for the last person to touch them.
        last_touch = NULL_KEY;
    }
 
 
    listen(integer channel, string name, key id, string message)
    {
        //breakstring breaks up the message from the breast script and sends
        //back the toucher's UUID, which is stored in el_touchy as a key.
        string breakstring = llGetSubString(message, 0, 35);
        el_touchy = (key)breakstring;
        //breakstring looks at the remainder of the message and gets the name
        //of the toucher so you know who is touching you.
        breakstring = llGetSubString(message, 36, -1);
        llOwnerSay (breakstring + " is touching my breasts");
        //then el_touchy is used to send a message to the toucher.
        if (el_touchy == last_touch)
        {
            llDialog(el_touchy, "\nNo more candy for you! Try again later.", [] , -69);
        }
        else
        {
            //The llDialog dialog box is for decorative purposes, a new channel
            //is not opened, and the toucher's selection from the menu does
            //absolutely nothing except stall for a bit before the prize is
            //delivered.  The text in the dialog box and text for the buttons
            //are from the "Dialog Button Menu" notecard.
            llDialog(el_touchy, "\n"+llList2String(cardstuff, 0), llList2List( cardstuff, 1, 12 ), -69);
            //The script generates a random integer based on how many objects
            //you have in your HUD's inventory...
            randomIndex = llGetInventoryNumber(INVENTORY_OBJECT);
            integer randy = (integer)llFrand(randomIndex);
            //...and it uses that integer to select a random item to gift.
            string itemName = llGetInventoryName(INVENTORY_OBJECT, randy);
            llSleep (6);
            //The gift is sent to the toucher...
            llGiveInventory(el_touchy, itemName);
            //...and you're alerted to who touched your breasts and the prize
            //they've won.
            llOwnerSay (breakstring + " won " + itemName + ".");
            last_touch = el_touchy;
        }
    }
    
    dataserver(key query_id, string data)
    {
        if (query_id == notecardQueryId)
        {
            if (data == EOF) say("Done reading notecard, read " + (string)notecardLine + " notecard lines.");
            else
            {
                // bump line number for reporting purposes and in preparation for reading
                // the next line.
                ++notecardLine;
                if ((llStringTrim(data, STRING_TRIM) != "") && (llGetSubString(data, 0, 0) != "#"))
                {
                    cardstuff = cardstuff + [data];
                }
                notecardQueryId = llGetNotecardLine(notecardName, notecardLine);
            }
        }
    }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎