• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Modal Window ESC problem

seneke

New Member
Joined
Aug 1, 2024
Messages
11
Reaction score
0
GitHub
seneke
Hi guys,

I'm working on a Task System in OpenTibia Canary 3.1.2, which allows players to select tasks from a Task Board. When a player clicks on the board, a ModalWindow opens, where they can choose a task. The system works correctly except for one key issue:

Problem with ESC and the default task selection:

  • When the task board is opened, the first task is automatically pre-selected.
  • If the player presses ESC (on the keyboard), it automatically accepts the first task instead of closing the window.
Is there a way to configure ESC so that it does not interfere with the choiceId of the first task?
 
Add this in your script, the function that sends modal window
LUA:
    window:setDefaultEnterButton(100)
    window:setDefaultEscapeButton(101)
 
Last edited:
Back
Top