Tuesday, February 16, 2010

Messaging Prims in OpenSim (lsl)

I just had a big realization about how to make a lot possible in scripting prims with LSL in OpenSimulator. A great way to get prims to play off of each other is to have them send messages to each other on specific channels. This capability makes OpenSimulator and Second Life pretty special environments for network simulations, but that's another topic. What I have done so far with this is make a button that opens and closes curtains on a stage, and clothes that pack themselves when touched. In the first example, you can see the two scripts, the button on the left (the red button itself behind its script), and one of the curtains on the right. Both curtains can listen for the button's message and more than one button can be placed around the stage for easy access.

For the second example, the clothes message the suitcase, which responds with its position so the clothes know where to move. One piece of clothing is shown on the left and the suitcase is on the right. I thought there would be some way to dynamically update the suitcase's position for the clothes and this is it. It gets a little more complicated because there are three pieces of clothing, requiring three different messages from the clothes and three different reply channels depending on which message is received by the suitcase.

No comments :