Jump to content
  • 0

how to get prims to communicate with another prim?


JJ Paragorn
 Share

You are about to reply to a thread that has been inactive for 4129 days.

Please take a moment to consider if this thread is worth bumping.

Question

6 answers to this question

Recommended Posts

  • 0

1. Create a prim.

2. Use your Build/Edit menu and open the Contents tab of the prim.

3. Click New Script.  That will create (tada!) a new script that says "Hello, Avatar!" when you click on the prim.

4. Find the line after touch_start in the script that says llSay(0,"Hello, Avatar!"); and change it very slightly to say llSay(-47,"Hello, Avatar!");

5.  Click Save.  That will create a script that communcates on channel -47.  Now all you need is a script to hear it. So, ...

6.  Repeat steps 1-3.

7. Find the line after state_entry that says llSay(0,"Hello,Avatar!"); and replace it with llListen(-47, "","","");

8. Find the line that says touch_start (integer total_number) and replace it with listen (integer channel, string name, key id, string message)

9. Find the line after that that says llSay(0,"Hello, Avatar!"); and replace it with llSay(0,message);

That will do it.  You can change the message in the first script so that it doesn't say "Hello, Avatar!", of course, and you can make both scripts more complicated once you learn how to write your own scripts.  Just pay very close atention to spelling, capitalization, and punctuation.  They must be exact or the scripts will fail.  Aslo, keep the two prims within 20m of each other (the normal range for typed chat).

For an introduction to LSL scripting, see  http://wiki.secondlife.com/wiki/Getting_started_with_LSL .  Welcome to the wonderful world of scripting.  :smileyhappy:

EDITed a couple of times to remove my inevitable typos.  :smileytongue:

  • Like 1
Link to comment
Share on other sites

  • 0

No, there should only be one message sent and received each time someone clicks the first object. The sending script is speaking on channel -47 and the receiving script is speaking on the public chat channel. Its message will not be heard by anyone but avatars within 20m, so thre shouldn;t be any "awash". Now, it IS true that a well-written version of this script would have a way to kill the llListen after a while, but I figured that was more trouble than it was worth -- and more confusing -- for a simple demo.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4129 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...