• 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 on look

alcapone

Member
Joined
Jan 13, 2021
Messages
246
Reaction score
19
loyaltyStorage = 14960
titles = {
[1] = "Scout",
[2] = "Sentinel",
[3] = "Steward",
[4] = "Warden",
[5] = "Squire",
[6] = "Warrior",
[7] = "Keeper",
[8] = "Guardian",
[9] = "Sage",
[10] = "Savant of Tibia",
[11] = "Enlightened of Tibia"

}

function Player:getTitle(cid)
if self:getId() ~= cid then
return ""
end

local value = self:getStorageValue(loyaltyStorage)
if(value == -1 or not titles[value]) then
return ""
end
return " You Are a " .. titles[value] .. " of Tibia. "
end


Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance) .. self:getTitle(thing.uid)
         if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. "a honeyflower patch."
        elseif thing.actionid == 5641 then
            description = description .. "a banana palm."
        elseif thing.itemid >= ITEM_HEALTH_CASK_START and thing.itemid <= ITEM_HEALTH_CASK_END
        or thing.itemid >= ITEM_MANA_CASK_START and thing.itemid <= ITEM_MANA_CASK_END
        or thing.itemid >= ITEM_SPIRIT_CASK_START and thing.itemid <= ITEM_SPIRIT_CASK_END
        or thing.itemid >= ITEM_KEG_START and thing.itemid <= ITEM_KEG_END then
            description = description .. thing:getDescription(distance)
            local charges = thing:getCharges()
            if charges then
                description = string.format("%s\nIt has %d refillings left.", description, charges)
            end
        else
            description = description .. thing:getDescription(distance)
        end

        local itemType = thing:getType()
        if (itemType and itemType:getImbuingSlots() > 0) then
            local imbuingSlots = "Imbuements: ("
            for slot = 0, itemType:getImbuingSlots() - 1 do
                if slot > 0 then
                    imbuingSlots = string.format("%s, ", imbuingSlots)
                end
                local duration = thing:getImbuementDuration(slot)
                if duration > 0 then
                    local imbue = thing:getImbuement(slot)
                    imbuingSlots = string.format("%s%s %s %s",
                        imbuingSlots, imbue:getBase().name, imbue:getName(), getTime(duration))
                else
                    imbuingSlots = string.format("%sEmpty Slot", imbuingSlots)
                end
            end
            imbuingSlots = string.format("%s).", imbuingSlots)
            description = string.gsub(description, "It weighs", imbuingSlots.. "\nIt weighs")
        end
    else
        description = description .. thing:getDescription(distance)
        if thing:isMonster() then
            local master = thing:getMaster()
            if master and table.contains({'sorcerer familiar','knight familiar','druid familiar','paladin familiar'},
                                                                                        thing:getName():lower()) then
                description = description..' (Master: ' .. master:getName() .. '). \z
                It will disappear in ' .. getTimeinWords(master:getStorageValue(Storage.PetSummon) - os.time())
            end
        end
    end
 
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
          
            local clientId = itemType:getClientId()
            if clientId then
                description = string.format("%s\nClient ID: %d", description, clientId)
            end
          
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        description = string.format(
        "%s\nPosition: %d, %d, %d",
        description, position.x, position.y, position.z
        )

        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
            end
        end
    end
 
self:sendTextMessage(MESSAGE_LOOK, description)
 
end

using on my character
20:28 You see yourself. You are god. You Are a Scout of Tibia. yourself. You are god.

using on another character
You see BestEk (Level 386). He is a druidBestEk (Level 386). He is a druid.

how should it be \/

1656286235630.png
 
