Skip to content
This repository was archived by the owner on Jun 16, 2024. It is now read-only.

Moving items with Keyboard Gamepad

Leonardo Emanuele edited this page Oct 24, 2021 · 1 revision

SET_INPUT_EVENT

This function is used to send an input event to the menu. It filters UP, DOWN, LEFT, RIGHT, SELECT and returns the relative value: Int when changing indexes, and Bool when selecting a Checkbox item.
This is mainly because the only item changing when selected is the checkbox item.

Parameters TYPE Optional Description
direction Int The direction
item Int The item's index (for checkbox items)
value Bool the item's value (for checkbox items)
Returns Int / Bool

for the Direction parameter we'll follow the R* way of doing things...

values are:

  • UP => 8,
  • DOWN => 9,
  • LEFT => 10,
  • RIGHT => 11,
  • CROSS (select item) => 16,

Example:

  • C#
public async void GoUp()
{
	MenuItems[_activeItem % (MenuItems.Count)].Selected = false;
	BeginScaleformMovieMethod(NativeUIScaleform._nativeui.Handle, "SET_INPUT_EVENT");
	ScaleformMovieMethodAddParamInt(8);
	var ret = EndScaleformMovieMethodReturnValue();
	while (!IsScaleformMovieMethodReturnValueReady(ret)) await BaseScript.Delay(0);
	_activeItem = GetScaleformMovieFunctionReturnInt(ret);
	MenuItems[_activeItem % (MenuItems.Count)].Selected = true;
	IndexChange(CurrentSelection);
}
  • Lua
function GoUP()
	MenuItems[_activeItem % #MenuItems].Selected = false;
	BeginScaleformMovieMethod(scaleformUI, "SET_INPUT_EVENT");
	ScaleformMovieMethodAddParamInt(8);
	local ret = EndScaleformMovieMethodReturnValue();
	while (not IsScaleformMovieMethodReturnValueReady(ret)) do
               Wait(0);
        end
	_activeItem = GetScaleformMovieFunctionReturnInt(ret);
	MenuItems[_activeItem % #MenuItems].Selected = true;
	IndexChange(CurrentSelection);
end

The only difference from the selection is that when selected you send the item index and its value too... if the item is a Checkbox item.. it will change its value and return the changed boolean value.. if not nothing will happen (all the code usually is done via script.. select item do code)

If you send Left or Right... the item will change... if the item is a UIMenuItem -1 will return.. else the item value will return... for List items.. the current index, for Slider and Progresse items their current index value.

Clone this wiki locally