Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script error AFTER the script works?

Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-25-2009 13:59
This script works. Click "Sit", and I go where I want, and the animation works, it's good. Except... When I stand up again, I get a script error about permissions not set. Anyone have any ideas?

CODE


key avatar;
vector pos = < 0.0,0.0,1.0>;
rotation rot = < 0.0,0.0,0.0,0.0>;

default
{
state_entry()
{
llSitTarget(pos, rot);
}
changed(integer change)
{
avatar = llAvatarOnSitTarget();
if(change & CHANGED_LINK)
{
if(avatar == NULL_KEY)
{
// You have gotten off
llStopAnimation("demure");
llReleaseControls();
llResetScript();
}
else if(avatar == llAvatarOnSitTarget())
{
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION );
}
}
}
run_time_permissions(integer perms)
{
if(perms)
{
llStopAnimation("demure");
llStartAnimation("demure");
}
else
{
llUnSit(avatar);
}
}
}

_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-25-2009 14:21
you can't stop the sit when they get up, because you lose permission to do so when that happens
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
07-25-2009 14:23
For starters, try changing the line

else if(avatar == llAvatarOnSitTarget())

to simply say "else." After all, you set avatar = llAvatarOnSitTarget() a few lines earlier so the if test you wrote will always evaluate to TRUE.

I'm not sure why you have a llRelease Controls line in the script. It's also not clear to me why you stop and then immediately start the same animation in your run_time_permissions event.

ETA: And what she said. :)
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-25-2009 14:33
To be honest, I stole this script from the library and started modifying it.
_____________________
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
07-25-2009 14:38
From: Paul Wardark
To be honest, I stole this script from the library and started modifying it.

Thats the way we all start learning :) Before you know it you will become addicted and still be typing code wearily at 3 AM like the rest of us.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
07-25-2009 14:58
Try this ...

CODE

changed(integer change)
{
avatar = llAvatarOnSitTarget();
if(change & CHANGED_LINK)
{
if(avatar == NULL_KEY)
{
// You have gotten off
integer perm=llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("demure");
}
else
{
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION );
}
}
}
}
run_time_permissions(integer perms)
{
if(perms & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation("demure");
}
else
{
llUnSit(avatar);
}
}
}
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
07-25-2009 15:04
Yes, you _can_ normally stop animations after standing, and that script (only a different animation plugged in) works without error for me.

There is actually a JIRA entry exploring if permissions should be revoked on stand, but it's just a discussion now: https://jira.secondlife.com/browse/VWR-13228

You won't normally lose the permission at stand time, but _can_ run into trouble if the avatar ends up missing or in a different region, for example when logging out or teleporting before standing (if you aren't doing those, are you on a region boundary or something, or using a nonstandard viewer that tries to monkey with revoking permissions?).

To make the stop resistant to those problems, you can use:

CODE

// You have gotten off
if (llGetAgentSize(llGetPermissionsKey())) {
llStopAnimation("demure");
}
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-25-2009 15:26
Thanks, I think I got it.
_____________________
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-25-2009 15:51
From: Viktoria Dovgal
Yes, you _can_ normally stop animations after standing, and that script (only a different animation plugged in) works without error for me.]

::smacks forehead... Imma quit answering questions for today, I keep misremembering things =(
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
07-25-2009 17:26
That's get away from the computer time, then!!! LSL melts brains, it's the only thing it does 100% consistently.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-26-2009 05:33
From: Viktoria Dovgal
That's get away from the computer time, then!!! LSL melts brains, it's the only thing it does 100% consistently.

no, I can guarantee that reading and decoding unknown file formats in a hex editor will do it too...and much faster
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
07-26-2009 06:25
From: Viktoria Dovgal
Yes, you _can_ normally stop animations after standing, and that script (only a different animation plugged in) works without error for me.
There seems to be some timing dependencies, because I've had errors doing that too. Maybe it depends on what prim or event you stop the animation in.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore