Closed Xaleth closed 7 years ago
You need to make sure that the file that the guide is saved in has a specific format. It should be something along the lines of the following:
return "return {[\"background\"] = \"gui_rohanbg.png\"," ..
"[\"title\"] = \"title\", [\"page_max\"] = #pages," ..
"[\"text_len\"] = not important, but need to exist, [\"owner\"] = \"Author\", [\"text\"] = \blah blah blah\"}"
The reason it uses this ridiculous format is because I based the guides on written books, as that was the best way of dealing with long texts in a formspec. However, since https://github.com/minetest/minetest/commit/e6e5fa3bf8853f149fdef16b39af3981097176a4, readonly textareas are a better way of doing this (much, much simpler. Books should probably be converted to using them as well...). I'll probably do this at some point.
Hm, strange... I followed your steps on the format, but I'm still getting the same errors as the original post.
EDIT: Fixed now.
Forgot to replace the braces for \"background\" with brackets.
Thank you.
I am creating the first scroll for LOTT and I have this in the guides.lua:
local lore_poem1 = dofile(minetest.get_modpath("lottblocks") .. "/guide_text/lore_poem1.lua")
minetest.register_craftitem("lottblocks:lore_scroll1", { description = "Scroll labeled A GILTHONIEL", inventory_image = "scroll.png", groups = {book = 1, forbidden = 1}, stack_max = 1, text = minetest.deserialize(lore_poem1), on_use = function(itemstack, user) guide_on_use(itemstack, user) end, })
and the map loaded without any errors; however, when I left-click on the scroll, the map crashes and returns:
`2017-10-22 13:00:59: ACTION[Server]: singleplayer uses lottblocks:lore_scroll1, pointing at [node under=-134,14,-126 above=-134,15,-126]
2017-10-22 13:00:59: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod 'lottblocks' in callback item_OnUse(): ...st/games/Lord-of-the-Test/mods/lottblocks/guides.lua:9: attempt to index local 'data' (a nil value)
2017-10-22 13:00:59: ERROR[Main]: stack traceback:
2017-10-22 13:00:59: ERROR[Main]: ...st/games/Lord-of-the-Test/mods/lottblocks/guides.lua:9: in function 'guide_on_use'
2017-10-22 13:00:59: ERROR[Main]: ...st/games/Lord-of-the-Test/mods/lottblocks/guides.lua:98: in function <...st/games/Lord-of-the-Test/mods/lottblocks/guides.lua:97> ` I really don't know how the Palantir guide works even with the exact setup as the lore_scroll.
Help.