
I'm not a scripter, but I can muddle through simple stuff. I wanted to create a dialogue box for an object that will dispense drinks. I found an example for dialogue boxes on the Wiki, and adapted that a little. It works, to a point ... I get the confirmation message that I picked the option for Bottle of Beer,, and I also get the test message that I added so that I know it's reading everything - however, it does NOT give me the Bottle of Beer, even though it's in the object's inventory (with full perms) - and it also does not give me an error message, so I have no idea what I'm doing wrong. Help please?
Here is the script, I marked the part that I added. Thanks much!
-Claire
// when touched, present a dialog with four color choices
integer CHANNEL = 42; // dialog channel
list MENU_MAIN = ["Bottle of Beer", "Stand", "Fly", "Cheat", "Options..."]; // the main menu
list MENU_OPTIONS = ["Cherry", "Blueberry", "Vinegar", "Slime", "Chips", "Salad", "...Back"]; // a submenu
default {
state_entry() {
llListen(CHANNEL, "", NULL_KEY, ""
; // listen for dialog answers (from multiple users)}
touch_start(integer total_number)
{
llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL); // present dialog on click
}
listen(integer channel, string name, key id, string message)
{
if (llListFindList(MENU_MAIN + MENU_OPTIONS, [message]) != -1) // verify dialog choice
{
llSay(0, name + " picked the option '" + message + "'."
; // output the answerif (message == "Options..."
llDialog(id, "Pick an option!", MENU_OPTIONS, CHANNEL); // present submenu on request
else if (message == "...Back"
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL); // present main menu on request to go back
// here you have the name and key of the user and can easily verify if they have the permission to use that option or not
else if (message == "Sit"
llSay(0, "This is where stuff would happen if this wasn't just an example"
;// My addition
else if (message == "Bottle of Beer"
llSay(0, "You picked a bottle of beer."
;llGiveInventory(llDetectedKey(0), "Beer Bottle"
;llSay(0, "Pffft"
;// End of my addition
} else
llSay(0, name + " picked invalid option '" + llToLower(message) + "'."
; // not a valid dialog choice}
}
