o script nao é so isso nao sem o resto fica complicado de analisar pra ver oque tem que mudar so isso ai nao vai da certo
info
Grupo: Visconde
Registrado: 04/11/12
Posts: 464
Reputação: +90
Gênero: Masculino
Char no Tibia: Lysty Of Death

info
Grupo: Visconde
Registrado: 26/08/12
Posts: 318
Reputação: +118
Gênero: Masculino

resto do script:
--[[Coisas para saber!
local button = optionsWindow:recursiveGetChildById('Button'):setText("Fuu") == muda o nome do botao!
optionsWindow = g_ui.loadUI('bot.otui', modules.game_interface.getRightPanel()) == faz a janela ficar nos cantos!
local player = g_game.getLocalPlayer() == pega o player!
player:getInventoryItem(8):getId() == pega o id do item, id do .spr
]]
cdBar = {}
cdBar.options = {}
-- Private Variables
local optionsWindow_hori
local optionsWindow_vert
local optionsButton
local barra = 'Horizontal.otui'
local nameAtks = ""
local cdAtks = ""
local botoes = {
['Button1'] = {event = nil},
['Button2'] = {event = nil},
['Button3'] = {event = nil},
['Button4'] = {event = nil},
['Button5'] = {event = nil},
['Button6'] = {event = nil},
['Button7'] = {event = nil},
['Button8'] = {event = nil},
['Button9'] = {event = nil},
['Button10'] = {event = nil},
['Button11'] = {event = nil},
['Button12'] = {event = nil},
}
-- Private Functions
-- Public functions
function cdBar.init()
optionsWindow_hori = g_ui.displayUI(barra)
optionsWindow_vert = g_ui.displayUI('Vertical.otui')
optionsWindow_hori:setVisible(false)
optionsWindow_vert:setVisible(false)
------
local pos = {x = 10, y = 10}
optionsWindow_hori:setPosition(pos)
optionsWindow_vert:setPosition(pos)
------
optionsButton = modules.client_topmenu.addRightGameToggleButton('cdBarButton', 'cdBar', '/modules/game_cooldown/cdBar.png', cdBar.toggle)
connect(g_game, { onGameStart = cdBar.online,
onGameEnd = cdBar.hide})
connect(g_game, 'onTextMessage', cdBar.barConfig)
cdBar.options = g_settings.getNode('cdBar') or {}
if g_game.isOnline() then
cdBar.online()
end
end
function cdBar.terminate()
disconnect(g_game, { onGameStart = cdBar.online,
onGameEnd = cdBar.hide})
disconnect(g_game, 'onTextMessage', cdBar.barConfig)
if g_game.isOnline() then
cdBar.offline()
end
optionsWindow_hori:destroy()
optionsWindow_hori = nil
optionsWindow_vert:destroy()
optionsWindow_vert = nil
optionsButton:destroy()
optionsButton = nil
cdBar.cleanEvents()
g_settings.setNode('cdBar', cdBar.options)
end
function cdBar.changeBar()
cdBar.hide()
if barra == 'Horizontal.otui' then
barra = 'Vertical.otui'
cdBar.show()
cdBar.toolTipChange()
g_game.talk('/reloadCDs')
elseif barra == 'Vertical.otui' then
barra = 'Horizontal.otui'
cdBar.show()
cdBar.toolTipChange()
g_game.talk('/reloadCDs')
end
end
function cdBar.barConfig(mode, text)
if not g_game.isOnline() then return end
if mode == MessageModes.Failure then
if string.find(text, '12//,') then
local t1 = text:explode(",")
if t1[2] == 'hide' then
cdBar.hide()
else
cdBar.show()
end
elseif string.find(text, '12|,') then
cdBar.atualizarCDs(text)
elseif string.find(text, '12&,') then
cdBar.toolTipChange(text)
end
end
end
function cdBar.barChange(but, num, lvl)
if not g_game.isOnline() then return end
if not cdBar.getWindow():isVisible() then return end
local player = g_game.getLocalPlayer()
if num and num >= 1 then
local button = cdBar.getWindow():recursiveGetChildById('Button' ..but)
local buttonoff = cdBar.getWindow():recursiveGetChildById('Opacity' ..but)
local pathOn = "/game_cooldown/imagens/"..button:getTooltip().."_on.png"
button:setImageSource(pathOn)
buttonoff:setVisible(true)
buttonoff:setText(num)
buttonoff:setColor('#FFFFFF') --#000080(azul) #006400(verde)
botoes['Button'..but].event = scheduleEvent(function() cdBar.barChange(but, num-1) end, 1000)
else
if botoes['Button' ..but] then
local buttonlvl = cdBar.getWindow():recursiveGetChildById('Level' ..but)
local buttonoff = cdBar.getWindow():recursiveGetChildById('Opacity' ..but)
local button = cdBar.getWindow():recursiveGetChildById('Button' ..but)
if button:getTooltip() then
local pathOn = "/game_cooldown/imagens/"..button:getTooltip().."_on.png"
if tonumber(lvl) ~= nil and player:getLevel() < lvl then
button:setImageSource(pathOn)
buttonlvl:setVisible(true)
buttonlvl:setText("Lv\n"..lvl.."")
buttonlvl:setColor('#3296FF')
else
button:setImageSource(pathOn)
buttonoff:setVisible(false)
buttonoff:setText("")
end
end
end
end
end
function cdBar.atualizarCDs(text)
if not g_game.isOnline() then return end
if not cdBar.getWindow():isVisible() then return end
local t = text:explode(",")
table.remove(t, 1)
local table = {}
for j = 1, 12 do
local t2 = t[j]:explode("|")
table[j] = {t2[1], t2[2]}
end
for i = 1, #table do
cdBar.barChange(i, tonumber(table[1]), tonumber(table[2]))
end
end
function cdBar.toolTipChange(text)
if barra == "Horizontal.otui" then
cdBar.getWindow():setHeight(418)
cdBar.getWindow():setWidth(44)
else
cdBar.getWindow():setWidth(418)
cdBar.getWindow():setHeight(44)
end
if not text then
text = nameAtks
else
nameAtks = text
end
local t2 = text:explode(",")
local count = 0
for i = 2, 13 do
if t2 == 'n/n' then
button = cdBar.getWindow():recursiveGetChildById('Button' ..(i-1)):hide()
count = count+1
else
button = cdBar.getWindow():recursiveGetChildById('Button' ..(i-1)):show()
button = cdBar.getWindow():recursiveGetChildById('Button' ..(i-1)):setTooltip(t2)
end
end
if count > 0 and count ~= 12 then
if barra == "Horizontal.otui" then
cdBar.getWindow():setHeight(418 - (count*34))
else
cdBar.getWindow():setWidth(418 - (count*34))
end
elseif count == 12 then
cdBar.getWindow():setHeight(44)
cdBar.getWindow():setWidth(44)
end
end
function cdBar.cleanEvents(button)
if button then
if botoes[button] then
if botoes[button].event ~= nil then
removeEvent(botoes[button].event)
botoes[button].event = nil
end
end
else
for i = 1, 12 do
removeEvent(botoes['Button'..i].event)
botoes['Button'..i].event = nil
end
end
end
function cdBar.getWindow()
if barra == 'Vertical.otui' then
return optionsWindow_vert
else
return optionsWindow_hori
end
end
function cdBar.toggle()
if cdBar.getWindow():isVisible() then
cdBar.changeBar()
end
end
function toggle()
if cdBar.getWindow():isVisible() then
cdBar.changeBar()
end
end
function cdBar.show()
if g_game.isOnline() then
cdBar.getWindow():show()
end
end
function cdBar.hide()
scheduleEvent(cdBar.cleanEvents(), 100)
cdBar.getWindow():hide()
end
function cdBar.online()
if not g_game.isOnline() then
cdBar.hide()
end
end
function cdBar.offline()
if not g_game.isOnline() then
cdBar.hide()
end
end
mas para configurar, creio que so precise criar uma função dakele tipo
(vou complementar, pq li ali oq postei e n dah pra intender oq eu quero
)
tipo, vc clika com o botão direito do mouse na janela, ai aparece as opções: 'set horizontal' se estiver na vertical, e 'set vertical' se estiver na horiontal
Editado Maio 28 por Noninhouh
info
Grupo: Conde
Registrado: 14/02/13
Posts: 702
Reputação: +196
Gênero: Masculino

adc isso no int
lado = null
horizontal = g_ui.displayUI('horizontal.otui')
vertical = g_ui.displayUI('vertical.otui')
vertical:hide()
lado = horizontal
function createMenu() if lado == 'horizontal' then vertical:show() horizontal:hide() lado = 'vertical' else vertical:hide() horizontal:show() lado = 'horizontal' end end
não tenho certeza que vai funfar mais seria +- isso.
Editado Maio 28 por BananaFight


info
Grupo: Visconde
Registrado: 26/08/12
Posts: 318
Reputação: +118
Gênero: Masculino
Alguem poderia editar esse script pra min para que ele funcionasse com 2 .otui's, ai em vez de trocar o lado, ele trocaria de .otui mermo...:
local lado = 'vertical'
function createMenu()
local menu = g_ui.createWidget('PopupMenu')
if lado == 'horizontal' then
menu:addOption('Set Vertical', function() lado = 'vertical' getSpells(spells) end)
else
menu:addOption('Set Horizontal',function() lado = 'horizontal' getSpells(spells) end)
end
menu:display()
end
os .otui's são, Horizontal.otui e Vertical.otui
OBS: é para o script do cdBar do Slicer
Editado Maio 28 por Noninhouh