• 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!

TFS 1.X+ spellbook not work in tfs 1.3 nekiro 8.6

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, i have error when i try open spellbook but same script working on commands (!spells)
Error
Code:
Lua Script Error: [Scripts Interface]
C:\Users\XX\Desktop\XX\data\scripts\actions\spellbook.lua:callback
...hu\Desktop\XX\data\scripts\actions\spellbook.lua:7: attempt to call method 'level' (a number value)
stack traceback:
        [C]: in function 'level'
        ...hu\Desktop\XX\data\scripts\actions\spellbook.lua:7: in function <...hu\Desktop\XX\data\scripts\actions\spellbook.lua:3>

Lua Script Error: [Scripts Interface]
C:\Users\XX\Desktop\XX\data\scripts\actions\spellbook.lua:callback
...hu\Desktop\XX\data\scripts\actions\spellbook.lua:7: attempt to call method 'level' (a number value)
stack traceback:
        [C]: in function 'level'
        ...hu\Desktop\XX\data\scripts\actions\spellbook.lua:7: in function <...hu\Desktop\XX\data\scripts\actions\spellbook.lua:3>

Script from actions
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local text = ""
    local spells = {}
    for _, spell in ipairs(player:getInstantSpells()) do
        if spell.level ~= 0 then
            if spell.manapercent > 0 then
                spell.mana = spell.manapercent .. "%"
            end
            spells[#spells + 1] = spell
        end
    end

    table.sort(spells, function(a, b) return a.level < b.level end)

    local prevLevel = -1
    for i, spell in ipairs(spells) do
        local line = ""
        if prevLevel ~= spell.level then
            if i ~= 1 then
                line = "\n"
            end
            line = line .. "Spells for Level " .. spell.level .. "\n"
            prevLevel = spell.level
        end
        text = text .. line .. "  " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
    end

    player:showTextDialog(item:getId(), text)
    return true
end
 
Try removing the script, my spellbook has no scripts linked to it and its still working.

I have good script in data/actions/others/spellbook.lua but one more script for spellbook is in data/script/actions and he not work :D
When i remove spellbook.lua from data/script/actions and i added spellbook to actions.xml it work ;p
 
I have good script in data/actions/others/spellbook.lua but one more script for spellbook is in data/script/actions and he not work :D
When i remove spellbook.lua from data/script/actions and i added spellbook to actions.xml it work ;p
can you share yours please? im facing the same issue
nevermind, solved by reverting a commit made
 
Last edited:
can you share yours please? im facing the same issue
nevermind, solved by reverting a commit made
Please use the new version of downgrades located here:

If there is still problem with spellbook, submit an issue.
 
Please use the new version of downgrades located here:

If there is still problem with spellbook, submit an issue.
Have cheked it and has so many errors yet. Can't view item description can't eat or use things, and so on :(
Think im going to stick with tfs 1.3. like i said have solved the issue just by reverting the commit made on spellbook file, and i'll be testing tfs 1.4 trying to make commits on it if im able too and reports issues
is not ready yet even with the clean datapack have tested both sources and datapack 8.60 7.72 both have same errors
 
Have cheked it and has so many errors yet. Can't view item description can't eat or use things, and so on :(
Think im going to stick with tfs 1.3. like i said have solved the issue just by reverting the commit made on spellbook file, and i'll be testing tfs 1.4 trying to make commits on it if im able too and reports issues
is not ready yet even with the clean datapack have tested both sources and datapack 8.60 7.72 both have same errors
All of the things you mention are working fine. It's probably your datapack. I tested it on the 7.72 version though.
 
This spellbook works perfect on 1.4 downgrades, taken from here
XML:
<action itemid="2175" script="other/spellbook.lua" />

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local text = ""
    local tlvl = {}
    local tml = {}

    for _, spell in ipairs(player:getInstantSpells()) do
        if spell.level ~= 0 or spell.mlevel ~= 0 then
            if spell.manapercent > 0 then
                spell.mana = spell.manapercent .. "%"
            end
            if spell.level > 0 then
                tlvl[#tlvl+1] = spell
            elseif spell.mlevel > 0 then
                tml[#tml+1] = spell
            end
        end
    end

    table.sort(tlvl, function(a, b) return a.level < b.level end)
    local prevLevel = -1
    for i, spell in ipairs(tlvl) do
        local line = ""
        if prevLevel ~= spell.level then
            if i ~= 1 then
                line = "\n"
            end
            line = line .. "Spells for Level " .. spell.level .. "\n"
            prevLevel = spell.level
        end
        text = text .. line .. "  " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
    end
    text = text.."\n"
    table.sort(tml, function(a, b) return a.mlevel < b.mlevel end)
    local prevmLevel = -1
    for i, spell in ipairs(tml) do
        local line = ""
        if prevLevel ~= spell.mlevel then
            if i ~= 1 then
                line = "\n"
            end
            line = line .. "Spells for Magic Level " .. spell.mlevel .. "\n"
            prevmLevel = spell.mlevel
        end
        text = text .. line .. "  " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
    end


    player:showTextDialog(item:getId(), text)
    return true
end
 
Back
Top