Hello, i developed this system only for test and some peoples liked too much so i released.
I won't will explain what is conio i will show the effect of this script on your server:
:w00t: :w00t: :w00t:
Yes! Like old programs ^^
I'ts not beautiful but if you are hosting in your pc you can do awsome things with this lib. You can like print some values in color etc..
Well first you have to download the conio lib. You can download in attachmentin theread.
Add the libconio.dll and conio.luac your server folder (NOT DATA FOLDER)
And then on data/lib add Interface.lua
in interface.lua add this:
Now open your login.lua and in FIRST LINE OF THE SCRIPT add it:
Reload your creaturescripts and enjoy!
remenber it works in open tibia and on tfs but only tfs CONSOLE not on gui.
Also you can add this function:
Without the interface module and do something like this:
and will print:
:w00t:
i hope you enjoy
I won't will explain what is conio i will show the effect of this script on your server:
:w00t: :w00t: :w00t:
Yes! Like old programs ^^
I'ts not beautiful but if you are hosting in your pc you can do awsome things with this lib. You can like print some values in color etc..
Well first you have to download the conio lib. You can download in attachmentin theread.
Add the libconio.dll and conio.luac your server folder (NOT DATA FOLDER)
And then on data/lib add Interface.lua
in interface.lua add this:
Lua:
index = nil
table_ = nil
list = {}
running__ = false
require('libconio')
dofile('conio.luac')
function main_()
running__ = true
os.execute("CLS")
resize(80, 37)
display()
end
function display()
--Clear
os.execute("CLS")
write("Lua Conio 1.0", 1, 29)
-- Fill attribute of text console
fillattr(WHITE, RED, 80, 0, 0)
fillattr(WHITE, RED, 80, 0, 29)
-- Set text and background color
textbackground(BLACK)
textcolor(BLUE)
-- Print text console
write("\218", 1, 1)
write("\191", 46, 1)
write("\179", 1, 2)
write("\179", 46, 2)
write("\192", 1, 3)
write("\217", 46, 3)
-- Fill attribute of text console
fill(196, BLUE, BLACK, 44, 2, 1)
fill(196, BLUE, BLACK, 44, 2, 3)
-- Print text console
write("\218", 1, 4)
write("\191", 46, 4)
for i = 5, 24 do
write("\179", 1, i)
write("\179", 46, i)
end
write("\192", 1, 25)
write("\217", 46, 25)
-- Fill attribute of text console
fill(196, BLUE, BLACK, 44, 2, 4)
fill(196, BLUE, BLACK, 44, 2, 25)
-- Print text console
write("\218", 48, 1)
write("\191", 78, 1)
write("\179", 48, 2)
write("\179", 78, 2)
write("\192", 48, 3)
write("\217", 78, 3)
write("\218", 48, 4)
write("\191", 78, 4)
for i = 5, 27 do
write("\179", 48, i)
write("\179", 76, i)
write("\179", 78, i)
end
write("\192", 48, 28)
write("\217", 78, 28)
-- Fill attribute of text console
fill(196, BLUE, BLACK, 29, 49, 1)
fill(196, BLUE, BLACK, 29, 49, 3)
fill(196, BLUE, BLACK, 29, 49, 4)
fill(196, BLUE, BLACK, 29, 49, 28)
-- Print text console
write("\194", 76, 4)
write("\193", 76, 28)
write("\191", 46, 26)
write("\179", 46, 27)
write("\217", 46, 28)
-- Fill attribute of text console
-- Set text and background color
textbackground(BLACK)
textcolor(WHITE)
write("Conio interface in otserver by mock", 5, 2)
write("Online ", 60, 2)
write("", 3, 13)
write("", 3, 16)
list = getOnlinePlayers()
local tmp = getWorldUpTime()
local hours = math.ceil(tmp / 3600) - 1
local minutes = math.ceil((tmp - (3600 * hours)) / 60)
if(minutes == 60) then
minutes = 0
hours = hours + 1
end
write("Uptime: "..hours..':'..minutes..':'..(tmp%3600%60)..' ', 3, 5)
write("Npc: "..getWorldCreatures(2)..' ', 3, 6)
write("Monsters: "..getWorldCreatures(1)..' ', 3, 7)
write("Wrold type: "..({'Non-PVP','PVP','PVP-E'})[getWorldType()]..' ', 3, 8)
write("Players online: "..#list..' ', 3, 9)
dofile('config.lua')
local m = 44
local full = (100*(#list)/maxPlayers)
full = tostring(full):len() > 4 and tostring(full):sub(1,4) or tostring(full)
local t = math.floor(m*(#list)/maxPlayers)
write("Full: "..full..'% ', 3, 24)
textcolor(WHITE)
write('\201', 1, 26)
textcolor(YELLOW)
write('Server status', 2, 26)
textcolor(WHITE)
write(string.rep('\205',m-13)..'\187',15,26)
write('\186',1,27)
textcolor(LIGHTGRAY)
write(string.rep('\219',t), 2, 27)
textcolor(DARKGRAY)
write(string.rep('\177',m-t), 2+t, 27)
textcolor(WHITE)
write('\186',m+2,27)
write('\200', 1, 28)
textcolor(GREEN)
write('EMPYT', 2, 28)
textcolor(WHITE)
write(string.rep('\205',m-9),7, 28)
textcolor(RED)
write('FULL', 42, 28)
textcolor(WHITE)
write('\188',46,28)
--Draw box
write('\201Random player'..string.rep('\205',17)..'\187', 3, 11)
for i=12,20 do
write('\186',3,i)
write('\186',34,i)
end
write('\200'..string.rep('\205',30)..'\188', 3, 21)
--[[Random player info]]
if #list == 0 then
write('-',4,13)
else
local p = list[math.random(1,#list)]
write('Name: ',4,12) textcolor(LIGHTRED) write(p,14,12)textcolor(WHITE)
local c = getPlayerByName(p)
write('Level: '..getPlayerLevel(c),4,13)
write('IP: '..doConvertIntegerToIp(getPlayerIp(c)),4,14)
local pos = getCreaturePosition(c)
write("Pos: " .. pos.x .. "," .. pos.y .. "," .. pos.z,4,15)
write('Sex: '..(({[0]='Female',[1]='Male'})[getPlayerSex(c)] or '?'),4,16)
end
functions()
end
function functions()
table_ = {}
for i=1,45 do
table_[i] = list[i] or '- '
end
index = 1
putter()
end
function putter()
if index < 1 then
index = 1
elseif index > 23 then
index = 23
end
local limit = 5
local stop = 22
for i = index, index + stop do
write(table_[i], 50, limit)
if wherey() - 4 == index then
write("\219", 77, limit)
else
write("\176", 77, limit)
end
limit = limit + 1
end
write("", 1, 31)
addEvent(display,2000)
end
function write(text, x, y)
gotoxy(x, y)
io.write(text)
end
Now open your login.lua and in FIRST LINE OF THE SCRIPT add it:
Lua:
if not running__ then
main_()
end
Reload your creaturescripts and enjoy!
remenber it works in open tibia and on tfs but only tfs CONSOLE not on gui.
Also you can add this function:
Lua:
function printInColor(text,color)
textcolor(color)
io.write(tostring(text)..'\n')
textcolor(WHITE)
end
Lua:
function printInColor(text,color)
textcolor(color)
io.write(tostring(text)..'\n')
textcolor(WHITE)
end
printInColor('HI',RED)
printInColor('this',BLUE)
printInColor('is',GREEN)
printInColor('sparta!',YELLOW)
io.read()
:w00t:
i hope you enjoy
Attachments
-
libconio.zip15.8 KB · Views: 34 · VirusTotal