I hope someone can help me with a script i made.
What i try to build is when someone touch the danceball, the danceball check if that person is
on the list.
if NO then the person will be added to the list and start dancing and sent a short particle stream to that person.
if Yes then the person will be deleted from the list and stop dancing.
most of the script is working but there is something wrong in the stop part of the script.
If i test it with 1 person it works but with several persons sometimes the stops works and sometimes not and i can't find what i have done wrong.
((<CODE>
list NamesDetected;
string NewName;
string Dance;
string DanceAnim;
key AvatarKey;
integer index;
MakeParticles()
{
llParticleSystem(
[
PSYS_PART_FLAGS,
PSYS_PART_TARGET_POS_MASK |
PSYS_PART_EMISSIVE_MASK,
PSYS_SRC_TARGET_KEY, AvatarKey,
PSYS_PART_START_SCALE, <.25,.25, 0>,
PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_DROP,
PSYS_SRC_TEXTURE, "Heart",
PSYS_SRC_BURST_SPEED_MIN, 2.0,
PSYS_SRC_BURST_SPEED_MAX, 2.0,
PSYS_PART_MAX_AGE, 3.0,
PSYS_SRC_BURST_PART_COUNT, 1,
PSYS_SRC_BURST_RATE, 0.25
]);
}
default
{
state_entry()
{
DanceAnim=llGetInventoryName(INVENTORY_ANIMATION,0);
llTargetOmega(<0,0,0.1>,2*PI,1.0);
}
touch_start(integer total_number)
{
AvatarKey= llDetectedKey(0);
NewName=llDetectedName(0);
index = llListFindList(NamesDetected, [NewName] );
if (index != -1)
{
//Found name on list
NamesDetected=llDeleteSubList(NamesDetected, index, index);
Dance="Off";
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
}
else
{
//Didn't find name on list
NamesDetected=NamesDetected +[NewName];
Dance="On";
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
if(DanceAnim == ""

{
DanceAnim=llGetInventoryName(INVENTORY_ANIMATION,0);
}
if(Dance=="On"

{
llStopAnimation(DanceAnim);
llStartAnimation(DanceAnim);
llSay(0, "Welcome " + NewName);
MakeParticles();
llSetTimerEvent(1.5);
}
else
{
llStopAnimation(DanceAnim);
llSay(0, "Thanks for dancing with us " + NewName);
}
}
}
timer()
{
llParticleSystem([]);
}
}
<CODE>

