Skip to content

Set Selected Item Index

Set Selected Item Index

Changes the currently selected item in a list-based user interface element to the specified index.

Properties

System

Name Explanation Type
Element The unique ID of the list-based user interface element to change the selection of. Variable or Value
Index The index of the item to select in the list. Variable or Value

Examples

Set the Selected Item Index to a Specific Value

This sets the selected item index of the element whose unique ID is in Global Variable 0 to the value stored in Global Variable 1.

set_selected_item_index($gv[0], $gv[1]);
{"Data":{"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Index":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":1,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.SetSelectedItemIndexCommand"}

Set the Selected Item Index to 3

This sets the selected item index of the element whose unique ID is in Global Variable 0 to index 3.

set_selected_item_index($gv[0], 3);
{"Data":{"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Index":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"3","VariableIndex":0,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.SetSelectedItemIndexCommand"}