Difference between revisions of "LlGetParcelPrimOwners/ja"

From Second Life Wiki
Jump to navigation Jump to search
(Initial translation)
 
m (カテゴリ変更)
Line 207: Line 207:
|notes
|notes
|permission
|permission
|cat1=Parcel
|cat1=Parcel/ja
|cat2=Owner
|cat2=Owner/ja
|cat3
|cat3
|cat4
|cat4
}}
}}

Revision as of 05:55, 10 April 2010

要約

関数: list llGetParcelPrimOwners( vector pos );

pos のパーセルでオブジェクトを所有する住人の UUID とその所有プリム数のリストを list で返します。

• vector pos

  • 戻り値は [ key agentKey1, integer agentCount1, key agentKey2, integer agentCount2, ... ] といった形式になります。key に応じてソートされ、最大で 100 名分までです。
  • パーセルの所有者に準じた権限が必要です。

警告

  • この関数は 2.0 秒間、スクリプトを停止します。
  • このスクリプトの入ったオブジェクトの所有者とパーセルの所有者が同じ場合は、(オブジェクトとパーセルが共にグループへ譲渡されている場合も含めて、) パーセル内の全てのオブジェクトの所有者を取得できます。
  • 上の条件に合致せず、かつパーセルがグループ所有の場合、
    • スクリプトの入ったオブジェクトの所有者が (グループ メンバーの能力として) 'グループ所有オブジェクトを返却' する権限を持っているならば、パーセルにグループ所有のオブジェクトがある限り、そのグループのリストを返します。
    • スクリプトの入ったオブジェクトの所有者が 'グループに設定されているオブジェクトを返却' する権限を持っているならば、パーセル内でそのグループに設定されたオブジェクトを所有する所有者のリストを返します。
    • スクリプトの入ったオブジェクトの所有者が '非グループ・オブジェクトを返却' する権限を持っているならば、上記のいずれの条件にも合致しないオブジェクトの所有者のリストを返します。
  • 上記のいずれにも合致しなかった場合、空のリストを返します。
All Issues ~ Search JIRA for related Bugs

サンプル

<lsl> // Script by Falados Kapuskas

// The object has the same permisions to view prim parcel owners // as its owner (In About Land >> Objects >> Object Owners )

// Example: If you can't return group object, you won't see group objects // If you can't return any objects, an empty list will be returned. // If the prim is deeded to the right group, it should always get a full list

// Note: Only works when the when the owner is in the Sim // Deeded objects always work (group is always online?)

// -- SETTINGS (Edit These!) -- //

integer REFRESH_TIMER = 600; // Refresh Time (in seconds) vector PARCEL_POS = <128,128,0>; // A Region coordinate of a point in the parcel integer PAGE_SIZE = 8; // Number of owners to display per page on the prim integer DATA_TIMEOUT = 10; // Number of seconds to wait before giving up on dataserver events

// -- END SETTINGS -- //

list gQueryKeys; list gQueryIndex; list gNames; list gPrims;

key gDataserver_Name;

integer gPageNumber; integer gPageMax;

//Updates the internal list of prim owners //Returns TRUE if there were prim owners //Returns FALSE if the prim owner list was empty integer UpdateOwnerList() {

   list owner_prim = llGetParcelPrimOwners(PARCEL_POS);
   //Empty List either means no prims in the parcel
   //Or we couldn't get the list.  The latter is more likely
   if( owner_prim == [] ) 
   {
       llSetText("[ERROR]\n Couldn't get Parcel Prim Owners",<1,0,0>,1.0);
       return FALSE;
   }
   integer i;
   integer n = llGetListLength(owner_prim) / 2;
   
   //Reset the lists
   gPrims = [];
   gNames = [];
   gQueryKeys = [];
   gQueryIndex = [];
   
   
   for( i = 0; i < n; ++i)
   {
       key owner = llList2Key(owner_prim,i*2);
       string name = llKey2Name(owner);
       if( name == "" ) { //Not in the sim
       
           //Add to the query list
           gNames += ["[Unknown]"];
           gQueryIndex += [llGetListLength(gNames) - 1];
           gQueryKeys += [owner];
       } else {
           gNames += [name];
       }
       gPrims += llList2Integer(owner_prim,i*2+1);
   }
   gPageNumber = 0;
   gPageMax = llCeil( (float)llGetListLength(gNames) / PAGE_SIZE );
   return TRUE;

}


// Shows the prim owners starting at index 9*page // Returns TRUE if there are more pages // Returns FALSE otherwise integer ShowPrimOwners(integer page) {

   integer len = llGetListLength(gNames);
   integer offset = len-page*PAGE_SIZE;
   if(  offset < 0 )
   {
       return FALSE;
   }
   integer i;
   
   integer end = (integer)( llListStatistics(LIST_STAT_MIN,[len,(page+1)*PAGE_SIZE]) );
   string text;
   for( i = PAGE_SIZE*page; i < end; ++i)
   {
       text += llList2String(gNames,i) + " - " + (string)llList2Integer(gPrims,i) + "\n";
   }
   llSetText(text,<1,1,1>,1.0);
   return TRUE;

}

// Set-up phase default {

   state_entry()
   {
       llSetText("",<1,1,1>,1.0);
       if(UpdateOwnerList())
       {
           if( gQueryKeys == [] )
           {
               state display;
           } else {
               state lookup;
           }
       }
   }
   // If there is an error, touch to reset
   touch_start(integer i){llResetScript();}

}

// Display the list // Allow page flipping via touch state display {

   state_entry()
   {
       ShowPrimOwners(gPageNumber);
       llSetTimerEvent(REFRESH_TIMER);
   }
   touch_start(integer i)
   {
       if( !ShowPrimOwners(++gPageNumber) )
       {
           gPageNumber = 0;
           ShowPrimOwners(0);
       }
   }
   timer()
   {
       state default;
   }

}

// Look up all names for people that are not in the sim // Go to the display state when finished state lookup {

   state_entry()
   {
       if( gQueryKeys == [] ) state display;
       llSetTimerEvent(DATA_TIMEOUT);
       gDataserver_Name = llRequestAgentData( llList2Key(gQueryKeys,0) , DATA_NAME );
   }
   dataserver( key request_id, string data)
   {
       if( request_id == gDataserver_Name )
       {
           llSetText("Loading Names .. " + (string)llGetListLength(gQueryKeys),<1,.5,0>,1.0);
           if( llStringTrim(data,STRING_TRIM) != "" )
           {
               integer i = llList2Integer(gQueryIndex,0);
               gNames = llListReplaceList(gNames,[data],i,i);
           }
           gQueryKeys = llDeleteSubList(gQueryKeys,0,0);
           gQueryIndex = llDeleteSubList(gQueryIndex,0,0);
           
           if( gQueryKeys != [] )
           {
               llSetTimerEvent(DATA_TIMEOUT);
               gDataserver_Name = llRequestAgentData( llList2Key(gQueryKeys,0) , DATA_NAME );
           } else {
               state display;
           }
       }
   }
   timer()
   {
       //Skip it, move on
       gQueryKeys = llDeleteSubList(gQueryKeys,0,0);
       gQueryIndex = llDeleteSubList(gQueryIndex,0,0);
       gDataserver_Name = llRequestAgentData( llList2Key(gQueryKeys,0) , DATA_NAME ); 
   }
}</lsl>

特記事項

Search JIRA for related Issues

Signature

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