` worldNPCDialogText = "" worldPlayerDialogChoices = {} savedText = "" initialTop = nil previousTop = 0 function dialogEntryGreyed() return not worldScreen:GetInControlOfDialog() end function resizeDialog() savedText = "" end function dialogScroll(top) if top ~= previousTop then initialTop = nil end if savedText ~= worldNPCDialogText then savedText = worldNPCDialogText initialTop = nil if computeDialogText() ~= '' then initialTop = -Infinity_GetListHeight('dummyMessageBox') end previousTop = initialTop end return initialTop end function getDialogEntryText(row) if (row == 1 or row == 2) then return end local text = worldPlayerDialogChoices[row - 2].text if (row == worldPlayerDialogSelection) then --Color the text white when selected text = string.gsub(text, "%^0xff212eff", "^0xFFFFFFFF") end return text end function mergeDialog(t) local dialog = {} for key, value in pairs(t) do dialog[key] = value end table.insert(dialog, 1, '') table.insert(dialog, 1, '') return dialog end function computeDialogText() local npcDialog = worldNPCDialogText:gsub('\n', ': ', 1) if worldMessageBoxText:len() > npcDialog:len() then return worldMessageBoxText:sub(1, worldMessageBoxText:len() - npcDialog:len() - 1) end return '' end ` menu { name 'WORLD_DIALOG' offset 0 -57 align center bottom ignoreEsc onOpen " local x,y,w,h = Infinity_GetArea('worldDialogBackground') toolbarTop = toolbarTop + h Infinity_PushMenu('WORLD_DIALOG_CONFIRM') greySidebars() savedText = '' initialTop = nil previousTop = 0 " onClose " local x,y,w,h = Infinity_GetArea('worldDialogBackground') toolbarTop = toolbarTop - h Infinity_PopMenu('WORLD_DIALOG_CONFIRM') ungreySidebars() " label { name "worldDialogBackground" area 0 0 863 253 rectangle 4 } label { name "worldDialogPortraitArea" area 24 24 54 84 bitmap lua "worldNPCDialogPortrait" } list { column { width 100 text { area 0 0 -1 -1 text lua "computeDialogText()" text style "gamelog" } } name "dummyMessageBox" area 88 24 740 205 enabled "0" rowheight dynamic hideHighlight table "{0}" scrollbar 'GUISCRC' } list { column { width 100 text { area 0 0 -1 -1 enabled "rowNumber == 1 and computeDialogText() ~= '' and savedText ~= ''" text lua "computeDialogText()" text style "gamelog" } text { area 0 0 -1 -1 enabled "rowNumber == 2 and savedText ~= ''" pad 0 0 0 12 text lua "worldNPCDialogText:gsub('\n', ': ', 1)" text style "gamelog" } label { area 0 0 -1 -1 pad 12 0 0 0 enabled "rowNumber > 2 and dialogEntryGreyed() and savedText ~= ''" rectangle 1 rectangle opacity 100 } text { area 0 0 -1 -1 pad 12 0 0 0 enabled "rowNumber > 2 and savedText ~= ''" text lua "getDialogEntryText(rowNumber)" text style "gamelog" } } name "worldPlayerDialogChoicesList" area 88 24 756 205 rowheight dynamic hideHighlight table "mergeDialog(worldPlayerDialogChoices)" var "worldPlayerDialogSelection" scrollbar 'GUISCRC' scrollbar func "dialogScroll" scrollbar hide lua 'initialTop ~= nil' actionEnter " worldPlayerDialogSelection = mouseoverRow " actionExit " worldPlayerDialogSelection = 0 " action " if (worldPlayerDialogChoices[worldPlayerDialogSelection - 2] == nil) then return end worldScreen:OnDialogReplyClick(worldPlayerDialogChoices[worldPlayerDialogSelection - 2].marker) worldPlayerDialogSelection = 0 " } } ` function getDialogButtonEnabled() return (#worldPlayerDialogChoices == 0) end ` menu { name 'WORLD_DIALOG_CONFIRM' align center bottom ignoreEsc button { area 0 0 300 45 bam GUIBUTWT text lua "dialogButtonText" enabled "getDialogButtonEnabled()" text style "button" action " worldScreen:StepDialog() " } }