LlListen
首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
函数名 |
---|
Function: integer llListen( integer channel, string name, key id, string msg ); |
参数:
integer channel – input chat channel, any integer value (-2147483648 through 2147483647) string name – filter for specific prim name or avatar legacy name key id – filter for specific group, avatar or prim UUID string msg – filter for specific message |
返回值:
返回一个句柄(整数) ,该句柄可用于禁用或删除 listen。 |
注意事项 |
---|
*在通道0[1]和调试通道上发送的消息被限制为每个所有者 / 用户每个区域200 / 10秒。
一旦速率超过,通道零或调试通道上的所有以下消息将被删除,直到前10秒的发送速率再次低于200 / 10秒。 删除消息,尽管被删除,仍然计算在限制之内。
状态更改可用作发布监听的快捷方式
如果这个数字超出了脚本运行时错误的范围,并且发生了太多的侦听错误。
可以通过更改事件检测所有者更改。 为了解决这个问题,旧的聆听将需要被关闭,一个新的开放给新的业主。
如果在范围内,可以听到由 lldialog、 lltextbox 或链接 prim 间接生成的聊天。 |
示例 |
---|
示例一
// Says beep to owner the first time owner says something in main chat // and then stops listening integer listenHandle; remove_listen_handle() { llListenRemove(listenHandle); } default { state_entry() { // Change the channel number to a positive integer // to listen for '/5 hello' style of chat. // target only the owner's chat on channel 0 (PUBLIC_CHANNEL) listenHandle = llListen(0, "", llGetOwner(), ""); } listen(integer channel, string name, key id, string message) { // we filtered to only listen on channel 0 // to the owner's chat in the llListen call above llOwnerSay("beep"); // stop listening until script is reset remove_listen_handle(); } on_rez(integer start_param) { llResetScript(); } changed(integer change) { if (change & CHANGED_OWNER) { llResetScript(); } } } 示例二 // Opens two listen handles upon touch_start and // stops listening whenever something heard passes either filter integer listenHandle_a; integer listenHandle_b; remove_listen_handles() { llListenRemove(listenHandle_a); llListenRemove(listenHandle_b); } default { touch_start(integer num_detected) { key id = llDetectedKey(0); string name = llDetectedName(0); listenHandle_a = llListen(5, "", id, ""); listenHandle_b = llListen(6, "", NULL_KEY, ""); llSay(0, "Listening now to '" + name + "' on channel 5."); llSay(0, "Listening now to anybody/anything on channel 6."); } listen(integer channel, string name, key id, string message) { if (channel == 5) llSay(0, name + " said: '/5 " + message + "'"); if (channel == 6) llSay(0, name + " said: '/6 " + message + "'"); remove_listen_handles(); } } |
相关函数 |
---|
llListenRemove--删除监听
llListenControl--允许/禁用一个监听 llWhisper--发送聊天限制在10米 llSay--发送聊天限制在20米 llShout--发送聊天限制在100米 llRegionSay--发送聊天限制当前 sim llRegionSayTo-- 发送聊天区域宽到一个特定的化身,或他们的附件,或一个已知 uuid 的 rezzed 对象 |
相关事件 |
---|
listen |