Jump to content

Transferring information between prim


Marcin Pang
 Share

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

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

Recommended Posts

Hi, I have a question, as the topic - is it possible to send information between objects and how to do it?

As an example (just for example) - Prim moves from place to place and achieves its purpose, then sends the information to another object (let's say, light), and that light begins to shine. It's about how to send a note to the light.

I do not know, maybe a function that uses the key, etc. Please for your help.

Ps. It would be run under OpenSim.


Link to comment
Share on other sites

Hello, prims can communicate in SL or Open Sim same way.

If they are in the same sim its done via - llRegionSay and llListen

Not the same sim: llEmail or via http (but this functions are maybe not same implemented than in SL).

There are very good examples for this commands in the Wiki.

Hope that helps, Monti

Link to comment
Share on other sites

Look at llRegionSayTo also.  That function makes it possible to send a message to a specific target object or avatar anywhere in the same sim.  With any  communication function you choose, you will always be sending the message as a string variable, so you will need to recast it to a float, integer, vector, or whatever when it it received.

Link to comment
Share on other sites

llRegionSay would help. Previously I did not use this function, but from what I see now is also available under OpenSim:)

In conclusion, I wanted to do the hospital. Something like this:

Patient comes in for an operation -> make him wait

Approaching the end of the previous operation -> message is sent, the next patient comes into the room where it is prepared for operation (eg changing clothes, etc.)

The end of the previous operation -> new patient goes to the operating room

And then everything would be repeated.

I wish it gave the impression of a smooth motion, the best that there were several operating rooms and the patient was sent there, where the operation is coming to an end (there would be some random time operation). Such an efficient mechanism;)

Link to comment
Share on other sites

You can put your variables in a list and convert it to a string with llList2CSV.

The list_cast function in the scripting library can convert your variables back to their original types at the receiving end.  primset in the scripting library forum is an example of how to do this.

 

Link to comment
Share on other sites

Nope, although you can get llSay, llShout, and llWhisper to work across region boundaries if you are within their effective range.  llOwnerSay will also work even across great distances, provided that the message is sent within 45 seconds of the time that you (the owner) leave the sim where the message is sent from.

Link to comment
Share on other sites

  • 2 months later...

My goal is to create a device that would allow my friend to "buzz" me when I'm AFK, so I'll come running back to the computer and see what she is saying in IM.  I would most likely be at my home parcel, and she would be in a sandbox on a different continent.

So, I began searching the internet to see if there was a way for her to click a prim at the sandbox where she builds and have that prim communicate with a prim at my home parcel.  I was hoping that this communication would trigger a gesture that I have activated and create a loud sound to alert me in RL that someone is trying to talk to me in SL.

I then found some information about llEmail where there is something called "prim2prim email".  I don't know if this is what I'm looking for, but the frustrating thing is that I've been given a lot of code, seperated in five different sections, and it's left me clueless on where these sections of code go.  I tried putting the first four sections into a new script and saved it, but I received an error syntax message.  I don't even know if the "central server" is a third prim, or one of the two prims that are communicating with each other.  I am so freaking confused.  The people who understand the script and know how to utilize it are geniuses in their own right, but when it comes to writing instructions they are complete idiots.

The information I got was from this website:

http://wiki.secondlife.com/wiki/LlEmail

At the top of the webpage, there was some code that I did not copy & paste in my script, because I don't think it applies to the prim2prim emails.

string email_address = "somebody@example.com"; // who will receive the messages
 
default
{
    state_entry() {
 
        //Send an email to a normal email account
        llEmail( email_address, "Look it's an email subject line!", "Testing 1 2 3" );
    }
 
    touch_start( integer num_detected ) {
        integer i = 0;
 
        // Send another email, telling who touched the prim.
        do
            llEmail( email_address, "No touching!", "I was defiled by: " + llDetectedName(i) + "\nKey: " + (string) llDetectedKey(i) );
        while(++i < num_detected);
    }
}

and I don't think this applies either.

email( string time, string address, string subj, string message, integer num_left )
{
    if(llGetSubString(address, -19, -1) == "@lsl.secondlife.com")//trim the header
        message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1);
}

but after that there is a part of the webpage that applies specifically to prim2prim emails and there is code divided in five sections.

Section #1

integer divide = llSubStringIndex(message, "\n\n");
string header = llDeleteSubString(message, divide, -1);
message = llDeleteSubString(message, 0, divide + 1);

Section #2

list lines = llParseStringKeepNulls(header, ["\n"], []);
string objname_line = llList2String(lines, 0);
string region_line = llList2String(lines, 1);
string localpos_line = llList2String(lines, 2);

Section #3

string region_name = llStringTrim(
            (string)llDeleteSubList(
                llParseStringKeepNulls(
                    llDeleteSubString(region_line, 0, 12),
                    [], ["("]
                ), -2, -1), STRING_TRIM);

Section #4

string version = "1"; //
string type = "lolcube";
default
{
    on_rez(integer start_param)
    {
        llEmail("5a634b27-f032-283f-2df2-55ead7724b23@lsl.secondlife.com",
            version,
            (string)llGetOwner() + "," + type);
    }
}

Section #5

default
{
    state_entry()
    {
        llSetTimerEvent(15.0);
    }
 
    timer()
    {
        llGetNextEmail("", "");
    }
 
    email( string time, string address, string version, string message, integer num_left )
    {   
        if ((integer)version < 2)
        {
            list info = llCSV2List( llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") + 1));
            llGiveInventory(llList2Key(info,0), llList2String(info,1));
        }
 
        if(num_left)
            llGetNextEmail("","");
    }
}

I am asking for help here from someone with scripting knowledge, an amiable personality, and adequant writing skills to please explain in detail, how many prims I need, who the owners of those prims need to be, and to please copy and paste the entire script for each of those prims, so I won't be lost anymore.  Also, please make sure to bring to my attention the specific parts of the script where I need to enter information.  Thanks in advance.

Link to comment
Share on other sites

You need 2 prims - a sender which will be owned by your friend and a receiver that will be owned by you.  The receiver needs to be permanently rezzed at your home so that it keeps the same UUID.  This UUID has to be written into the sender script as part of the email address.

  • Friend clicks sender (see touch_end() event)
  • Sender sends email to receiver (llEmail() function)
  • Receiver repeatedly (timer() event) polls for emails (llGetNextEmail() function)
  • And plays the sound (llPlaySound() function) when it receives one (email() event)

NB: If you're AFK but not at home none of this will help because you won't be there to hear the sound!

 

  • Like 1
Link to comment
Share on other sites

Ty for the response.  I don't know how I did it, but I figured it out on my own like 1-5 min ago.  I didn't use the llplaysound.  I used the lltriggersound.  I'm not sure which is better.  It seems to work wonderfully.  I'm truly anxious to get a better sound and use this more often.  Yesssssssss!!!!!  So happy!  By AFK, I mean I might be in the kitchen cooking, but I can hear the sound, especially if it is a loud one.  This is my first time making a scripted object.  I've been playing SL for a year, but I'm pretty much still a noob.

Link to comment
Share on other sites

Well done.  One of the problems we have here in helping explain is that it is sometimes easy to give too much, which means you copy + paste and learn too little :-)  By doing most of the work yourself you've not only achieved much more (and can be prouder of your achievements) but will also remember more too :-)

(llTriggerSound() is more flexible so I prefer it in general too.  The only drawback to it is if the emitter prim is moving - the sound is 'left behind')

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4628 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...