Last edited:
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance) .. self:getTitle(thing.uid)
         if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. "a honeyflower patch."
        elseif thing.actionid == 5641 then
            description = description .. "a banana palm."
        elseif thing.itemid >= ITEM_HEALTH_CASK_START and thing.itemid <= ITEM_HEALTH_CASK_END
        or thing.itemid >= ITEM_MANA_CASK_START and thing.itemid <= ITEM_MANA_CASK_END
        or thing.itemid >= ITEM_SPIRIT_CASK_START and thing.itemid <= ITEM_SPIRIT_CASK_END
        or thing.itemid >= ITEM_KEG_START and thing.itemid <= ITEM_KEG_END then
            description = description .. thing:getDescription(distance)
            local charges = thing:getCharges()
            if charges then
                description = string.format("%s\nIt has %d refillings left.", description, charges)
            end
        else
            description = description .. thing:getDescription(distance)
        end

        local itemType = thing:getType()
        if (itemType and itemType:getImbuingSlots() > 0) then
            local imbuingSlots = "Imbuements: ("
            for slot = 0, itemType:getImbuingSlots() - 1 do
                if slot > 0 then
                    imbuingSlots = string.format("%s, ", imbuingSlots)
                end
                local duration = thing:getImbuementDuration(slot)
                if duration > 0 then
                    local imbue = thing:getImbuement(slot)
                    imbuingSlots = string.format("%s%s %s %s",
                        imbuingSlots, imbue:getBase().name, imbue:getName(), getTime(duration))
                else
                    imbuingSlots = string.format("%sEmpty Slot", imbuingSlots)
                end
            end
            imbuingSlots = string.format("%s).", imbuingSlots)
            description = string.gsub(description, "It weighs", imbuingSlots.. "\nIt weighs")
        end
    else
        description = description .. thing:getDescription(distance)
        if thing:isMonster() then
            local master = thing:getMaster()
            if master and table.contains({'sorcerer familiar','knight familiar','druid familiar','paladin familiar'},
                                                                                        thing:getName():lower()) then
                description = description..' (Master: ' .. master:getName() .. '). \z
                It will disappear in ' .. getTimeinWords(master:getStorageValue(Storage.PetSummon) - os.time())
            end
        end
    end
 
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
          
            local clientId = itemType:getClientId()
            if clientId then
                description = string.format("%s\nClient ID: %d", description, clientId)
            end
          
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        description = string.format(
        "%s\nPosition: %d, %d, %d",
        description, position.x, position.y, position.z
        )

        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
                description = description .. thing:getTitle(thing.uid)
            end
        end
    end
 
self:sendTextMessage(MESSAGE_LOOK, description)
 
end
try.
 
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance) .. self:getTitle(thing.uid)
         if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. "a honeyflower patch."
        elseif thing.actionid == 5641 then
            description = description .. "a banana palm."
        elseif thing.itemid >= ITEM_HEALTH_CASK_START and thing.itemid <= ITEM_HEALTH_CASK_END
        or thing.itemid >= ITEM_MANA_CASK_START and thing.itemid <= ITEM_MANA_CASK_END
        or thing.itemid >= ITEM_SPIRIT_CASK_START and thing.itemid <= ITEM_SPIRIT_CASK_END
        or thing.itemid >= ITEM_KEG_START and thing.itemid <= ITEM_KEG_END then
            description = description .. thing:getDescription(distance)
            local charges = thing:getCharges()
            if charges then
                description = string.format("%s\nIt has %d refillings left.", description, charges)
            end
        else
            description = description .. thing:getDescription(distance)
        end

        local itemType = thing:getType()
        if (itemType and itemType:getImbuingSlots() > 0) then
            local imbuingSlots = "Imbuements: ("
            for slot = 0, itemType:getImbuingSlots() - 1 do
                if slot > 0 then
                    imbuingSlots = string.format("%s, ", imbuingSlots)
                end
                local duration = thing:getImbuementDuration(slot)
                if duration > 0 then
                    local imbue = thing:getImbuement(slot)
                    imbuingSlots = string.format("%s%s %s %s",
                        imbuingSlots, imbue:getBase().name, imbue:getName(), getTime(duration))
                else
                    imbuingSlots = string.format("%sEmpty Slot", imbuingSlots)
                end
            end
            imbuingSlots = string.format("%s).", imbuingSlots)
            description = string.gsub(description, "It weighs", imbuingSlots.. "\nIt weighs")
        end
    else
        description = description .. thing:getDescription(distance)
        if thing:isMonster() then
            local master = thing:getMaster()
            if master and table.contains({'sorcerer familiar','knight familiar','druid familiar','paladin familiar'},
                                                                                        thing:getName():lower()) then
                description = description..' (Master: ' .. master:getName() .. '). \z
                It will disappear in ' .. getTimeinWords(master:getStorageValue(Storage.PetSummon) - os.time())
            end
        end
    end
 
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
         
            local clientId = itemType:getClientId()
            if clientId then
                description = string.format("%s\nClient ID: %d", description, clientId)
            end
         
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        description = string.format(
        "%s\nPosition: %d, %d, %d",
        description, position.x, position.y, position.z
        )

        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
                description = description .. thing:getTitle(thing.uid)
            end
        end
    end
 
