Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Activating llDialog from another script via llMessageLinked

Ilayda Reina
Registered User
Join date: 21 Nov 2007
Posts: 31
12-09-2008 13:48
I want to call dialog menu from another script via llMessageLinked, I think I could get it if I could see a simple example of it.

Thanks
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
12-09-2008 14:08
From: Ilayda Reina
I want to call dialog menu from another script via llMessageLinked, I think I could get it if I could see a simple example of it.

Thanks


quick and dirty sample
CODE

// master script
default
{
touch_start(integer total_number)
{
llMessageLinked(LINK_ALL_OTHERS,1,"","");
}
}
// end master script

// child script
default
{
link_message(integer sender_number, integer number, string message, key id)
{
if (number==1)
{
llDialog(llGetOwner(),"Choose an option",["Option 1","Option 2","Option 3"], 100);
llListen(100,"",llGetOwner(),"");
}
}

listen(integer channel, string name, key id, string message)
{
if ((channel==100) && (llGetOwner()==id))
{
// respond to dialog
if (message=="Option 1")
{
// do option 1 stuff
}
else if (message=="Option 2")
{
// do option 2 stuff
}
else if (message=="Option 3")
{
// do option 3 stuff
}
else
{
// not one of our options ignore
}
}
}

}
// end child script
Ilayda Reina
Registered User
Join date: 21 Nov 2007
Posts: 31
12-09-2008 14:24
I get it, thanks a lot _^^_
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
12-09-2008 20:00
This example only works for the owner, of course. It's maybe worth noting (if only because it took me ages to figure out what was going wrong the first time I tried to call llDialog with a link message) that if the script is supposed to talk to anyone other than the owner, you need to do something like
CODE
// master script
default
{
touch_start(integer total_number)
{
key av = llDetectedKey(0)

llMessageLinked(LINK_ALL_OTHERS,1,"",av);
}
}
// end master script

// child script
default
{
link_message(integer sender_number, integer number, string message, key id)
{
key av = id;
if (number==1)
{
llDialog(av,"Choose an option",["Option 1","Option 2","Option 3"], 100);
llListen(100,"", av,"");
}
}
//,,,,,,,

Otherwise the second script has no idea with whom it's supposed to be talking.
Jeredin Denimore
Romani Ite Domum
Join date: 5 Jul 2008
Posts: 95
12-10-2008 05:37
From: Innula Zenovka
This example only works for the owner, of course. It's maybe worth noting (if only because it took me ages to figure out what was going wrong the first time I tried to call llDialog with a link message) that if the script is supposed to talk to anyone other than the owner, you need to do something like
CODE
// master script
default
{
touch_start(integer total_number)
{
key av = llDetectedKey(0)

llMessageLinked(LINK_ALL_OTHERS,1,"",av);
}
}
// end master script

// child script
default
{
link_message(integer sender_number, integer number, string message, key id)
{
key av = id;
if (number==1)
{
llDialog(av,"Choose an option",["Option 1","Option 2","Option 3"], 100);
llListen(100,"", av,"");
}
}
//,,,,,,,

Otherwise the second script has no idea with whom it's supposed to be talking.


Yup, hence the "quick and dirty" disclaimer hehe ;)
Ilayda Reina
Registered User
Join date: 21 Nov 2007
Posts: 31
12-10-2008 08:55
I just notice it when I make my friend try my tool , thanks a lot Innula,

kisses,
ilayda