Thanks for response - The HUD uses this script to talk to the prim on the avatar:
default
{
on_rez(integer s)
{
channel = (integer) llFrand(10000.0) * -1 - 1;
Channel = channel;
llSay(-5, (string)Channel);
}
touch_start(integer total_number)
{
// Get the name of the prim touched
llSay(channel, llGetLinkName(llDetectedLinkNumber(0)));
}
}
It tells the prim what to channel it's going to send commands on in the on_rez, the prim attached to tthe avatar does this:
default
{
on_rez(integer s)
{
//at the moment it isnt attached....
//if(llGetAttached()>0)
{
avatar = llGetOwner();
glistener = llListen(-5, "", NULL_KEY,""

;
}
}
state_entry()
{
if ( llGetInventoryNumber(INVENTORY_SOUND) == 0 )
{
llOwnerSay("Critical error, no sounds found!"

;
}
}
listen(integer channel, string name, key id, string message)
{
if (channel == -5)//listening here (where the HUD first sends on, so it learns what the random channel will be...
{
llListenRemove(glistener);
glistener = llListen((integer)message, "", NULL_KEY, ""

;//resetting the channel
}
if (message == "Upper Circle"

// and etc. "Upper Circle" is the name of the prim you touched in the HUD.
.
.
.
I can see here that the attached prim should be attached first (as it's listening and waiting for the HUD to tell it what channel it will be, and the HUD automatically sends the channel but once. But Im not sure how to do it both ways; Maybe I shold move the code in the HUD on_rez into a dialogue box, so it doesn't send until I tell it to. That seems to be a bit "cheap" though...
