This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- just place this in libs | |
function doSendAnimatedText(pos, text, color, player) | |
local p = Player(player) | |
if not p then | |
return false | |
end | |
local msg = NetworkMessage() | |
msg:addByte(0x84) | |
msg:addPosition(pos) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local combat = Combat() | |
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) | |
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_WILDGROWTH) | |
local function tile_timer(id, pos, delay, color) | |
if not Tile(pos):getItemById(id) then | |
return true | |
end | |
if delay ~= 1 then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- replace your mw script with this | |
local combat = Combat() | |
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) | |
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL) | |
local function tile_timer(id, pos, delay, color) | |
if not Tile(pos):getItemById(id) then | |
return true | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- usage: just call it in a Lua environment and look for a file called out.txt | |
-- lists all global variables in a file | |
function writeAllGlobals() | |
local file = io.open("out.txt", "w+") | |
local seen={} | |
local function dump(t,i) | |
seen[t]=true | |
local s={} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- configuration | |
LOOP_EVENT_DELAY = 5 * 1000 -- (in milliseconds) | |
-- register list of affected creatures and protect them from reload | |
if not LOOP_EVENT_REGISTERED_CREATURES then | |
LOOP_EVENT_REGISTERED_CREATURES = {} | |
end | |
-- store session id to reload the loop without duplicating it | |
if LOOP_EVENT_SESSION_ID then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getOS() | |
-- ask LuaJIT first | |
if jit then | |
return jit.os | |
end | |
-- Unix, Linux variants | |
local fh,err = assert(io.popen("uname -o 2>/dev/null","r")) | |
if fh then | |
osname = fh:read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local matrixFields = { | |
area = {} | |
} | |
local Matrix = setmetatable(matrixFields, | |
{ | |
__call = function(matrix, ...) | |
return matrix.new(...) | |
end | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local defaults = { | |
name = "", | |
words = "", | |
mana = 0, | |
manaPercent = 0, | |
soul = 0, | |
spellId = 0, | |
range = -1, | |
level = 0, | |
magLevel = 0, |