Skip to content

Get Selected Item Index

Get Selected Item Index

Retrieves the currently selected item index from a list-based user interface element and stores it in a variable.

Properties

System

Name Explanation Type
Destination Variable The variable to store the selected item index in. Variable or Value
Element The unique ID of the list-based user interface element to get the selected index from. Variable or Value

Examples

Get Selected Item Index into Global Variable 0

This retrieves the currently selected item index from the element whose unique ID is stored in Global Variable 1, and stores the result in Global Variable 0.

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

Get Selected Item Index into Local Variable 2

This retrieves the currently selected item index from the element whose unique ID is stored in Local Variable 0, and stores the result in Local Variable 2.

$lv[2] = get_selected_item_index($lv[0]);
{"Data":{"ID":{"IsGlobalVariable":false,"IsLocalVariable":true,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"Result":{"IsGlobalVariable":false,"IsLocalVariable":true,"IsValue":false,"Value":"","VariableIndex":2,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.GetSelectedItemIndexCommand"}