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

OTAL - Open Tibia Advanced Lib download!

Mock

Mock the bear (MTB)
Joined
Jul 29, 2008
Messages
619
Reaction score
106
Location
Brazil
Finally! OTAL has been released! :)
You can use 188 lua functions!
Is just enter on O.T.A.L - Open Tibia Advanced Lib
and download, it's good read manual.
This lib have an self install, you just need add
Code:
dofile(getDataDir() .. 'lib/index.lua')
in last line of data.lua or global.lua (unzip all content on folder lib)

This lib, wne executed at first time this lib will set all tables on DB and create folder data/storage to save files .tbl (to functions (saveTable(table,name) andgetTable(name), Save tables in files)
and create file called Your Server Function List.txt, it contains ALL lua functions of your server, and file called OTAL-REINSTALL, delete it to reinstall lib.


Use TFS console to see it:
imagemkd.png


TFS gui dont show it.


All functions:
Lua:
xml:open(file[,kind]) --- Xmls
xml:setSess(sessname,tagname,name)
xml:getSess(SessName)
xml:readSess(SessName)
xml:readFree(tagname)
vip.getVip(cid)  --- Vip
vip.getVipByAcc(acc)
vip.setVip(cid,time)
vip.getVipByAccount(acc)
vip.hasVip(cid)
vip.accountHasVip(acc)
vip.getDays(days)
vip.addVipByAccount(acc,time)
vip.setVipByAccount(acc,time)
vip.returnVipString(cid)
doScrollMessage(uid, message) -- Tibia
doSummonCreatureWithCheck(name, pos)
isLevel(cid,level)
stringcontains(txt, str)
isWalkable(pos)
getStringCount(msg)
isOnline(name)
getAccountStorageValue(accid,value_id)
setAccountStorageValue(accid,value_id,value)
doInArea(pos,radius,luaString,var)
setPlayerName(cid,name,msg)
string.trim(str)
string.explode(str, sep[,limit])
doActionForAllPlayers(luaString)
isWeapon(uid)
isArmor(uid)
hasSqm(pos)
getFileString(file[,limit])
getPlayerInfo(cid,val)
executeInArea(cmd, pos, area)
math.percent(v, t, f)
math.module(x)
math.interval(x, y)
findItemById(pos, id)
doPlayerAddDepotItem(cid, item, count)
getInstantSpells(vocid)
setPlayerRecoveryKey(cid)
getPlayerTotalDefense(cid)
ddNumberOnArray(array, number)
getArrPosByName(array, name)
getCountOnArr(array, search)
doCalculateArray(array, calc)
changeLookDir(cid, dir)
getLuaFunctions()
doFindItemInPos(itens, pos)
doDelayAttack(cid, delay, min, max, type, effect, projectile, frompos, topos)
tableToString(tb)
saveTable(table,name)
getTable(name)
getItemIdByName2(name)
string.expand(s)
var_dump(...)
printT(tx,t)
string.impode(arr,sep)
animatedTextBig(pos,text,color)
doWriteLogFile(file, text,line)
getDirFiles(dir, ext)
getPlayerTotalArmor(cid)
getPlayerTotalAttack(cid)
onFile(type, directory, content)
isStair(uid, stepin, rope, ground, ladder) 
table.find(t, v, c)
table.totext(t, i)
table.countv(t, i)
table.maxv(t)
table.clean(t, ...)
table.asort(t, s)
table.tofile(t, nf, tn)
utf8Decode(str)
utf8Encode(str)
socket.dns.toip(ip)  -- Dns   --- Socket
socket.dns.gethostname()
socket.dns.tohostname(address)
socket.http.request(url [, body]) --- HTTP
ltn12.filter.chain(filter1, filter2 [, ... filterN]) --- lnt12
ltn12.filter.cycle(low [, ctx, extra])
ltn12.pump.all(source, sink)
ltn12.pump.step(source, sink)
ltn12.sink.chain(filter, sink)
ltn12.sink.error(message)
ltn12.sink.file(handle, message)
ltn12.sink.null()
ltn12.sink.simplify(sink)
ltn12.sink.table([table])
ltn12.source.cat(source1 [, source2, ..., sourceN])
ltn12.source.chain(source, filter)
ltn12.source.empty()
ltn12.source.error(message)
ltn12.source.file(handle, message)
ltn12.source.simplify(source)
ltn12.source.string(string)
mime.normalize([marker])  -- Mime functions
mime.decode(vr)
mime.encode(vt)
mime.stuff()
mime.wrap("text" [, length])
mime.b64(C [, D])
mime.dot(m [, B])
mime.eol(C [, D, marker])
mime.qp(C [, D, marker])
mime.qpwrp(n [, B, length])
mime.unb64(C [, D])
mime.unqp(C [, D])
mime.wrp(n [, B, length])
socket.bind(address, port [, backlog]) -- Socket
socket.connect(address, port [, locaddr, locport])
socket.newtry(finalizer)
socket.protect(func)
socket.select(recvt, sendt [, timeout])
socket.sink(mode, socket)
socket.skip(d [, ret1, ret2 ... retN])
socket.sleep(time)
socket.source(mode, socket [, length])
socket.gettime()
socket.try(ret1 [, ret2 ... retN])
socket.tcp() -- Tcp functions
server:accept()
master:bind(address, port)
master:close()
master:connect(address, port)
client:getpeername()
master:getsockname()
master:getstats()
master:listen(backlog)
client:receive([pattern [, prefix]])
client:send(data [, i [, j]])
client:setoption(option [, value])
master:setstats(received, sent, age)
master:settimeout(value [, mode])
client:shutdown(mode)
socket.udp()  -- Udp functions
connected:close()
connected:getpeername()
connected:getsockname()
connected:receive([size])
unconnected:receivefrom([size])
connected:send(datagram)
unconnected:sendto(datagram, ip, port)
unconnected:setpeername(address, port)
connected:setpeername('*')
unconnected:setsockname(address, port)
connected:setoption(option [, value])
connected:settimeout(value)
ex.getenv(name) --- Ex lib
ex.setenv(name, value)
ex.environ()
ex.chdir(pathname)
ex.mkdir(pathname)
ex.currentdir()
ex.dir(pathname)
ex.dirent(pathname)
ex.lock(file, mode, offset, length)
ex.unlock(file, offset, length)
ex.pipe()
ex.sleep(interval, [unit])
ex.spawn(...)
ex.wait(proc)
conn:close() --- Luasql
conn:commit()
conn:execute(statement)
conn:rollback()
conn:setautocommit(boolean)
cur:close()
cur:fetch([table[,modestring]])
cur:getcolnames()
cur:numrows()
env:connect(sourcename[,username[,password[,hostname[,port]]]])
rings.new(env) --- Rings
state:close ()
state:dostring(string, ...)
remotedostring(string, ...)
stable.get(key)
stable.set(key, value)
coxpcall(f, err) --- Coexpcall [url]http://coxpcall.luaforge.net/index.htm[/url]
copcall(f, ...)
copas.addserver(server, handler[, timeout]) --- Copas [url=http://www.keplerproject.org/copas/index.html]Copas - Coroutine Oriented Portable Asynchronous Services for Lua[/url]  (Coroutine Oriented Portable Asynchronous Services)
copas.addthread(thrd[, ...])
copas.loop(timeout)
copas.step(timeout)
copas.flush(skt)
copas.receive(skt, pattern)
copas.send(skt, data)
copas.wrap(skt)

Please report bugs!
 

Attachments

Last edited:
Haha thx man this is so cool :p.
You must spread some Reputation around before giving it to Mock again.
If somebody don't know how to install it on tfs 0.3.5pl1,
replace you data/lib folder with this file:
 
Last edited:
Yea shawak you are great you knwo how to install it thankkkkkkkkkzor ;x
 
@Sality
I'ts just add dofile in last line of data.lua
:p
Sorry but website is off -.-'
i hate awaredspace (free website host)
 
@sality
put:
dofile(getDataDir() .. 'lib/index.lua')
and just open your server ^^
Add dofile its only wath you need to do.
add libs, folders etc lib do it by himself
 
Nice..... But some of your and other peoples functions are just... Unnecessarily long :p

And why you write "by mock" to "stringcontains(txt, str)" ? It's very old OT function...

Instead of "isWalkable" by nord use my isPositionFree (located in Lua Functions board).

I'll shorten some functions for you.

Lua:
function isOnline(name)
    return getPlayerByName(name) ~= false
end

function isLevel(cid, level)
    if(isPlayer(cid) == FALSE) then
        return FALSE
    end

    return getPlayerLevel(cid) >= level
end

function isWeapon(uid)
	return getItemAttack(uid) > 0 and getItemArmor(uid) == 0 and isItemStackable(getThing(uid).itemid) == FALSE
end

Loooots of more functions could be shortened...

And instead of using loadstring which is not quite necessary in those cases, use functions.
Lua:
function doActionForAllPlayers(f)
	local players = getOnlinePlayers()
	for i, player in ipairs(players) do
		f(getPlayerByName(player))
	end
end

Also removed the variables that were not removed...
 
@Colandus
sorry i put wrong on stringcontains xp
and all other functions is VERRY old and i dont want change some.
isWalkable i'm wating nord release v 2.0
doActionForAllPlayers(f)
in other forum i made an script using it like string so it's not good change.
 
@Gregor
Yes but no 100% of otserv functions, but luasocket and etc works.
 
@Renusek
yes but not 100% of otserv lua funcions, can some dont work :S
 
If I have right the installation version are for Windows users but what with Linux users? Only repleace library?
 
@TomCrusher
well
luasocket is for win idk about linux, luaEX its ONLY for linux
in linux cases its just remove on config win libs, or you can download libs like luasocket luasql for linux
 
:( can't u make setMonsterName(uid, name) ?
 
I have a funny problem :D

When i use your OTAL then Marriage script is not working properly <lol>
Here is the script:
http://otland.net/f83/marriage-system-forgotten-server-0-3-5-a-39702/

When in my OTS I don't have your OTAL then the script is working without any problems but when I add OTAL then the script is not working correctly :O
0 errors in console but i can't get wedding ;d


#Edit
Rofl, I've added this marry functions to "Lib_functions.lua" and now it's working :p
 
Last edited:
@Up
The funniest thing is that it's not showing any errors, but then the script is not working in 100%, but when I've added functions to "Lib_functions.lua" it was working :)
 

Similar threads

Back
Top