Edie_Shoreland

Candybags: Candybags HUD

Mar 2nd, 2019
495
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Scripts for Candybags by NawtieNitey "NaNi" October 2014
  2. //Revised for Pastebin.com  March 2019
  3.  
  4. //Rez a prim. Name it "Candybags HUD". Create a note-
  5. //card, and paste the information from "Candybags
  6. //Notecard" into the new notecard. Name the notecard
  7. //"Dialog Button Menu" and place a copy inside the HUD.
  8. //Put some prizes into the HUD. Put this script in it.
  9. //Take the prim/HUD back into inventory and right click
  10. //it. Select "Attach as HUD" and select a spot on your
  11. //screen to place it.
  12.  
  13. key notecardQueryId;
  14.  
  15. //the script will be looking for a notecard named
  16. //"Dialog Button Menu" so make sure your HUD has a
  17. //notecard with that exact name. Case matters!
  18. string notecardName = "Dialog Button Menu";
  19.  
  20. list cardstuff;
  21. integer notecardLine;
  22.  
  23.  
  24. key el_touchy; //The person touching you
  25. integer chanl;
  26. integer randomIndex;
  27. key last_touch;
  28.  
  29. say(string inputString)
  30. {
  31.     llOwnerSay(inputString);
  32. }
  33.  
  34.  
  35.  
  36. default
  37. {
  38.     state_entry()
  39.     {
  40.         //set up a unique channel between two attachments based on the wearer's
  41.         //UUID to prevent the objects accidentally communicating with others who
  42.         //may be using the same devices
  43.         string uniq_chan = (string)llGetOwner( ); //get the wearer's key
  44.         uniq_chan = "0x" + (llGetSubString(uniq_chan, 6, 7)) + (llGetSubString(uniq_chan, 11, 12));
  45.         integer poschan = (integer)uniq_chan; //establish a channel using parts of that key.
  46.         chanl = 0 - poschan; //make the channel a negative value
  47.         //  llSay (0, (string)chanl);
  48.    
  49.         llSetTimerEvent(1800.0);
  50.         //The script will look for your notecard, if it doesn't find what it's
  51.         //looking for, the script will let you know.
  52.         if (llGetInventoryKey(notecardName) == NULL_KEY)
  53.         {
  54.             llOwnerSay( "Notecard '" + notecardName + "' missing or unwritten");
  55.             return;
  56.         }
  57.         //Otherwise it will read and store the choices for menu
  58.         //buttons into memory
  59.         notecardQueryId = llGetNotecardLine(notecardName, notecardLine);
  60.         //Then it will establish communication with the script in
  61.         //your prim breasts.
  62.         llListen(chanl, "", NULL_KEY, "");
  63.  
  64.     }
  65.  
  66.     on_rez(integer num)
  67.     {
  68.         llResetScript();                                
  69.     }
  70.  
  71.     changed(integer change)
  72.     {
  73.         if (change == CHANGED_INVENTORY)
  74.         {
  75.             llResetScript();                            
  76.         }
  77.     }
  78.    
  79.     timer()
  80.     {
  81.         //If no one touches your breasts before the timer runs out, this will
  82.         //clear the UUID for the last person to touch them.
  83.         last_touch = NULL_KEY;
  84.     }
  85.  
  86.  
  87.     listen(integer channel, string name, key id, string message)
  88.     {
  89.         //breakstring breaks up the message from the breast script and sends
  90.         //back the toucher's UUID, which is stored in el_touchy as a key.
  91.         string breakstring = llGetSubString(message, 0, 35);
  92.         el_touchy = (key)breakstring;
  93.         //breakstring looks at the remainder of the message and gets the name
  94.         //of the toucher so you know who is touching you.
  95.         breakstring = llGetSubString(message, 36, -1);
  96.         llOwnerSay (breakstring + " is touching my breasts");
  97.         //then el_touchy is used to send a message to the toucher.
  98.         if (el_touchy == last_touch)
  99.         {
  100.             llDialog(el_touchy, "\nNo more candy for you! Try again later.", [] , -69);
  101.         }
  102.         else
  103.         {
  104.             //The llDialog dialog box is for decorative purposes, a new channel
  105.             //is not opened, and the toucher's selection from the menu does
  106.             //absolutely nothing except stall for a bit before the prize is
  107.             //delivered.  The text in the dialog box and text for the buttons
  108.             //are from the "Dialog Button Menu" notecard.
  109.             llDialog(el_touchy, "\n"+llList2String(cardstuff, 0), llList2List( cardstuff, 1, 12 ), -69);
  110.             //The script generates a random integer based on how many objects
  111.             //you have in your HUD's inventory...
  112.             randomIndex = llGetInventoryNumber(INVENTORY_OBJECT);
  113.             integer randy = (integer)llFrand(randomIndex);
  114.             //...and it uses that integer to select a random item to gift.
  115.             string itemName = llGetInventoryName(INVENTORY_OBJECT, randy);
  116.             llSleep (6);
  117.             //The gift is sent to the toucher...
  118.             llGiveInventory(el_touchy, itemName);
  119.             //...and you're alerted to who touched your breasts and the prize
  120.             //they've won.
  121.             llOwnerSay (breakstring + " won " + itemName + ".");
  122.             last_touch = el_touchy;
  123.         }
  124.     }
  125.    
  126.     dataserver(key query_id, string data)
  127.     {
  128.         if (query_id == notecardQueryId)
  129.         {
  130.             if (data == EOF) say("Done reading notecard, read " + (string)notecardLine + " notecard lines.");
  131.             else
  132.             {
  133.                 // bump line number for reporting purposes and in preparation for reading
  134.                 // the next line.
  135.                 ++notecardLine;
  136.                 if ((llStringTrim(data, STRING_TRIM) != "") && (llGetSubString(data, 0, 0) != "#"))
  137.                 {
  138.                     cardstuff = cardstuff + [data];
  139.                 }
  140.                 notecardQueryId = llGetNotecardLine(notecardName, notecardLine);
  141.             }
  142.         }
  143.     }
  144. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×