hi, can someone explain why this not working? and how i can fix it
the function onModalWindow doesn't work
LUA:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
player:registerEvent("ModalWindow_Tutorial")
local title = "Pick your favorite color!"
local message = "You get a free tapestry in the color of your choice!"
local window = ModalWindow(1000, title, message)
window:addButton(100, "Confirm")
window:addButton(101, "Cancel")
window:addChoice(1, "Red")
window:addChoice(2, "Orange")
window:addChoice(3, "Yellow")
window:addChoice(4, "Green")
window:addChoice(5, "Blue")
window:addChoice(6, "Purple")
window:setDefaultEnterButton(100)
window:setDefaultEscapeButton(101)
window:sendToPlayer(player)
return true
end
function onModalWindow(player, modalWindowId, buttonId, choiceId)
player:unregisterEvent("ModalWindow_Tutorial")
local tapestry = {1869, 1866, 1863, 1860, 1872, 1857}
if modalWindowId == 1000 then
if buttonId == 100 then
player:addItem(tapestry[choiceId], 1)
end
end
end
the function onModalWindow doesn't work