self:sendTextMessage(MESSAGE_LOOK, description)
 
end
try.
-> player
20:56 You see yourself. You are a knight.yourself. You are a knight.


-> adm

20:57 You see [ADM] xxx. He is god.[ADM] xxx. He is god.
Health: 634065 / 634065, Mana: 3881920 / 3881920.
Position: 32347, 32218, 7
IP: 191.xxxxxx. You Are a Scout of Tibia.
 
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance) .. self:getTitle(thing.uid)
        if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. "a honeyflower patch."
        elseif thing.actionid == 5641 then
            description = description .. "a banana palm."
        elseif thing.itemid >= ITEM_HEALTH_CASK_START and thing.itemid <= ITEM_HEALTH_CASK_END
        or thing.itemid >= ITEM_MANA_CASK_START and thing.itemid <= ITEM_MANA_CASK_END
        or thing.itemid >= ITEM_SPIRIT_CASK_START and thing.itemid <= ITEM_SPIRIT_CASK_END
        or thing.itemid >= ITEM_KEG_START and thing.itemid <= ITEM_KEG_END then
            description = description .. thing:getDescription(distance)
            local charges = thing:getCharges()
            if charges then
                description = string.format("%s\nIt has %d refillings left.", description, charges)
            end
        else
            description = description .. thing:getDescription(distance)
        end

        local itemType = thing:getType()
        if (itemType and itemType:getImbuingSlots() > 0) then
            local imbuingSlots = "Imbuements: ("
            for slot = 0, itemType:getImbuingSlots() - 1 do
                if slot > 0 then
                    imbuingSlots = string.format("%s, ", imbuingSlots)
                end
                local duration = thing:getImbuementDuration(slot)
                if duration > 0 then
                    local imbue = thing:getImbuement(slot)
                    imbuingSlots = string.format("%s%s %s %s",
                        imbuingSlots, imbue:getBase().name, imbue:getName(), getTime(duration))
                else
                    imbuingSlots = string.format("%sEmpty Slot", imbuingSlots)
                end
            end
            imbuingSlots = string.format("%s).", imbuingSlots)
            description = string.gsub(description, "It weighs", imbuingSlots.. "\nIt weighs")
        end
    else
        description = description .. thing:getDescription(distance)
        if thing:isMonster() then
            local master = thing:getMaster()
            if master and table.contains({'sorcerer familiar','knight familiar','druid familiar','paladin familiar'},
                                                                                        thing:getName():lower()) then
                description = description..' (Master: ' .. master:getName() .. '). \z
                It will disappear in ' .. getTimeinWords(master:getStorageValue(Storage.PetSummon) - os.time())
            end
        end
        if thing:isPlayer() then
           description = description .. thing:getTitle(thing.uid)
        end
    end
 
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
          
            local clientId = itemType:getClientId()
            if clientId then
                description = string.format("%s\nClient ID: %d", description, clientId)
            end
          
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        description = string.format(
        "%s\nPosition: %d, %d, %d",
        description, position.x, position.y, position.z
        )

        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
                description = description .. thing:getTitle(thing.uid)
            end
        end
    end
 
self:sendTextMessage(MESSAGE_LOOK, description)
 
end
 
