Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

hud activated sit animation? Plz help

LeVey Palou
Registered User
Join date: 31 Aug 2006
Posts: 131
05-20-2007 08:37
Scripting is not my friend, but i am trying!

I am making a hud attachment and i need a button on it that activates an animation. The hud is a texture and the buttons are invisible prims. So I am figuring animation goes into the "prim button" and I need a touch script to activate the animation.

I am not a scripter but Guys I am trying...lol. This is what i have so far. The syntax is off, i am getting errors, and I am not even sure if this is the right direction.

Plz advise:
***********************

default
{
touch_start(integer total_number)
{
llStopAnimation("sit";);
llStartAnimation("MaleKneel";)

}
}

************************

Any help would be appreciated

Thanks in advance
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
05-20-2007 08:49
Looks like areasonable approach.

You are missing a semicolon:

llStartAnimation("MaleKneel";);

You might also want to look into:

llRequestPermissions(g_Agent, PERMISSION_TRIGGER_ANIMATION );
LeVey Palou
Registered User
Join date: 31 Aug 2006
Posts: 131
05-20-2007 09:00
Thank you RJ,

ok, so after hunting in the wiki i found a script that made use of the "perm" statement and adding it it now looks like this:

******************

default
{
touch_start(integer total_number)
{
if (llGetAttached ())
{
if(llGetOwner() == llDetectedKey(0))
{
llRequestPermissions (llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}
}
}
run_time_permissions(integer perm)
{
if (PERMISSION_TRIGGER_ANIMATION & perm)
{
llStopAnimation("sit";);
llStartAnimation("MaleKneel";);




}
}
}

****************


Ok, and this works great! Prim attached to hud when touched triggers the avi to sit.

However, until prim is removed avi continues to sit and i cant get him up again (without dettaching prim from hud).

So, I am assuming there needs to be a new state? one that tells the avi what to do when action is cancelled? and also a way to tell it the action was cancelled in first place?


Again thanks for any advise... I am learning
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
05-20-2007 12:13
Yeah it seems SL really needs the agent to always be running some animation. Stopping an animation, without giving it a new one, seems to just keep playing the old one (though maybe this is affected by priorities - I'm not sure there).

Anyway, a couple things to try when you stop the old animation:

1) Start the animation "stand" if you want them to just stand there.
2) I've heard giving the agent a little "push" can get SL to reassign them some animation (like walk or stand) but I haven't tried that.
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
05-21-2007 07:31
You were half way there, just add another state that you switch to for when it is on:

CODE
default
{
state_entry() {
llRequestPermissions (llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}

run_time_permissions(integer perm) {
if (PERMISSION_TRIGGER_ANIMATION & perm) {
llStopAnimation("MaleKneel");
}
}

touch_start(integer total_number) {
if (llGetAttached ()) {
if(llGetOwner() == llDetectedKey(0)) {
state sitting;
}
}
}


}

state sitting {
state_entry() {
llRequestPermissions (llGetOwner(), PERMISSION_TRIGGER_ANIMATION);
}

run_time_permissions(integer perm) {
if (PERMISSION_TRIGGER_ANIMATION & perm) {
llStopAnimation("sit");
llStartAnimation("MaleKneel");
}
}

touch_start(integer total_number) {
if (llGetAttached ()) {
if(llGetOwner() == llDetectedKey(0)) {
state default;
}
}
}
}