llKeysKeyValue/ja

From Second Life Wiki
Jump to navigation Jump to search

Summary

Function: key llKeysKeyValue( integer first, integer count );

Start an asynchronous transaction to request a number of keys from the script's Experience.
Returns a handle (a key) これを使用して、このコマンドが成功したか失敗したかを判断し、結果を知るための対応するdataserverイベントを識別できます。

• integer first 取得する最初のキーのゼロベースのインデックス
• integer count 取得するキーの数

この関数は、要求されたキーの数を取得しようとしますが、要求数が満たされない場合やリストが大きすぎる場合は、満たすことができないかもしれません。返されるリストの長さは4097文字まで制限されています(成功フラグ「1」と4096文字)。 返されるキーの順序は保証されませんが、キーが追加または削除されていない限り、連続する呼び出しの間で安定しています。
エラーXP_ERROR_KEY_NOT_FOUNDは、指定されたインデックスがキーの数以上である場合に返されます。

For this function to work, the script must be compiled into an Experience.

Specification

Dataserver

The dataserver callback parameters are:

String Components
• integer success A boolean specifying if the transaction succeeded (1) or not (0).
• integer error An XP_ERROR_* flag that describes why the operation failed.
• list keys A list of keys (strings) used in the key-value store

Caveats

  • If you recompile a script that was previously associated with an Experience but do so with a client that lacks the ability to compile scripts into an experience the script will lose the associated Experience.
  • この関数はキーをCSV形式で返すため、キーにはカンマを含めないことが推奨されます。
All Issues ~ Search JIRA for related Bugs

Examples

key trans;
default
{
    state_entry()
    {
        // retrieve the first 10 keys
        trans = llKeysKeyValue(0, 10);
    }

    dataserver(key t, string value)
    {
        if (t == trans)
        {
            // our llKeysKeyValue transaction is done
            list result = llCSV2List(value);
            if (llList2Integer(result, 0) == 1)
            {
                llSay(0, "Keys retrieved: "+(string)llGetSubString(value, 2, -1));
            }
            else if (llList2Integer(result, 1) == XP_ERROR_KEY_NOT_FOUND)
            {
                // no more keys
                llSay(0, "No more keys" );
            }
            else
            {
                // keys request failed
                llSay(0, "Key-value failed to request keys: " + llGetExperienceErrorMessage(llList2Integer(result, 1)) );
            }
        } 
    }
}

Notes

Compiling

For a script to be associated with an Experience...

  • It must be compiled with a client that is Experience aware,
  • The "Use Experience" checkbox must be checked,
  • And one of the users Experience keys selected.
KBcaution.png 重要 Not all TPVs have this functionality.

Deep Notes

Search JIRA for related Issues

Signature

function key llKeysKeyValue( integer first, integer count );