Difference between revisions of "LlOverMyLand/ja"

From Second Life Wiki
Jump to navigation Jump to search
(Remove reference to blanked page)
Line 13: Line 13:
<lsl>
<lsl>
//--// private land message //--//
//--// private land message //--//
//-- @@ が付いている行は、コードを最適化しています。詳細は以下で:
//-- https://wiki.secondlife.com/wiki/User:Void_Singer/Optimizations


//-- 無視するアバターのリスト。全て小文字で。
//-- 無視するアバターのリスト。全て小文字で。
Line 30: Line 27:
     sensor( integer vIntFound ){
     sensor( integer vIntFound ){
         do{
         do{
             gKeyAv = llDetectedKey( --vIntFound );  //--@@
             gKeyAv = llDetectedKey( --vIntFound );   
             //-- 対象者が当該の土地の上にいるか調べる。
             //-- 対象者が当該の土地の上にいるか調べる。
             if (llOverMyLand( gKeyAv )){ //-- @@
             if (llOverMyLand( gKeyAv )){ //-- @@
                 //-- 無視リストに入っていないか調べる。
                 //-- 無視リストに入っていないか調べる。
                 if (!~llListFindList( gLstIgnore, (list)llToLower( llDetectedName( vIntFound ) ) )){ //-- @@
                 if (!~llListFindList( gLstIgnore, (list)llToLower( llDetectedName( vIntFound ) ) )){  
                     //-- 無視リストに入っていないアバターには警告する。
                     //-- 無視リストに入っていないアバターには警告する。
                     llInstantMessage( gKeyAv, "You are on private land, please leave this parcel" );
                     llInstantMessage( gKeyAv, "You are on private land, please leave this parcel" );

Revision as of 05:01, 24 January 2013

要約

関数: integer llOverMyLand( key id );

id がスクリプト所有者の土地の上に居るならば TRUE 、そうでないならば FALSE となる 真偽値 を integer で返します。

• key id 同じ 地域 にある アバター または オブジェクトUUID

グループに譲渡された土地では、このスクリプトの入ったオブジェクトも同じグループに譲渡されていなければなりません。(スクリプトにグループを設定するだけでは不充分です。)

サンプル

<lsl> //--// private land message //--//

//-- 無視するアバターのリスト。全て小文字で。 list gLstIgnore = ["void singer"]; key gKeyAv;

default{

   state_entry(){
       llOwnerSay( "I'll pester anyone on your land I can find,"
                   + " unless they're in your ignore list." );
       llSensorRepeat( "", "", AGENT, 96, PI, 30 );
   }
   sensor( integer vIntFound ){
       do{
           gKeyAv = llDetectedKey( --vIntFound );  
            //-- 対象者が当該の土地の上にいるか調べる。
           if (llOverMyLand( gKeyAv )){ //-- @@
                //-- 無視リストに入っていないか調べる。
               if (!~llListFindList( gLstIgnore, (list)llToLower( llDetectedName( vIntFound ) ) )){ 
                    //-- 無視リストに入っていないアバターには警告する。
                   llInstantMessage( gKeyAv, "You are on private land, please leave this parcel" );
               }
           }
       }while (vIntFound);
   }

} </lsl>

次の例は前の例の変化形です。日次でビジターログを電子メールで送信します。これは毎日あなたの土地がどのぐらいのトラフィックを稼いでいるか、だれが頻繁に訪問しているかを調べるのに便利です。 llOverMyLand 関数を使って、スクリプトが他の土地にいる人をカウントするのを防いでいます。

<lsl> // このスクリプトは新規訪問者とリピーターの日計を電子メールであなたに送信します。 // 訪問者は電子メールの更新サイクルごとに 1 回カウントされます。

// ----------------------------------- // 設定: ここをカスタマイズしてね // ここをあなたの電子メールアドレスにします。 string MyEmail = "you@example.com"; // 0 ~ 96 メートル。それ以上を指定すると通知が届きません。 float SensorRange = 96.0; // 電子メールの送信頻度を指定します。 integer UpdateFrequency = 86400; // 1 日の秒数 // -----------------------------------

// 内部変数 -- 変えないで list todayVisitors = []; list allVisitors = []; list repeatVisitors = []; list firstTimers = []; integer newVisitors = 0; integer returnVisitors = 0; string ParcelName;

default {

   state_entry()
   {
       list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
       ParcelName = llList2String(parcelDetails, 0);
       llSensorRepeat( "", "", AGENT, SensorRange, PI, 20);
       llSetTimerEvent(UpdateFrequency); // 定期報告を電子メールで送信します
       llOwnerSay("Visitor Log Started.");
   }

   sensor(integer avsFound)
   {
       key  avKey;
       integer avNum;
       for(avNum=0; avNum<avsFound; avNum++)
       {
           avKey = llDetectedKey(avNum);
           if (llOverMyLand(avKey))
           {
               string whom = llDetectedName(avNum);
               if (!~llListFindList(todayVisitors, [whom]))
               {
                   // この人は今日まだ現れていません
                   todayVisitors += [whom];
                   if (~llListFindList(allVisitors, [whom]))
                   {
                       // リピーターです
                       returnVisitors++;
                       repeatVisitors += [whom];
                   }
                   else
                   {
                       // おはつです
                       newVisitors++;
                       allVisitors = [whom] + allVisitors;
                       firstTimers += [whom];
                   }
               }
           }
       }
   }
   
   timer() 
   {
       list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
       ParcelName = llList2String(parcelDetails, 0);
       string subj = "Visitor Log for " + ParcelName;
       string body = "Number of Visitors Total: " + (string)(newVisitors + returnVisitors)
           + "\nReturning Visitors: " + (string)returnVisitors
           + "\nNew Visitors: " + (string)newVisitors 
           + "\n\nList of New Visitors:\n\t" + llDumpList2String(firstTimers, "\n\t")
           + "\n\nList of Returning Visitors:\n\t" + llDumpList2String(repeatVisitors, "\n\t");
       newVisitors = 0;
       returnVisitors = 0;
       todayVisitors = [];
       repeatVisitors = [];
       firstTimers = [];
       if (llGetListLength(allVisitors)>500)
       {
           allVisitors = llList2List(allVisitors, 0, 499);
       }
       llEmail(MyEmail, subj, body);
   }

}

</lsl>

特記事項

Search JIRA for related Issues

Signature

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