Lua:
function Player:onLook(thing, position, distance)
    local description = "You see " .. thing:getDescription(distance) .. self:getTitle(thing.uid)
        if thing:isItem() then
        if thing.actionid == 5640 then
            description = description .. "a honeyflower patch."
        elseif thing.actionid == 5641 then
            description = description .. "a banana palm."
        elseif thing.itemid >= ITEM_HEALTH_CASK_START and thing.itemid <= ITEM_HEALTH_CASK_END
        or thing.itemid >= ITEM_MANA_CASK_START and thing.itemid <= ITEM_MANA_CASK_END
        or thing.itemid >= ITEM_SPIRIT_CASK_START and thing.itemid <= ITEM_SPIRIT_CASK_END
        or thing.itemid >= ITEM_KEG_START and thing.itemid <= ITEM_KEG_END then
            description = description .. thing:getDescription(distance)
            local charges = thing:getCharges()
            if charges then
                description = string.format("%s\nIt has %d refillings left.", description, charges)
            end
        else
            description = description .. thing:getDescription(distance)
        end

        local itemType = thing:getType()
        if (itemType and itemType:getImbuingSlots() > 0) then
            local imbuingSlots = "Imbuements: ("
            for slot = 0, itemType:getImbuingSlots() - 1 do
                if slot > 0 then
                    imbuingSlots = string.format("%s, ", imbuingSlots)
                end
                local duration = thing:getImbuementDuration(slot)
                if duration > 0 then
                    local imbue = thing:getImbuement(slot)
                    imbuingSlots = string.format("%s%s %s %s",
                        imbuingSlots, imbue:getBase().name, imbue:getName(), getTime(duration))
                else
                    imbuingSlots = string.format("%sEmpty Slot", imbuingSlots)
                end
            end
            imbuingSlots = string.format("%s).", imbuingSlots)
            description = string.gsub(description, "It weighs", imbuingSlots.. "\nIt weighs")
        end
    else
        description = description .. thing:getDescription(distance)
        if thing:isMonster() then
            local master = thing:getMaster()
            if master and table.contains({'sorcerer familiar','knight familiar','druid familiar','paladin familiar'},
                                                                                        thing:getName():lower()) then
                description = description..' (Master: ' .. master:getName() .. '). \z
                It will disappear in ' .. getTimeinWords(master:getStorageValue(Storage.PetSummon) - os.time())
            end
        end
        if thing:isPlayer() then
           description = description .. thing:getTitle(thing.uid)
        end
    end
 
    if self:getGroup():getAccess() then
        if thing:isItem() then
            description = string.format("%s\nItem ID: %d", description, thing:getId())

            local actionId = thing:getActionId()
            if actionId ~= 0 then
                description = string.format("%s, Action ID: %d", description, actionId)
            end

            local uniqueId = thing:getAttribute(ITEM_ATTRIBUTE_UNIQUEID)
            if uniqueId > 0 and uniqueId < 65536 then
                description = string.format("%s, Unique ID: %d", description, uniqueId)
            end

            local itemType = thing:getType()

            local transformEquipId = itemType:getTransformEquipId()
            local transformDeEquipId = itemType:getTransformDeEquipId()
            if transformEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onEquip)", description, transformEquipId)
            elseif transformDeEquipId ~= 0 then
                description = string.format("%s\nTransforms to: %d (onDeEquip)", description, transformDeEquipId)
            end

            local decayId = itemType:getDecayId()
            if decayId ~= -1 then
                description = string.format("%s\nDecays to: %d", description, decayId)
            end
         
            local clientId = itemType:getClientId()
            if clientId then
                description = string.format("%s\nClient ID: %d", description, clientId)
            end
         
        elseif thing:isCreature() then
            local str = "%s\nHealth: %d / %d"
            if thing:isPlayer() and thing:getMaxMana() > 0 then
                str = string.format("%s, Mana: %d / %d", str, thing:getMana(), thing:getMaxMana())
            end
            description = string.format(str, description, thing:getHealth(), thing:getMaxHealth()) .. "."
        end

        description = string.format(
        "%s\nPosition: %d, %d, %d",
        description, position.x, position.y, position.z
        )

        if thing:isCreature() then
            if thing:isPlayer() then
                description = string.format("%s\nIP: %s.", description, Game.convertIpToString(thing:getIp()))
                description = description .. thing:getTitle(thing.uid)
            end
        end
    end
 
self:sendTextMessage(MESSAGE_LOOK, description)
 
end


22:40 You see yourself. You are god. You Are a Savant of Tibia of Tibia. yourself. You are god. You Are a Savant of Tibia of Tibia.


22:41 You see ADM (Level 3701). He is a knight.ADM (Level 3701). He is a knight. You Are a Savant of Tibia of Tibia.
 
22:40 You see yourself. You are god. You Are a Savant of Tibia of Tibia. yourself. You are god. You Are a Savant of Tibia of Tibia.


22:41 You see ADM (Level 3701). He is a knight.ADM (Level 3701). He is a knight. You Are a Savant of Tibia of Tibia.
bump
 
Back
Top