Difference between revisions of "LlListen/ja"

From Second Life Wiki
Jump to navigation Jump to search
m
m (カテゴリ変更)
Line 62: Line 62:
     }
     }
}</lsl>
}</lsl>
|cat1=Communications
|cat1=Communications/ja
|cat2=Chat
|cat2=Chat/ja
|cat3
|cat3
|cat4
|cat4
}}
}}

Revision as of 05:27, 10 April 2010

要約

関数: integer llListen( integer channel, string name, key id, string msg );

nameidからchannel上にmsgのコールバックが設定されます。
listenを無効か除去可能を integer で返します。

• integer channel any valid integer, positive or negative.
• string name
• key id
• string msg

msgnameidが空の場合は、入ってくるメッセージはフィルタにかかりません。 idが無効か、null keyの場合、空とみなされます。

仕様

listenイベントが作動されるため、主要に判定する基準をフィルタで強く設定すべきです。すべての基準はlistenイベントが生成したものを一致させつづけるだけです。最初に、メッセージはチャンネルchannel上で伝送されつづけます。nameが設定されている場合、話し手の名前をnameと正確に一致すべきです。idが有効な場合、nullではないkeyは話し手のkeyと同等にすべきです。msgが設定されている場合、話し手のメッセージとmsgを正確に一致すべきです。

チャネル定数 説明
DEBUG_CHANNEL 0x7FFFFFFF スクリプトのデバッグメッセージとエラーメッセージを受け取るチャットチャネル
PUBLIC_CHANNEL 0x0 近くのユーザ全員にブロードキャストされるチャットチャネル

警告

  • ステート変更あるいはスクリプトリセットで、すべてのlistenは自動で除去されます。
    • ステート変更はlistenの開放のショートカットのように使えます。
  • 65listenまでが何らかの単独スクリプトで同時に開くことができます。
    • この数を超えた場合、Script run-time errorToo Many Listensエラーを引き起こします。
  • マイナス域のチャットナンバーでチャットは、クライアントのダイアログボックスを除いて出力することはできません。
    • これはオブジェクト同士のコミュニケーションの典型的なつくりです。
    • これはクライアント上に置かれた人為的な限度かもしれず、プロトコルによるものではありません。
All Issues ~ Search JIRA for related Bugs

サンプル

オブジェクトオーナからの何らかのチャットを聞き、一度だけ返答する、些細な例です。ラグの削減と周囲のユーザのスパムを回避するため、0以外の広範囲チャンネルから選んでlistenすることと、'/5 hello'のような、選択チャンネル上でのチャットによるlistenイベントで作動することです。 <lsl>// says beep to owner the first time owner says something in main chat; integer listen_handle;

default {

   state_entry()
   {   //Registers the listen to the owner of the object at the moment of the call.
       // This does not automatically update when the owner changes.
       // Change 0 to another positive number to listen for '/5 hello' style of chat.
       listen_handle = llListen(0, "", llGetOwner(), "");
   }
   listen( integer channel, string name, key id, string message )
   {
       llOwnerSay("beep");
       // Stop listening until script is reset
       llListenRemove(listen_handle);
   }
   on_rez(integer param)
   {   //Triggered when the object is rezed, like after the object had been sold from a vendor
       llResetScript();//By resetting the script on rez it forces the listen to re-register.
   }
   changed(integer mask)
   {   //Triggered when the object containing this script changes owner.
       if(mask & CHANGED_OWNER)
       {
           llResetScript();
       }
   }
}</lsl>

注意点

チャンネル0は避けて、避ける可能性のあるnameやidを設定します(Lag)。llListen(0,"","","")はチャット範囲の皆からのチャットを聞くため確実にラグとなりやすく、それらのコストは回避すべきです。

関連項目

イベント

•  listen

関数

•  llListenRemove listenを解除します
•  llListenControl listenを有効(無効)にします
•  llWhisper 10メートルを限度としてチャットを送信します
•  llSay 20メートルを限度としてチャットを送信します
•  llShout 100メートルを限度としてチャットを送信します
•  llRegionSay 現在のSimを限度としてチャットを送信します

特記事項

Search JIRA for related Issues

Signature

function integer llListen( integer channel, string name, key id, string msg );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。