Ok, I started over with what Innula posted, and added what Qie said I needed. Still nothing happening on a left click.
Here is what it looks liek now:
integer counter;
integer max;
list animations;
string previousAnim ="standing";
string newAnim;
default
{
state_entry(){
max = llGetInventoryNumber(INVENTORY_ANIMATION);
counter =0;
do {
animations+=[llGetInventoryName(INVENTORY_ANIMATION,counter)];
}
while (++counter<max);
counter =0;
max = llGetListLength(animations);
}
attach(key attached)
{
llRequestPermissions(attached, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions(integer permissions)
{
llTakeControls(CONTROL_ML_LBUTTON, TRUE, FALSE);
}
control(key id, integer held, integer change) {
integer pressed = held & change;
integer down = held & ~change;
integer released = ~held & change;
integer inactive = ~held & ~change;
if (pressed & CONTROL_LBUTTON){
newAnim = llList2String(animations,(counter%max));
if(llGetPermissions()&PERMISSION_TRIGGER_ANIMATION){
llStartAnimation(newAnim);
llStopAnimation(previousAnim);
previousAnim=newAnim;
++counter;
}
}
}
}