Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

help with giving inventory items to av

Ehco Klossovsky
Registered User
Join date: 22 Mar 2008
Posts: 10
06-18-2008 01:45
hey all, im making a bbq, except im having a problem with one part. When i go into the menu i made to click on one of the items your supposde to get, it doesnt seem to listen to the message being sent out by the llDialog thing and instead it just gives me the first inventory item for each menu item i click , this is what i have so far if someone could help me out that would be great, still very new to scripting any help would be greatly apppreciated



list BBQ_menu = ["ON","OFF","Cheeseburger","Hotdog","Kebab","Chicken Burger","Hamburger","Steak Sandwhich"];
integer Channel = -9889;




default
{
state_entry()
{
llListen(Channel,"",NULL_KEY,"";);
}

touch(integer total_number)
{
llDialog(llDetectedKey(0),"Would you Like to turn the BBQ on?",BBQ_menu,Channel);
}
listen(integer channel, string name, key id, string message)
{
if(message == "Cheeseburger";);
{
llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT,0));
llResetScript();
}
if(message == "Hotdog";);
{
llGiveInventory(id, llGetInventoryName(INVENTORY_OBJECT,2));
llResetScript();
}
}
}
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
06-18-2008 02:50
Try this instead, it should work and give a hint about what was wrong
CODE
BBQ_menu = ["ON","OFF","Cheeseburger","Hotdog","Kebab","Chicken Burger","Hamburger","Steak Sandwhich"];
integer Channel = -9889;

default
{
state_entry()
{
llListen(Channel,"",NULL_KEY,"");
}

touch(integer total_number)
{
llDialog(llDetectedKey(0),"Would you Like to turn the BBQ on?",BBQ_menu,Channel);
}

listen(integer channel, string name, key id, string message)
{
integer spot = llListFindList( BBQ_menu, [message]);
if ( spot > 1 ) llGiveInventory(id, message);
}
}
Assuming the list names also are the object names :-) It does not take On and OFF actions and it omits your llResetScript()s, which are not needed.
Happy scripting
_____________________
From Studio Dora
Ehco Klossovsky
Registered User
Join date: 22 Mar 2008
Posts: 10
thank you
06-18-2008 17:08
hey thanks for your reply , im not sure if i understand whats going on in the script u supplyed, the on/off bit on mine was going to be for a partical script im goign to add a bit later, and im still confused as to how to get it to give out the inventory items id like it to instead of just skipping all the stuff teling it what to give and just giving me the first inventory item, i thihnk its a problem with it listning to it right but im not sure and i kinda suck at this right now =[
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
06-20-2008 00:22
The message from a dialog = the text on the clicked button.

What Dora does: first check if the message is not "ON" or "OFF" (BBQ_menu items on spot 0 and 1) and if so give out a inventory item with the name message.

So if user clicks "Kebab", the message in the listen is "Kebab".
"Kebab" is in the list at spot 4.
Give out inventory item "Kebab".