LlList2ListStrided
De DigiWiki.
Version du 25 août 2012 à 18:54 par Djphil (discuter | contributions)
list mylist = [0,1,2,3,4,5,6]; list result_a = llList2ListStrided(mylist,0,-1,2); //start at first item in list, go to the end, return every 2nd item //result_a == [0,2,4,6] list result_b = llList2ListStrided(mylist,1,-1,2); //start at second item in list, go to the end, return every 2nd item //result_b == [2,4,6] list result_c = llList2ListStrided(mylist,2,-1,2); //start at third item in list, go to the end, return every 2nd item //result_c == [2,4,6]
list menu = ["1", "one", "2", "two", "3", "three"]; default { state_entry() { llListen(10, "", llGetOwner(), ""); } touch_start(integer detected) { list buttons = llList2ListStrided(menu, 0, -1, 2); llDialog(llDetectedKey(0), "choose a number", buttons, 10); } listen(integer channel, string obj, key id, string message) { integer index = llListFindList(menu, [message]); if (index != -1) { llOwnerSay("you chose " + llList2String(menu, index + 1) + " (" + message + ")"); } } }