EDIT : sorry but I can't run your code.
What is wrong here ?
SpoilerShow
Code: Select all
function autoexec()
fw.setHook('test_book_1.gw_book_testing.onUseItem',function()
local book = gw_book.create('test_book_1')
book.onClose = function(closeButton)
local s_text = [[Hey, you! Are you brave?]]
local s_dlgId = Dialog.quickYesNoDialog(s_text, answerCallBack, nil)
Dialog.activate(s_dlgId, answerCallback)
gw.removeElement(closeButton:getAncestor().id) --this line removes the book from the gui
end
book.textColor = {100,100,100,210}
book:addPageHeader(1,'This is the header of the 1st page.')
book:addPageText(1,
[[Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin iaculis pretium velit,
commodo molestie augue adipiscing ac. In hac habitasse platea dictumst.Maecenas massa diam, accumsan sed mattis in, volutpat non elit. Maecenas ut ullamcorper nisi.]]
)
book:addPageImage(2,'mod_assets/grimwidgets/images/compass_full_E.tga',200,200)
book:openPagePair(1)
gw.addElement(book)
return false
end
)
end
function answerCallBack(s_caption)
if s_caption == "Yes" then
hudPrint("Yeah, right...")
end
if s_caption == "No" then
hudPrint("Run for your life! There's killer snail after you")
end
end