I need a blink script for a pet I made, which has two eyes on two separate prims. I've used a blink script for another project before, but that worked by loading the eyes open/eyes closed textures every time, and you could see the reload every so often, which I found annoying.
So I decided to try texture animation. My problem with that was that I wanted 4 frames max, to keep my texture quality good. If I just ran through the texture, of course either the eye would blink constantly or it would stay closed for a long time, because of the limited number of frames.
Then I found the following open source blink script that I'm pasting below. For some reason, and I'm not sure why, it makes the eye stay open longer despite the limited frames in my texture. This script was designed for avatars though and has all kinds of avatar related features that I don't need. It detects if you're afk among other things. I'm wondering if anyone knows how to 'clean up' this script, take out everything avatar related that I don't need. With all the stuff in the script right now I don't know what exactly is causing the texture animation to be what it is. (And I'd like to tweak it.)
(I'd also be very grateful if someone could tell me how to link the two eyes. I have absolutely no scripting knowledge. I know I'm asking a lot, but people are always friendly on here so I thought I'd try

// Blinke Script Open Source
// Redesigned Blink Script (DG) to incorporate manual eye opening
// Author: Zombie Pye
// This script is open source! Distribute the basic version of this at your leisure. Usable in avatars intended for sale. You may remove the permissions for modified versions of this script. Do not resell the script itself in any form!
// The first line within the listen event causes the object to respond to other objects owned by the same owner. This makes this script HUD compatible: just have it say the eye open/close command on touch. By default, it listens to channel 50.
// Note the eyes also close when AFK or Busy. The commands are (case sensitive): "eyes open", "eyes rest", "eyes squint", "eyes close"
integer blink = TRUE;
integer eyes;
integer length;
default
{
on_rez(integer sparam)
{
llResetScript();
}
listen(integer ch, string name, key id, string msg)
{
if(llGetOwnerKey(id) == llGetOwner())
{
if(msg == "eyes open"

{
eyes = 0;
length = 0;
blink = TRUE;
}
if(msg == "eyes rest"

{
eyes = 1;
length = 3;
blink = TRUE;
}
if(msg == "eyes squint"

{
eyes = 2;
length = 2;
blink = TRUE;
}
if(msg == "eyes close"

{
blink = FALSE;
llSetTextureAnim(ANIM_ON, ALL_SIDES, 2, 2, eyes, length, 12);
}
}
}
state_entry()
{
llListen(50,"", "", ""

llSetTimerEvent(.1);
}
timer()
{
integer info = llGetAgentInfo(llGetOwner());
if(info & AGENT_AWAY)
{
blink = FALSE;
llSetTextureAnim(ANIM_ON, ALL_SIDES, 2, 2, eyes, length, 12);
state noblink;
}
if(blink)
{
{
llSetTextureAnim(ANIM_ON, ALL_SIDES, 2, 2, eyes, length, 12);
llSetTextureAnim(ANIM_ON | REVERSE, ALL_SIDES, 2, 2, eyes, length, 12);
llSetTimerEvent(5 + llFrand(5));
}
}
}
}
state noblink
{
state_entry()
{
llSetTimerEvent(.5);
}
timer()
{
integer agentinfo = llGetAgentInfo(llGetOwner());
if(~agentinfo & AGENT_AWAY)
{
llSetTextureAnim(ANIM_ON | REVERSE, ALL_SIDES, 2, 2, eyes, length, 12);
blink = TRUE;
state default;
}
}
}