I was looking at the AvatarCycle script recently in attempt to learn a bit of scripting, but as usual, I failed.
Can anyone tell me what to change here to make it auto-cycle between avatar favorites and use the given key to only turn it on and off?
$avatarplace = -1;
$AvatarNum = -1;
function logavatarsaves() {
$AvatarNum = -1;
for(%i = -1; %i <= 9; %i++)
 if(isfile("base/config/client/AvatarFavorites/" @ %i @ ".cs"))
  $AvatarList[$AvatarNum++] = %i;
}
logavatarsaves();
function cycleavatars(%val) {
if(%val) {
 $avatarplace++;
 if($avatarplace > $AvatarNum) $avatarplace = 0;
 exec("base/config/client/AvatarFavorites/" @ $AvatarList[$avatarplace] @ ".cs");
 clientcmdupdateprefs();
}
}
if (!$avatarcyclebind)
{
$remapName[$remapCount] = "Cycle Saved Avatars";
$remapCmd[$remapCount] = "cycleavatars";
$remapCount++;
$avatarcyclebind=true;
}
moveMap.bind(keyboard, "v", cycleavatars);