Code: Select all
// Original script by Christos Starling of Fantasia - "the FoxBox ^.^" - Free to use, copy, give away, learn from, reference, etc. so long as this header block remains unaltered and attached. Selling this script in whole or in part ANYwhere is a violation of karma, the GNU, and international copyright law.
//Disclaimer
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Created by the FoxBox ^.^ for the Opensim grid Pseudospace, this AO was developed to be quite versatile, and as "low load" as possible for the Opensim environment. It comes packaged with an assortment of animations meant mostly for demo purposes, feel feel to replace what you don't want to use, and keep what you wish.
To setup your AO, you should begin by collecting all your animations in a folder, including your desired walk, and various standing, sitting, dancing, and 'special' animations (special being whatever you might wish to spontaneously play that isnt a sit or dance).
I recomend rezzing a copy of your AO on the ground to set it up. It will request perms to animate you when you do, which wont happen when you attach it to your HUD later.
Edit it, contents tab, dump in your folder of animations. Now open the actual script, and follow the line by line instructions to change/add your animations to the correct lists, and alter the variables if you wish.
Once done, save the script and make sure there are no errors. Be careful to follow the proper list formats ["animName","moreAnims"];
I went with hard-coding rather than the usual settings notecards to reduce as much sim-load as possible on compiling because OpenSim sims recompile a script every time you cross a sim boundary!
Once the script saves correctly, close edit and take the copy of the AO you rezzed. Now right click and select "attach to HUD" and choose a suitable location (I use lower left). Due to a vis bug, the top half of the AO may not show up until you touch the AO. You will probably need to edit the AO while worn on your screen the first time to drag it to a good spot. Once you do this, it should remember the spot. Now simply unwear it, then rewear by right clicking and choosing "wear".
The AO should start up on attach, and begin animating your stands in a few seconds. Pretty much the standard AO operation with a few nice pluses:
You can click the AO for a menu of your sits, dances, and special poses. Playing either of these disables the stand timer and you can cancel the playing pose by selecting STOP or simply by taking a step.
Another plus is that the AO auto-disables anytime you sit on a prim or poseball and auto-reactivates when you get off of it (when you hop off a poseball or prim, your avatar will think it's "falling", not "standing" until you take a step. So move a tad and this will let the AO resume its normal functions).
As a final plus, the Pseudo AO should not interrupt playing gestures, including the cursed typing animation >.<
Have fun :D
Code: Select all
// Original script by Christos Starling of Fantasia - "the FoxBox ^.^" - Free to use, copy, give away, learn from, reference, etc. so long as this header block remains unaltered and attached. Selling this script in whole or in part ANYwhere is a violation of karma, the GNU, and international copyright law.
//Disclaimer
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
// ***Simply go line by line to edit these lists and variables as explained below.***
// Put the EXACT name of your walk anim here, and put the animation itslef in the AO's contents.
string sWalk = "sexywalk";
// List your standing animations, and put them in the AO's contents. You can have up to 12 different standing poses!
list lStands = ["Cross Leg Stand","static stand"];
// Number of seconds between changing standing anims.
float fStand = 20;
// Number of seconds to stand before overriding default stand anim.
float fDelay = 5;
// Dont edit this.
list lCats = ["STOP"," - ","*Cancel*","Sits","Dances","Specials"];
// Now list the animations that belong to each catagorie. You can have 11 in each ("*Cancel*" + 11 animations, for a total of 12 in each). Dont exceed that or it will break, and be sure to put the actual animations in the AO's contents!
list lSits = ["*Cancel*","meditation","pose_sit"];
list lDances = ["*Cancel*","Fluffy","Geek","Lap"];
list lSpecials = ["*Cancel*","boing"];
// BE SURE TO UNWEAR, AND REWEAR YOUR AO AFTER EDITING THIS SCRIPT!
// Dont edit below here.
integer nAO = 1;
integer nChan;
integer nListen;
string sCurAnim;
integer check()
{
list lBasics = ["2408fe9e-df1d-1d7d-f4ff-1384fa7b350f",
"42b46214-4b44-79ae-deb8-0df61424ff4b",
"f22fed8b-a5ed-2c93-64d5-bdd8b93c889f",
"15468e00-3400-bb66-cecc-646d7c14458e",
"370f3a20-6ca6-9971-848c-9a01bc42ae3c"];
lBasics += llGetInventoryKey(sCurAnim);
list lPlaying = llGetAnimationList(llGetOwner());
integer nLength = llGetListLength(lPlaying);
integer x;
for (x=0;x<nLength;x++)
{
if (llListFindList(lBasics,llList2String(lPlaying,x)) == -1)
{
return FALSE;
}
}
return TRUE;
}
stand()
{
if (llGetAgentInfo(llGetOwner()) == 6)
{
if (check())
{
llSetTimerEvent(fStand);
llStopAnimation(sCurAnim);
sCurAnim = llList2String(lStands,(integer)llFrand(llGetListLength(lStands)));
llStartAnimation(sCurAnim);
}
}
}
pose(string sPose)
{
llSetTimerEvent(0);
llStopAnimation(sCurAnim);
sCurAnim = sPose;
llStartAnimation(sCurAnim);
}
default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
list lTemp =llGetAnimationList(llGetOwner());
integer nCount;
for (nCount = 0; nCount < llGetListLength(lTemp); nCount++)
{
llStopAnimation(llList2String(lTemp,nCount));
}
nAO = 1;
llSetTimerEvent(fDelay);
llSetLinkPrimitiveParams(2,[PRIM_COLOR, ALL_SIDES, <0, 1, 0>, 1.0]);
nChan = (integer) (llFrand (1900000000)+1000);
llOwnerSay("(private msg) AO Activated");
}
on_rez(integer num)
{
llResetScript();
}
touch_start(integer num)
{
string sButton = llGetLinkName(llDetectedLinkNumber(0));
if (sButton == "On_Off" && nAO == 1)
{
nAO = 0;
llSetTimerEvent(0);
llStopAnimation(sCurAnim);
llSetLinkPrimitiveParams(2,[PRIM_COLOR, ALL_SIDES, <1, 0, 0>, 1.0]);
llOwnerSay("(private msg) AO Deactivated");
}
else if (sButton == "On_Off" && nAO == 0)
{
nAO = 1;
llSetTimerEvent(fDelay);
llSetLinkPrimitiveParams(2,[PRIM_COLOR, ALL_SIDES, <0, 1, 0>, 1.0]);
llOwnerSay("(private msg) AO Activated");
}
if (sButton != "On_Off" && nAO == 1)
{
nListen = llListen(nChan,"",llGetOwner(),"");
llDialog(llGetOwner(),"Choose a catagory or Cancell",lCats,nChan);
}
}
listen(integer chan, string name, key id, string msg)
{
if (msg == "STOP")
{
llListenRemove(nListen);
llStopAnimation(sCurAnim);
llSetTimerEvent(fDelay);
}
if (msg == "*Cancel*" || msg == " - ")
{
llListenRemove(nListen);
}
if (llListFindList(lCats,[msg]) != -1)
{
if (msg == "Sits")
{
llDialog(llGetOwner(),"Choose a Sit or Cancel",lSits,nChan);
}
if (msg == "Dances")
{
llDialog(llGetOwner(),"Choose a Dance or Cancel",lDances,nChan);
}
if (msg == "Specials")
{
llDialog(llGetOwner(),"Choose a Special Pose or Cancel",lSpecials,nChan);
}
}
if (llListFindList(lSits,[msg]) != -1 || llListFindList(lDances,[msg]) != -1 || llListFindList(lSpecials,[msg]) != -1 && msg != "*Cancel*")
{
llListenRemove(nListen);
pose(msg);
}
}
timer()
{
stand();
}
changed(integer change)
{
if (nAO == 1)
{
//llOwnerSay((string)llGetAgentInfo(llGetOwner()));
if (llGetAgentInfo(llGetOwner()) == 54 ||
llGetAgentInfo(llGetOwner()) == 4102 ||
llGetAgentInfo(llGetOwner()) == 263 ||
llGetAgentInfo(llGetOwner()) == 262)
{
//on object,running,flying,in-air
llSetTimerEvent(0);
llStopAnimation(sCurAnim);
}
if (llGetAgentInfo(llGetOwner()) == 134)
{
//walking
llSetTimerEvent(0);
llStopAnimation(sCurAnim);
sCurAnim = sWalk;
llStartAnimation(sCurAnim);
}
if (llGetAgentInfo(llGetOwner()) == 6)
{
//standing
llStopAnimation(sCurAnim);
llSetTimerEvent(fDelay);
}
}
if (change & CHANGED_REGION)
{
llResetScript();
}
}
attach(key id)
{
integer nPerm = llGetPermissions();
if (id != NULL_KEY)
{
if (! (nPerm & PERMISSION_TRIGGER_ANIMATION))
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
else
{
if (nPerm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation(sCurAnim);
}
}
}
}