Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HELP! Dance Hud

msw Tomorrow
Registered User
Join date: 19 Sep 2007
Posts: 23
05-11-2008 08:43
Need some help with a dance hud problem... It is a standard script that you drop the dances in the hud and it gives you a menu (11 total) of dances. That all works fine.

The problem is if I give it to a friend we are in the same channel....
Each time I use it it has the permission pop up to ok animation and visa versa for my friend... If I go in and change the channel on mine then the pproblem goes away.

HOW do I get around this with out having to manually change the channel number each time I want someone to have it???
Can the chat channel be random generated or ????? or can the channel be read from a notecard, at least that would be easier... help....

I really don't have that much code experiemce, a novice... and dangerous...

Here is the code....

// Just add this script into a prim with up to 11 dances and touch the prim to start

list attachPoints = [
ATTACH_HUD_TOP_RIGHT,
ATTACH_HUD_TOP_CENTER,
ATTACH_HUD_TOP_LEFT,
ATTACH_HUD_BOTTOM_RIGHT,
ATTACH_HUD_BOTTOM,
ATTACH_HUD_BOTTOM_LEFT
];

string dances;
list dance_buttons;
integer chat_channel = -27;
integer dance_number;

stopAllDances()
{
integer total_dances = llGetInventoryNumber(INVENTORY_ANIMATION);
integer i = 0;
while(i < total_dances)
{
llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, i++));
}
}

default
{
state_entry()
{
integer total_dances = llGetInventoryNumber(INVENTORY_ANIMATION);
if(total_dances > 11) total_dances = 11;
integer i = 0;
while(i < total_dances)
{
dances = (dances = "";) + dances + (string)(++i) + " " + llGetInventoryName(INVENTORY_ANIMATION, i) + "\n";
dance_buttons = (dance_buttons = []) + dance_buttons + (string)i;
}
dance_buttons = (dance_buttons = []) + dance_buttons + "STOP";
llListen(chat_channel, "", NULL_KEY, "";);
}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), dances, dance_buttons, chat_channel);
}

listen(integer channel, string name, key id, string message)
{
if(message == "STOP";)
dance_number = -1;
else
dance_number = (integer)message - 1;
llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION);
}

changed(integer change)
{
if(change & CHANGED_INVENTORY)
llResetScript();
}

run_time_permissions(integer perms)
{
if(perms & PERMISSION_TRIGGER_ANIMATION)
{
stopAllDances();
if(dance_number > -1)
{
llStartAnimation(llGetInventoryName(INVENTORY_ANIMATION, dance_number));
}
}
}
}
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-11-2008 08:56
Right now it's listening to everybody and everything chatting on that channel. Where it says:

llListen(chat_channel, "", NULL_KEY, "";);

try changing it to

llListen(chat_channel, "", llGetOwner(), "";);

Now each HUD will only listen for dialog responses from its owner. Should fix you up.
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/

msw Tomorrow
Registered User
Join date: 19 Sep 2007
Posts: 23
It worked!
05-11-2008 09:55
TY, works like a charm... TY again, much appreciated.
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-11-2008 10:23
Oops one other thing... listening for owner doesn't automatically update to start listening to the new owner if you sell it or give it away, it'll keep listening to *you* until the script is reset. So you might add something like this in your changed event handler:

if(change & CHANGED_OWNER)
llResetScript();

Either that or add an on_rez handler and reset there.
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/

msw Tomorrow
Registered User
Join date: 19 Sep 2007
Posts: 23
Thank you
05-11-2008 10:32
Yes I did find that out LOL and had them do a reset. It worked fine... I am a bit of a novice, like I said dangerous... where in the script would I put the reset snippet? That would make life easier for sure. TY
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
05-11-2008 11:16
Simplest way would be to add it right under your other changed() thingy, so it would look like this:

if(change & CHANGED_INVENTORY)
llResetScript();
if(change & CHANGED_OWNER)
llResetScript();

There are other ways to do it but that way keeps it simple and easy to read - if Thing A happens, reset, oh by the way if Thing B happens reset too lol
_____________________
Designer of sensual, tasteful couple's animations - for residents who take their leisure time seriously. ;)

http://slurl.com/secondlife/Brownlee/203/110/109/

msw Tomorrow
Registered User
Join date: 19 Sep 2007
Posts: 23
Thanks again....
05-11-2008 12:44
TY... Try it later.