Difference between revisions of "LlSensorRepeat/ja"

From Second Life Wiki
Jump to navigation Jump to search
(New page: {{LSL_Function/ja |func=llSensorRepeat |sort=SensorRepeat |func_id=29|func_sleep=0.0|func_energy=10.0 |p1_type=string|p1_name=name |p2_type=key|p2_name=id |p3_type=integer|p3_name=type|p3_...)
 
m (カテゴリ変更)
Line 79: Line 79:
|permission
|permission
|negative_index
|negative_index
|cat1=Sensor
|cat1=Sensor/ja
|cat2=Detected
|cat2=Detected/ja
|cat3
|cat3
|cat4
|cat4
}}
}}

Revision as of 05:42, 10 April 2010

要約

関数: llSensorRepeat( string name, key id, integer type, float range, float arc, float rate );

前方ベクトルのarcラジアンとrangeメートルで、nameidtypeで一回スキャンを実行し、それをrate秒毎に繰り返します。

• string name
• key id
• integer type 型フラグ
• float range
• float arc
• float rate

nameid、そして(または)typeが空あるいは0の場合、これらは無効化されます。idが無効なキーあるいはNULL_KEYの場合、空として扱われます。

arcの素晴らしい説明はllSensorを見ましょう。.

type マスクフラグ 説明 (llDetectedType()) 説明 (llSensor() と llSensorRepeat() のマスク)
AGENT 0x1 エージェント 廃止: AGENT_BY_LEGACY_NAME を使ってください。
AGENT_BY_LEGACY_NAME 0x1 エージェント Legacy Name(レガシー名)でエージェントを検索します。
AGENT_BY_USERNAME 0x10 エージェント Username(ユーザ名)でエージェントを検索します。
ACTIVE 0x2 物理タスク(物理オブジェクトとエージェント) 移動している物理オブジェクト、または動作中のスクリプトが入っているオブジェクトを検索します。つまり、現在 SecondLife サーバのリソースを消費しているものを検索します。
PASSIVE 0x4 非物理オブジェクト 移動していない物理オブジェクト、または動作中でないスクリプトが入っている非物理オブジェクト、またはスクリプトの入っていないオブジェクトを検索します。つまり、現在 SecondLife サーバのリソースを消費していないものを検索します。
SCRIPTED 0x8 動作中のスクリプトが入っているオブジェクト 動作中のスクリプトが入っているオブジェクトを検索します。つまり、現在 SIM に何かしているものを検索します。
llDetectedType() スクリプトあり スクリプトなし
物理 10 (ACTIVE|SCRIPTED) 2 (ACTIVE)
非物理 12 (PASSIVE|SCRIPTED) 4 (PASSIVE)
Float定数 円弧
PI_BY_TWO 半球状
PI 完全な球状

警告

  • センサーイベントの繰り返しは、時間遅延(ラグ)に逆らって成立します。
All Issues ~ Search JIRA for related Bugs

サンプル

<lsl> // Written by Steamy Latte. // Scans every 30 seconds for visitors within 10 meters. // Reports new visitors to object owner when she is in range.

string AllAgents; string OwnerName;

default {

   state_entry()
   {
       // arc=PI is a sphere, you could look more narrowly in the direction object is facing with PI/2, PI/4 etc.
       // don't repeat this too often to avoid lag.
       llSensorRepeat("", "", AGENT, 10.0, PI, 30.0);
   }
   sensor(integer num_detected)
   {
       string thisAgent = "";
       integer agentNum;
       for (agentNum=0; agentNum<num_detected; agentNum++)
       {
           key thisKey = llDetectedKey(agentNum);
           string thisAgent = llDetectedName(agentNum);
           if (thisKey == llGetOwner())
           {
               if (AllAgents != "")
               {
                   llOwnerSay("We've had the following visitors:" + AllAgents);
                   AllAgents = "";
               }
           }
           else if (llSubStringIndex(AllAgents+"\n", "\n"+thisAgent+"\n") < 0)
           {
               AllAgents = AllAgents + "\n" + thisAgent;
           }
       }
   }

}

</lsl>

注意点

ラグのヒント:多くの場合で、llSensorRepeatのよりリソースの少ない代案としてllVolumeDetectを検討します。

関連項目

イベント

•  sensor センサーが何かを探知したときに実行されます
•  no_sensor センサーが何も探知しないときに実行されます

関数

•  llSensor センサーを一度動かします
•  llSensorRemove llSensorRepeatのタイマーを停止します

記事

•  Object Type

特記事項

Search JIRA for related Issues

Signature

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