Jump to content

unlinked prims speak/listen syntax error


Raena Parx
 Share

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

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

Recommended Posts

Hi.  I have two unlinked prims trying to talk to each other integer CH = 925529;

The listening prim has this listener:

                                listen(integer channel,string str,key id,string message)

The speaking prim only needs to send the channel number (CH) and a message ($msg)  (because the key is not relevant) to anything in the listening script.

so technically it could just use:

                                 llSay(CH, $msg);

which by itself gives no syntax errors.

But because the listener has 4 parameters, I'm unable to create a syntax that works for the speaking prim.   I've tried:

                                llSay(CH, "Toggle", NULL_KEY, $msg); 

(among others) which seems like it would work.  But instead I get this error 3 times:

     (27,34) : ERROR: Function call mismatches type or number of arguments
     (27,34) : ERROR: Function call mismatches type or number of arguments
     (27,34) : ERROR: Function call mismatches type or number of arguments

and it wont even let me save the script.

 

I wish I could make the listener just listen for 2 parameters, but I guess that's not an option.

 

Can anyone tell me why the llSay(CH "Toggle", NULL_KEY, $msg);  is giving me a syntax error? 

Thank you so much.

 

 

 

 

 

 

 

 

Edited by Raena Parx
saved before completed entering it
Link to comment
Share on other sites

First you must create a listener using the llListen function. This is where you can specify which channel is to be monitored, and filter chat on this channel by the name of the speaker, the key of the speaker and the message being sent. You can use the empty string, "", as a parameter for the name, id and message parameters which causes the listener to accept any message, from anyone or anything. Only the channel must be specified: llListen (99, "", "", "");.

Listening object script:

default
{
    state_entry ()
    {
        llListen (99, "", "", "");
    }

    listen (integer channel, string name, key id, string message)
    {
        llOwnerSay (name + " (" + (string) id + ") said \"" + message + "\" on channel " + (string) channel);
    }
}

Speaking object script:

default
{
    touch_start (integer total_number)
    {
        llSay (99, "Touched.");
    }
}

(Or just type 

/99 Hello!

into chat.)

Edited by KT Kingsley
Added example scripts
Link to comment
Share on other sites

8 hours ago, Raena Parx said:

But because the listener has 4 parameters, I'm unable to create a syntax that works for the speaking prim.

The extra parameters for the listen event are automatically given values based on the message it heard.

"message" will be the content that was heard, eg. the string from llSay, as you expect.

"id" will be the key of the message's source, which could be any object or avatar. "name" is the name of that source.

"channel" is the chat channel where the message was heard. If you're only calling llListen once, the channel will always be the same and you don't need to check for it.

Whenever you call llListen, the parameters are used to restrict which name/key/message can be heard on a given channel. You can listen to multiple channels at once by calling llListen multiple times.

  • Like 1
Link to comment
Share on other sites

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