Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<CustomEquipment>
<equipment equipid="100" baseItem="2400" article="a" name="zelda sword">
<attribute key="description" value="a worthy blade." />
<attribute key="defense" value="45" />
<attribute key="attack" value="89" />
<attribute key="extradef" value="10" />
</equipment>
<equipment equipid="101" baseItem="2400" article="a" name="blade of the ruined king">
@Codinablack
Codinablack / lagLessSave.lua
Created January 19, 2022 18:59 — forked from Zbizu/lagLessSave.lua
less laggy player saving (tfs 1.3 or a fork that supports revscriptsys)
local noLagSave = GlobalEvent("noLagSave")
local timeBetweenSaves = 1 * 60 * 60 * 1000 -- in milliseconds
local delayBetweenSaves = 100
function delayedSave(cid)
local p = Player(cid)
if p then
p:save()
end
end
@Codinablack
Codinablack / matrix.lua
Created January 19, 2022 18:59 — forked from Zbizu/matrix.lua
matrix operations in lua
local matrixFields = {
area = {}
}
local Matrix = setmetatable(matrixFields,
{
__call = function(matrix, ...)
return matrix.new(...)
end
}
@Codinablack
Codinablack / ClassWithAutoMethods.lua
Created January 19, 2022 19:00 — forked from Zbizu/ClassWithAutoMethods.lua
automated getter/setter generation example for lua "classes"
local defaults = {
name = "",
words = "",
mana = 0,
manaPercent = 0,
soul = 0,
spellId = 0,
range = -1,
level = 0,
magLevel = 0,
@Codinablack
Codinablack / ClassExample.lua
Created January 19, 2022 19:00 — forked from Zbizu/ClassExample.lua
lua "class" example
local Class = setmetatable ({ },
{
__call = function (class, ...)
return class.new (...)
end
}
)
Class.__index = Class
Class.__call = function (self)
@Codinablack
Codinablack / tableClone.lua
Created January 19, 2022 19:01 — forked from Zbizu/tableClone.lua
[Lua] Clone a table without references
-- creates a full copy of a table
-- changing the value of copied table doesn't touch the original anymore
-- warning: using methods on "copied" userdata will still affect original object
local a = {
["abc"] = {1, 2},
[1] = {4, {2}}
}
function cloneTable(t)
@Codinablack
Codinablack / dumptable.lua
Created January 19, 2022 19:01 — forked from Zbizu/dumptable.lua
dump lua table contents to string
-- usage: dumpTable(t)
-- to dump to file:
--[[
local str = dumpTable(t)
local f = io.open("dumped_table.txt", "w+")
f:write(str)
f:close()
]]
local function getTabulation(depth)
@Codinablack
Codinablack / animatedTextTesting.lua
Created January 19, 2022 19:02 — forked from Zbizu/animatedTextTesting.lua
animated text for TFS 1.3 and HP bars bonus
-- who is showing changes and who is watching
spectated = Player("player")
spectator = Player("Administrator")
-- animated text, otclient only (or old clients)
--------------------------------
msg = NetworkMessage()
msg:addByte(0x84)
@Codinablack
Codinablack / fileDir.lua
Created January 19, 2022 19:03 — forked from Zbizu/fileDir.lua
Get current script directory
--[[
dumps file directory to a console
example output:
linedefined 0
lastlinedefined 207
source @F:\ot\data\scripts\filename.lua
what main
short_src ...ot\data\scripts\filename.lua
]]
@Codinablack
Codinablack / launcher.bat
Created January 19, 2022 19:03 — forked from Zbizu/launcher.bat
replacer test
project.exe test.txt
pause