Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Chat command to open dialog (menu)

ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
06-01-2009 13:43
I know how to initiate a dialog menu with by "touch" event, but I would like to initiate one with a "chat" event. My efforts to combine an llListen script with a "touch_start" script have not worked out to well. I keep getting a "Object: ArchTx Edo picked invalid option 'computer'." message and no menu. I'd appreciate some help with this, my brain is spinning around in circles inside my head.

From: someone
// Say /19 computer for a dialog MENU with choices

integer CHANNEL = 19; // dialog channel menu speaks to prim script on this channel


list MENU_MAIN = ["Shield On", "Shield Off", "Security On", "Security Off"]; // the Main menu.. NOTE reverse order of the listing.

list MENU_TWO = ["3", "2", "...Back", "1"]; // a SUBMENU.. NOTE reverse order of the listing.

default {
state_entry() {
llListen(CHANNEL, "", NULL_KEY, "";); // listen for dialog answers (from multiple users)
}

listen(integer channel, string name, key id, string message)
{
if (message == "Computer";)
{
llDialog(llDetectedKey(0), "What do you want to do?", MENU_MAIN, CHANNEL);
llSay(0, "You picked Computer";); // present submenu on request
}

if (llListFindList(MENU_MAIN + MENU_TWO, [message]) != -1) // verify dialog choice
{
llSay(0, name + " picked the option '" + message + "'.";); // output the answer.. Menu says what item was picked.

if (message == "...Back";)
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL); // present main menu on request to go back

else if (message == "Shield On";)
llSay(0, "Shield On";);

else if (message == "Shield Off";) //works
llSay(0, "Shield Off";);

else if (message == "Security On";) //WORKS
llSay(0, "Security On";);

else if (message == "Security Off";) //WORKS
llSay(0, "Security Off";);
}

else
llSay(0, name + " picked invalid option '" + llToLower(message) + "'.";); // not a valid dialog choice
}
}
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
06-01-2009 14:07
llDetectedKey(0) don't work inside of the listen event. replace it with the id that is the key of the avatar chatting;


...

listen(integer channel, string name, key id, string message)
{
if (message == "Computer";)
{
llDialog(id, "What do you want to do?", MENU_MAIN, CHANNEL);
llSay(0, "You picked Computer";); // present submenu on request
}
...
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
06-01-2009 14:42
That works, TY very much. :)
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo