Skip to content

Instantly share code, notes, and snippets.

@Petethegoat
Created May 28, 2019 19:04
Show Gist options
  • Save Petethegoat/25317968d437a4cb38e23851de16d0e7 to your computer and use it in GitHub Desktop.
Save Petethegoat/25317968d437a4cb38e23851de16d0e7 to your computer and use it in GitHub Desktop.
local function onItemTileUpdated(e)
if e.item.objectType == tes3.objectType.book then
if e.item.type == tes3.bookType.scroll then
if e.item.enchantment then
for i = 1, #e.item.enchantment.effects do
if e.item.enchantment.effects[i].id >= 0 then
-- local icon = e.element:createImage({ path = string.format("icons\\sc\\scroll_%s", e.item.enchantment.effects[i].id) })
local icon = e.element:createImage({ path = string.format("icons\\%s", e.item.enchantment.effects[i].object.icon) })
icon.consumeMouseEvents = false
icon.width = 16
icon.height = 16
icon.scaleMode = true
icon.absolutePosAlignX = 0.2
icon.absolutePosAlignY = 0.75
break
end
end
end
end
end
end
event.register("itemTileUpdated", onItemTileUpdated)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment