Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scripts for verbal animation changes?

Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
09-17-2004 10:57
I am still trying to figure out all the scripting business. I have accomplished a lot I feel, but my new project is to create an object that changes animations through typing in commands instead of just clicking on the object. I would appreciate a little help if anyone feels like it. Maybe by giving me some suggestions for what functions to use. Well, I will look forward to some advice.


Thanks In Advance,
Alex
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-17-2004 12:07
Before you try that, click on your gestures in your inventory and activate them. Then go to Control G for gestures, because you can auto trigger some animations just by typing the word in a sentence as you speak.

If you do not like the animation, or you find that an animation has a female voice for you, and you prefer a male, (or the other way for you females) you can edit and change the sound, the animation, the text used, and even what the trigger will be when you type it. It's pretty cool!
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
09-17-2004 12:14
I never thought of that, but I also want to script an object to do this. Something that I want to take on and try to figure out. I tend to learn things the hard way lol.
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-17-2004 12:31
Oh don't get me wrong, there are plenty of good reasons for doing just what you are saying. The Dance Bracelets come to mind. :D
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
09-17-2004 14:03
Use the listen() event rather than the touch one.
_____________________
</sarcasm>
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
09-20-2004 07:47
I got it. Thanks for the help.
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-20-2004 07:57
By the way, you might want to use channel 1 to talk to your device to send commands without someone else hearing. Use channel one with a command like dance...

/1 dance

(from the chat window) No one will hear you, and your device can interpret that command and perform whatever animations or sounds you program to correspond.

Check out the wiki for Communications you can see how to do that there.
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
09-20-2004 13:28
Samhain,

That is some really good info. I kind of stumbled across that yesterday and impressed myself. I really do appreciate the imput and if there is anything that I can help you with please don't hesitate to ask.



Thanks,
Alex
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
Need a little script help
09-21-2004 12:01
I took this start animation script from Wiki. I managed to modify it to some of my needs. I tried to modify it with llAvatarOnSitTarget, but got quickly confused. I looked around Wiki and couldn't find a clear explaination on how to combine codes in a script. I want to put this script in a chair and switch animations verbally without attaching a prim. I also need to get rid of TOUCH option. If anyone would mind helping me out, it would be greatly appreciated. I am truely lost.

Thanks In Advance,
Alex



////////////////////////////////////////////
// Animation Script v1.2.1
//
// Written by Xylor Baysklef
////////////////////////////////////////////

/////////////// CONSTANTS ///////////////////
list ANIMATIONS = [ "1", "2 ];

list ANIMATIONS2 = [];
///////////// END CONSTANTS /////////////////

///////////// GLOBAL VARIABLES ///////////////
//integer gToggle = 0;
integer gAnimNumber;
integer gTotalAnims;

string gAnimName = "type";
/////////// END GLOBAL VARIABLES /////////////

default {
state_entry() {
//llSay(0, "Init...";);
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);

ANIMATIONS += ANIMATIONS2;
ANIMATIONS2 = [];

gTotalAnims = llGetListLength(ANIMATIONS);
gAnimNumber = -1;
llListen(0, "", llGetOwner(), "";);
}

on_rez(integer param) {
//llGiveInventory(llGetOwner(), "Animation Names";);
llResetScript();
}

listen(integer channel, string name, key id, string mesg) {
string preamble = llGetSubString(mesg, 1, 3);
if (preamble != "anim" && preamble != "stop";)
return;

integer perm = llGetPermissions();

if ( !(perm & PERMISSION_TRIGGER_ANIMATION)) {
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
return;
}

list parsed = llParseString2List(mesg, [ " " ], []);
//llSay(0, (string)parsed);

string anim = llList2String(parsed, 1);

if (preamble == "stop";) {
//llSay(0, "Stopping: " + llGetAnimation(llGetOwner()));
//llStopAnimation(llGetAnimation(llGetOwner()));
if (anim == "";)
anim = gAnimName;

if (anim == "all";) {
integer i;
llSay(0, "Stopping all animations... please wait.";);
for (i=0; i<gTotalAnims; i++)
llStopAnimation(llList2String(ANIMATIONS, i));

llSay(0, "Done.";);

return;
}

//llSay(0, "Stopping: " + anim);
llStopAnimation(anim);
return;
}

gAnimName = anim;
//llSay(0, "Animation: " + gAnimName);
llStartAnimation(gAnimName);
}

run_time_permissions(integer perm) {
//llStopAnimation(gAnimName);
//gToggle = 0;
}

attach(key id) {
integer perm = llGetPermissions();

if (id != NULL_KEY) {

if (! (perm & PERMISSION_TRIGGER_ANIMATION)) {
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
else {

if (perm & PERMISSION_TRIGGER_ANIMATION) {
llStopAnimation(gAnimName);
}
}
}

touch_start(integer total_number) {
if (llDetectedKey(0) != llGetOwner())
return;

integer perm = llGetPermissions();

if (perm & PERMISSION_TRIGGER_ANIMATION) {
if (gAnimNumber != -1) {
llStopAnimation( llList2String(ANIMATIONS, gAnimNumber) );
}


gAnimNumber++;
if (gAnimNumber == gTotalAnims)
gAnimNumber = 0;

gAnimName = llList2String(ANIMATIONS, gAnimNumber);

llStartAnimation( gAnimName );
llSay(0, "Animation: " + gAnimName);
}
else {
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
}
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-21-2004 12:39
I've cleaned the code up from it's appearance here, and have sent myself a copy. When I get home tonight I will play with it a little.

I have a few things that take a higher priority, but will see what I can do, if anything.
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
09-21-2004 13:23
Samhain,

I thought that it seemed a little messy. Especially when I pasted it to my post. All of the Global Variables kept throwing me off. I appreciate the help. If you come up with something I will definately owe you a big one.



Alex
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
This script is wearing me out. $$$$$$$
09-23-2004 07:54
I made it do pretty much what I want, but now I need it looped. I have been working on it for weeks. I am getting tired and need it badly. I am willing to pay anyone who wants to write it for me. I need 2 of them written actually, so if anyone wants to make some $$$$$ please let me know.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-23-2004 08:26
i'll make one for you when i get home, could you post exactly what you want.

I take it you want a script that changes animations when you speak commands while you are sitting on the object. Have i got it right?
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
What I am looking for.
09-23-2004 10:48
Strife,

All I want is a script that animates by command, no touch, while sitting. The one I modified does that, but you can only cycle through the animations one time. I want to be able to go back and forth.

Also one that will do the same but animate another AV.


Please let me know if you need anymore information and how much both will cost me.



Thanks,
Alex
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
09-23-2004 18:30
when you say animate another av, what do you mean? Do you mean that you want to have a chair, have multiple people sitting on that object, and each one able to change their animations? Do you mean you want some one to be able to say, dance me, and then the object animates them? Or do you mean you want to say animate bob, and cause your object to ask the other person if it has permission to fallow your animations? Or do you mean you want some one else able to sit on your chair, and you can say dance?
Alex Farber
Registered User
Join date: 5 Feb 2004
Posts: 82
09-24-2004 20:50
I want to put them in a throne. I want full control of the script so that I can play with it and do what I please with it. I want to be able to add plenty of custom animations in it.