Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Script problem

Kume Grant
Registered User
Join date: 30 Aug 2005
Posts: 7
08-28-2006 19:54
I have an "Anim on attach" script that doesn't seem to work when it's in an object with another script. what am I doing wrong?

Here's what happens. if I drop the item, reset the script and wear it directly from the ground it works but it will not animate me when I equip it from the inventory. please help.
HtF Visconti
Registered User
Join date: 21 Jul 2006
Posts: 123
08-29-2006 01:01
Can you post the code? It's a little difficult to analysze without any reference.
SexyEyes Valkyrie
Registered User
Join date: 29 Jan 2004
Posts: 37
08-29-2006 18:38
try on_rez event with llResetScript();
-LW
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
08-29-2006 22:53
From: Kume Grant
I have an "Anim on attach" script that doesn't seem to work when it's in an object with another script. what am I doing wrong?
Is this suggested that it works fine when the object has just the single script?
_____________________
:) Seagel Neville :)
Mevo Syaka
Ganja Guru
Join date: 12 Dec 2006
Posts: 33
07-05-2007 00:18
From: Kume Grant
I have an "Anim on attach" script that doesn't seem to work when it's in an object with another script. what am I doing wrong?

Here's what happens. if I drop the item, reset the script and wear it directly from the ground it works but it will not animate me when I equip it from the inventory. please help.


I am having the exact same problem. Basically whenever someone wears the attachment directly from their inventory on_rez and attach don't function.. Why is this? Is there a way around it? All help is much appreciated!
_____________________
FourTwenty Headshop



Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-05-2007 07:44
Can these scripts be posted, or are they no-mod? The behavior sounds a lot like a missing on_rez() or attach() handler--most likely because the script has transitioned into a state without such a handler.

If the script is no-mod, all hope is not lost, because the object itself is mod (evidenced by the fact the scripts inside can be manually reset). One could write a dopey "helper" script that just calls llResetOtherScript() on the problematic script, from within on_rez() (or, in this case, attach()).
Mevo Syaka
Ganja Guru
Join date: 12 Dec 2006
Posts: 33
07-05-2007 10:06
It's my script. I made it from scratch. It works well but this is a bug. It uses only one state. Simply wearing from inventory will not activate any of the 2. I have tried both on_rez() and attach() I have tried them seperately too.
_____________________
FourTwenty Headshop



Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
07-05-2007 10:33
Is it a single prim, or a linked object? Could it be because attach() only fires in the root prim?
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
07-05-2007 10:42
I suspect that your on_rez event might be doing llResetScript(), which causes the attach() event to be lost. In this case you can simply check for attachment in the state_entry as follows:
CODE

default
{
state_entry()
{
if (llGetAttached())
llOwnerSay("Restarted while Attached.");
else
llOwnerSay("Restarted while Un-attached");
}

on_rez(integer start_param)
{
llResetScript();
}

attach(key id)
{
if (id)
llOwnerSay("Now Attached.");

}
}