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

Lua [TFS 1.3] Help simplifying the script

E

Evil Puncker

Guest
Hi everyone, can someone help me to make the script bellow more user friendly readable? So I can put it in official TFS, thanks in advance!

Lua:
local blessings = {
    {id = 5, name = 'Wisdom of Solitude'},
    {id = 4, name = 'Spark of the Phoenix'},
    {id = 3, name = 'Fire of the Suns'},
    {id = 1, name = 'Spiritual Shielding'},
    {id = 2, name = 'Embrace of Tibia'},
    {id = 6, name = 'Twist of Fate'}
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local result, bless = 'Received blessings:'
    for i = 1, #blessings do
        bless = blessings[i]
        result = player:hasBlessing(bless.id) and result .. '\n' .. bless.name or result
    end

    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 20 > result:len() and 'No blessings received.' or result)
    return true
end
 
Back
Top