Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
182
Click modal window #23
This allows you to click an activate modal window if default button has been set to enter.
Change the name to the name of the item you want.
There are 3 version to this. Each does it owns thing.
1: clicks a modal window when it has title "teleports" (this needs onModalDialog callback from newest bot.
2: has a toggle button to turn off and on. onModalDialog callback needed. Multi dialog selection.
3: this finds choice with name "Bosses" selects it and then clicks "ok"
198b | 5 lines.
onModalDialog(function(id, title, message, buttons, enterButton, escapeButton, choices, priority)
    if title == "Teleports" then
        modules.game_modaldialog.modalDialog:onEnter()
    end
end)
880b | 23 lines.
local modalClick = macro(2000, "Auto click Modal", function() end)
onModalDialog(function(id, title, message, buttons, enterButton, escapeButton, choices, priority)
    if modalClick:isOff() then return end
    local goDialog = 0
    if title == "Teleports" then -- clicks choice 4 if title is teleport
        goDialog = 4
    elseif title == "Misc" then -- clicks button 1 if misc
        goDialog = 1
    elseif title == "Towns" then -- if is town get all choices and select the one titled Thais
        for i = 1, #choices do
            local choiceId = choices[i][1]
            local choiceName = choices[i][2]

            if choiceName == "Thais" then
                goDialog = choiceId
            end
        end
    end
    if goDialog > 0 then
        g_game.answerModalDialog(id, enterButton, goDialog)
        modules.game_modaldialog:destroyDialog()
    end
end)
392b | 12 lines.
local modalpanel = modules.game_modaldialog.modalDialog
if modalpanel then
    local choiceList = modalpanel:getChildById('choiceList')
    if choiceList then
        for i, widget in pairs(choiceList:getChildren()) do
            if (widget:getText() == "Bosses") then
                choiceList:focusChild(widget)
                modalpanel:onEnter()
            end
        end
    end
end

10 Jun 2021