Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Operating one linked prim by touching another

Zephyrin Zabelin
Registered User
Join date: 10 May 2007
Posts: 153
05-30-2007 01:42
I have been making table lamps that can be turned on and off by touch, and so far the lampshade has been doubling as the light source. For the sake of acheiving a different appearance, I now wish to make some with actual light bulbs which will be covered by the shade so it would be hard to touch them. What is the generally accepted best or fastest way to let one prim (or all prims, it doesn't matter) in a linked group to know another has been touched?
Ee Maculate
Owner of Fourmile Castle
Join date: 11 Jan 2007
Posts: 919
05-30-2007 02:05
llMessageLinked would work..... when the prim you want touched is touched it can send a message to the bulb at the correct link number.

http://rpgstats.com/wiki/index.php?title=LlMessageLinked
Zephyrin Zabelin
Registered User
Join date: 10 May 2007
Posts: 153
05-30-2007 03:13
Cheers :)
Milambus Oh
Registered User
Join date: 6 Apr 2007
Posts: 224
05-30-2007 05:47
http://lslwiki.net/lslwiki/wakka.php?wakka=llSetLinkPrimitiveParams

Or you could use llSetLinkPrimitiveParams to remotely alter the light status of the bulb from the shade itself, therefor cutting down on the number or scripts that you need and most likely reducing lag by a small amount.
Zephyrin Zabelin
Registered User
Join date: 10 May 2007
Posts: 153
05-30-2007 05:58
Upon further experimentation, using my existing two-prim lamps, I find in fact I can turn them on touching either of the prims, without any additional coding. I put the on_touch lighting event on the lampshade prior to linking them, but when selecting and going to edit, the script does not seem to show any clue about which primitive it is running on - or is this a silly thing to say because a script runs on an object as a whole, not on a primitive?

That would seem to mean, like you say Milambus, that the lamp is touched and the on_touch just needs to set one prim in the group to become the light source. That just leaves me with the question about the reference number of a particular primitive. The lead prim, which is the last selected during grouping, is 1. The example only went as far as a two-prim group where the non-lead prim was #2. In a group of more than two prims, are they numbered in reverse order of selection? Or some other criteria?
Marcush Nemeth
Registered User
Join date: 3 Apr 2007
Posts: 402
05-30-2007 10:16
1) They are numbered in reverse order
2) If a child-prim has no touch event defined in a script inside it, then the touch-event is passed to the rootprim. So it would be possible, to make the actual bulb your root-prim, so touching any other part of the lamp would turn it on.
Zephyrin Zabelin
Registered User
Join date: 10 May 2007
Posts: 153
05-30-2007 10:32
Aha this just gets easier and easier, many thanks :)