Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

activate 2 scripts when wearing item

Orson Oceanlane
Registered User
Join date: 16 Oct 2007
Posts: 4
08-21-2008 04:44
I'm trying to make a bracelet that when worn will activate a poofer script and a default "New Script" for the chat entry.

Whenever i wear the object, nothing happens. I have to right click it and go into edit. Then use tools - reset scripts in selection, and they both trigger. But whenever I just wear the object, nothing happens. Anyone any idea where I'm going wrong?
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
08-21-2008 04:46
Are you using on_rez or attach events in these scripts so they know when to trigger?
_____________________
Orson Oceanlane
Registered User
Join date: 16 Oct 2007
Posts: 4
08-21-2008 04:50
i guess not since I never saw them in there. The poofer script is just the one i got from particle laboratory. And the chat one is the standard "New Script" one
Orson Oceanlane
Registered User
Join date: 16 Oct 2007
Posts: 4
08-21-2008 05:00
the bracelet attaches itself to the correct postion, but the scripts don't run. I don't mind if they don't run if you just rez it on the ground, but I do want them to run when you wear it
Viktoria Dovgal
Join date: 29 Jul 2007
Posts: 3,593
08-21-2008 05:08
OK, that's one of the things that surprises people the first time they dig into LSL =) Scripts are suspended (kind of like a computer in sleep mode) when you take them into inventory, so the next time you rez or attach them, they pick up where they left off.

For the default script, your object should still say "Touched" if you click on it. the "Hello, avatar!" part is inside state_entry, so it's normal for that not to show up on attach.

Wiki pages to peek at:
http://wiki.secondlife.com/wiki/Attach
http://wiki.secondlife.com/wiki/On_rez

There are little examples on those pages that you can play with, so you can get an idea of how to perform surgery on your own scripts.

on_rez often the one people want for poofy kinds of things, because it triggers on a regular rez, attaching, or relogging with an already-worn attachment. The attach event happens when you put on or take off the object.

You can use llGetAttached() in on_rez() or state_entry() to make things happen only if attached, if you don't want something tied only to the act of putting on or taking off.

You'll also want tohave a look at the FAQ for new scripters:
/54/46/121753/1.html
_____________________
Orson Oceanlane
Registered User
Join date: 16 Oct 2007
Posts: 4
08-21-2008 05:19
Viktoria, you're fantastic. The on_rez one worked a treat
Thanks