Jump to content
You are about to reply to a thread that has been inactive for 200 days.

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

Recommended Posts

Hello again dear forums! :D

I have been working on a "comm" system for our sci-fi base, but have been unable to figur out a way to capture a normal chat message and then send it via "channel 159".

I have gotten alot of help while learning code, but i'm have a hard time understanding certain part of it. Would anyone be willing/able to explain what the 4 values in "llListen" and "listen" do?

 

I know that llListen is (Channel, the object name that it needs to listen too, something, something,)

and have no clue how the () works on the "listen" function.

 

Here is the code:

 

default
{
   
state_entry()
    {
       
llWhisper(0, "O1 running!");
       
llListen(0,llDetectedKey(0),llDetectedKey(0),"");
    }

    listen(integer channel, string name, key id, string message)
    {
       
llWhisper(159, message);
    }
}

 

Thanks alot again and hope you are all doing good! ^^

~Perg0

Link to post
Share on other sites

I have already read and "passed" the Basic LSL Tutorial. Tho i still don't get it :/
None the less i will try and re-read them and look online and maybe on youtube to see if i can find some more info.

 

Thanks for the really quick respons! ^^

Link to post
Share on other sites

Apologies if you didn't want to be spoonfed, but when i started,

the best way i learned was to see the code, not spend an hour googling :P

in your listening script, something like ...

integer listenHandle;
default
{
    state_entry()
    {  listenHandle = llListen(0, "", "", "");       
    }   
    listen(integer channel, string name, key id, string message)
    {
        if(message)
        {  llRegionSay(159, message );
        }     
    }
}

in your receiving script, something like ...

integer listenHandle;
default
{
    state_entry()
    {  listenHandle = llListen(159, "", "", "");       
    }   
    listen(integer channel, string name, key id, string message)
    {
        if(message)
        {  llOwnerSay("Got:\n" + message );
        }     
    }
}

the regionSay will send to any object in the region, ( like a worn attachment) or you can use any other comms method.

if you have an Experience key, you can send messages anywhere in secondlife

 

Edited by Xiija
  • Thanks 1
Link to post
Share on other sites

The 4 values in llListen, as linked by Rolig, are "channel, name, id, and message." id is short for UUID, or key.

They're used to create the "filter" for messages that can create events. For example:

// Listen for all messages on channel 0.
llListen(0, "", "", "");

// Listen for all messages on channel 0 from the owner.
llListen(0, "", llGetOwner(), "");

// Listen for all messages on channel 0 from anything named Object.
llListen(0, "Object", "", "");

// Listen for all messages on channel 0 from anything named Wulfie Reanimator (including objects).
llListen(0, "Wulfie Reanimator", "", "");

// Listen for a specific message on channel 0.
llListen(0, "", "", "phrase");

// Listen for all messages on channel 159 from someone whose name and UUID are the same. (Impossible)
llListen(159, llGetOwner(), llGetOwner(), "");

You an also have multiple listeners (just use llListen multiple times). Every time a single message passes a filter, it triggers the listen event.

In the listen event, the 4 values are the same, except this time they're variables that contain information about the message.

  • channel contains a number which is the channel the message was heard on.
  • name contains the name of the object/avatar that sent the message.
  • id contains the key of the object/avatar that sent the message.
  • message contains the text exactly as it was heard.
  • Thanks 1
Link to post
Share on other sites
7 hours ago, Ruthven Willenov said:
12 hours ago, Xiija said:

if you have an Experience key, you can send messages anywhere in secondlife

What??

Well, not quite.  Having an Experience key means that  you don't have to worry quite as much about having a permanent "server" prim to manage your e-mail traffic. In the days when we relied on llEmail exclusively, we had to hope that the server prim was never replaced, because the replacement would have a new UUID and thus a new e-mail address.  If you have an Experience, you can store that UUID in a KVP record and then have any object sending e-mails check the KVP first.  Or, of course, you can forget llEmail completely and just send your message as the contents of a KVP record and then tell receiving scripts to poll KVP every once in a while to see what's there.  Ineither case, the catch is that both the server and any object sending it e-mail have to have access to the Experience, so this new system depends on using an Experience that is available grid-wide (or at least over a lot of regions).  There aren't many of those (like AvSitter).

  • Like 1
Link to post
Share on other sites

We use experience keys in Burning Man for Grid-Wide radios.

One of our rangers has an experience, so he sets it up on his land, and the burn2 sims, and

we use the keys to hold the URLs that our base stations request, and make request / response calls

 with the message as the body. Without experiences, you have to store the base station's URLs

offworld somewhere.. ( I used to use google forms / sheets. )

 

if the base stations get new URLs, they are stored in the value of the object's key :)

Persistent storage rocks! ( if you can afford a premium account )

Edited by Xiija
  • Like 1
Link to post
Share on other sites
8 minutes ago, Xiija said:

if the base stations get new URLs, they are stored in the value of the object's key

Exactly.  It's much nicer than using off-world storage.  As I pointed out, though, it's not really grid-wide unless you have an Experience that is available everywhere on the grid. There are very few of those and they are almost all ones operated by Linden Lab for systems like Linden Homes and their game venues. Your specific example is lovely, but only works if you are on regions where the Burning Man Experience is available.

  • Like 1
Link to post
Share on other sites

For roleplay, there are some existing communications products that rely on external servers.

This used to be a bigger thing in SL. The NTBI/Gentek Telecom people had, and still have, telephones you can get. You can dial other stations and set up a text chat.

They went all the way with this. There's a phone book. There are in-world central offices, microwave relay towers, central office switches, and an operations center. At one time you could call 911 and reach an in-world 911 call center, which could connect you to the SL Coast Guard and various other RP emergency services in SL. The instructions to 911 operators began with "Arrive in Five". Their job was to move roleplay forward in a professional manner.

But modern-day roleplay went into decline in SL, and the 911 center was no longer staffed. Now it's gone.

genteknoc_001.thumb.png.704504eb10969859ff8b0c6cc7c06aab.png

In case of emergency, dial 911. The lights are off, no one is there to answer. It must have been interesting in its day.

You can still get phones that work on this system, but there's nobody to call.

  • Like 1
Link to post
Share on other sites

WOW! Thanks so much for all the help- I didn't get any notif tho .w. so sorry for late respons-


I figured it out on my own (with luck and wiki) here is the result i came up with :D

think it's similar to @Xiija's version.

 

Comm center:

default
{
   
state_entry()
    {
       
llWhisper(0, "O1 running!");
       
llListen(71, "", NULL_KEY, "");
    }

    listen(integer channel, string name, key id, string message)
    {
       
llWhisper(159, message);
    }
}

Radio (for 71)

//https://lslwiki.digiworldz.com/lslwiki/wakka.php?wakka=llListen

default
{
   
state_entry()
    {
       
llListen(159,"O1","O1","");
    }
    
   
listen(integer channel, string name, key id, string message)
    {
       
if (llToLower(message) == message)
        {
       
llWhisper(0, message);
        }
    }
}

 

And then i just change the channels from 71 if it needs to be another comm :D

Thanks again everyone it's truely amazing to be a part of this community! ^^

 

Hope you all have a fantastic day!

~Perg0

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 200 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...