Select

C10 - initial

select (Sifts)
TypeCorrade progressive sift
Siftselect
Parametersa string representing an element to match
DescriptionThe select will return the items following the provided element for all elements in the list.
Last ChangesNone

The select will return the items following the provided element for all elements in the list.

Arguments

Position Type Description Example
0 a string an element to match Price

Example

The following sift when added to a command will return the element following the Price element:

    "sift", wasListToCSV([
        "select", "Price"
    ]),

Effect on Returned Data

Given the input:

data=Price,10,Item,Book,Price,50,Item,Chair,Price,200,Item,PC

the expected output will be:

data=10,50,200

Selecting Values by Keys

Suppose the getavatarappearancedata command is issued and the following result is returned to the callback:

FaceTextures,index,0,RGBA,"<1, 1, 1, 1>",RepeatU,1,RepeatV,1,OffsetU,0,OffsetV,0,Rotation,0,Glow,0,Bump,None,Shiny,None,Fullbright,False,MediaFlags,False,TexMapType,Default,TextureID,00000000-0000-0000-0000-000000000000,MaterialID,00000000-0000-0000-0000-000000000000,1,RGBA,"<1, 1, 1, 1>",RepeatU,1,RepeatV,1,OffsetU,0,OffsetV,0,Rotation,0,Glow,0,Bump,None,Shiny,None,Fullbright,False,MediaFlags,False,TexMapType,Default,TextureID,00000000-0000-0000-0000-000000000000,MaterialID,00000000-0000-0000-0000-000000000000,2,RGBA,"<1, 1, 1, 1>",RepeatU,1,RepeatV,1,OffsetU,0,OffsetV,0,Rotation,0,Glow,0,Bump,None,Shiny,None,Fullbright,False,MediaFlags,False,TexMapType,Default,TextureID,00000000-0000-0000-0000-000000000000,MaterialID,00000000-0000-0000-0000-000000000000,3,RGBA,"<1, 1, 1, 1>" ...

and assume that the TextureID is the one that we are interested in.

In that case, a select sift would be suitable and the following command:

llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // gets the visual parameters of
            // the avatar named Fuzzy Resident
            "command", "getavatarappearancedata",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            // or "agent", "69ce412b-dffc-436d-86ff-d788bfa66d9d"
            "firstname", "Fuzzy",
            "lastname", "Resident",
            "data", "FaceTextures",
            "sift", wasListToCSV([
                "select",
                "TextureID"
            ]),
            "callback", wasURLEscape(URL)
        ]
    )
);

will extract just the texture IDs from the original output:

command=getavatarappearancedata&time=2020-04-22T01:51:01.180845Z&data=00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,5317ee6e-6726-48be-ba6d-c4885c2da686,1f5b25ec-5999-4913-bb57-e1594b92211a,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,62c9a6fe-7d89-49ca-9931-5a4955abf6a3,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000&success=True

secondlife/scripted_agents/corrade/api/sifts/select.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.