LlSensorRepeat/ja
Jump to navigation
Jump to search
LSL ポータル | 関数 | イベント | 型 | 演算子 | 定数 | 実行制御 | スクリプトライブラリ | カテゴリ別スクリプトライブラリ | チュートリアル |
|
Float定数 | 円弧 |
---|---|
PI_BY_TWO | 半球状 |
PI | 完全な球状 |
警告
- センサーイベントの繰り返しは、時間遅延(ラグ)に逆らって成立します。
サンプル
<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 |
特記事項
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。