Hello,
To create a gamepad dialog, here's how to :
First your Keyboard dialog : ex :
Lua Code:
--define new dialog
local lowMemoryDialog = {
title = { text = GetString(NOTYOU_LUADIALOG_TITLE) },
mainText = { text = GetString(NOTYOU_LUADIALOG_TEXT) },
buttons = {
[1] = {
text = SI_DIALOG_YES,
callback = function(dialog)
SetCVar("LuaMemoryLimitMB", tostring(dialog.data.newLimit))
ReloadUI("ingame")
end,
},
[2] = { text = SI_DIALOG_NO }
}
}
ZO_Dialogs_RegisterCustomDialog("LUA_LOW_MEMORY", lowMemoryDialog)
This one will be called thanks to :
Lua Code:
ZO_Dialogs_ShowDialog("LUA_LOW_MEMORY", { newLimit = newLimit }, { mainTextParams = { currentLimit, newLimit } } )
"LUA_LOW_MEMORY" is the name (it is in
ESO_Dialogs table.
{ newLimit = newLimit } is the data .
newLimit = xxxx refers to
dialog.data.newLimit in the dialog,
xxx will be sent as value.
{ mainTextParams = { currentLimit, newLimit } } is the params for the mainText string. currentLimit will go in my <<1>> and newLimit in my <<2>> (mainTextParams is zo_strformat()'ed !)
So now, this code don't work for gamepad !
To simply make it gamepad compliant, you'll need to change 2 little things :
First, in your dialog definition, you'll need to add the
gamepadInfo data :
The simpliest one is :
gamepadInfo = { dialogType = GAMEPAD_DIALOGS.BASIC },
You can look at GAMEPAD_DIALOGS table to see which other values of
dialogType are accepted.
There is also others values acceepted in
gamepadInfo , like
Lua Code:
allowShowOnNextScene = true,
allowRightStickPassThrough = true,
It will become :
Lua Code:
local lowMemoryDialog = {
gamepadInfo = { dialogType = GAMEPAD_DIALOGS.BASIC },
title = { text = GetString(NOTYOU_LUADIALOG_TITLE) },
mainText = { text = GetString(NOTYOU_LUADIALOG_TEXT) },
buttons = {
[1] = {
text = SI_DIALOG_YES,
callback = function(dialog)
SetCVar("LuaMemoryLimitMB", tostring(dialog.data.newLimit))
ReloadUI("ingame")
end,
},
[2] = { text = SI_DIALOG_NO }
}
}
ZO_Dialogs_RegisterCustomDialog("LUA_LOW_MEMORY", lowMemoryDialog)
Then, the call itself will be modified for :
Lua Code:
ZO_Dialogs_ShowGamepadDialog("LUA_LOW_MEMORY", { newLimit = newLimit }, { mainTextParams = { currentLimit, newLimit } } )
And it works !