Ir para conteúdo
  • 0

Como criar 1 botão no menu de cima que abra janela


xS0NYx

Pergunta

Como eu faço pra criar 1 mod, que fique como botão lá em cima junto de inventario e tal, e como faço pra ele abrir uma janela quando clicar, se possivel coloquem um modelo aqui, não precisa nem explicar, contanto que tenha o modelo..


Grato..



ALGUEM FECHA MEU OUTRO TÓPICO PORQUE POSTEI NA PARTE DE RESPONDIDOS, GRATO


Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

devo ter pego isso em algum lugar.

Crie 3 arquivos, .lua, .otmod e .otui

 

.LUA

ThunderPanel = nil
ThunderButton = nil

function init()
  ThunderButton = modules.client_topmenu.addRightGameToggleButton('ThunderButton', tr('Thunder Addons'), 'Thunder.png', toggle)
  ThunderButton:setOn(false)
  
  ThunderWindow = g_ui.displayUI('Thunder')  
  connect(g_game, { onGameStart = online,
    onGameEnd = destroyWindow })

  if not g_game.isOnline() then
    ThunderWindow:hide()
  end

  if ThunderButton:isOn() then
    ThunderWindow:hide()
    ThunderButton:setOn(false)
  else
    ThunderWindow:hide()
    ThunderButton:setOn(false)
  end

end

function terminate()
  disconnect(g_game, { onGameStart = online,
   onGameEnd = offline})

  ThunderButton:destroy()
end

function toggle()
if ThunderButton:isOn() then
ThunderWindow:hide()
ThunderButton:setOn(false)
else
ThunderWindow:show()
   ThunderButton:setOn(true)
end
end

function Thunderhide()
    ThunderWindow:hide()
    ThunderButton:setOn(false)
end

function Thunderhidex()
    Teste:show()
end

function onMiniWindowClose()
  ThunderButton:setOn(false)
end

.OTUI

MainWindow
  id: ThunderWindow
  !text: tr('Thunder')
  size: 150 150
  &save: true

  @onEnter: Thunderhide()
  @onEscape: Thunderhide()

  Button
    id: close
    !text: tr('hide')
    size: 40 15
    anchors.bottom: parent.bottom
    anchors.right: parent.right
    @onClick: Thunderhidex()
  
  Label
    id: teste
    !text: tr('Olá Xtibia')
    anchors.top: Button.top
    anchors.left: Button.left
    anchors.bottom: parent.bottom

.OTMOD

Module
  name: Thunder Addons
  description: Addons for thunder Ot
  author: Eduardo Vicente (Banana Fight)
  website: www.xtibia.com

  autoload: true
  autoload-priority: 1000

  scripts: 
    - Thunder.lua

  dependencies:
    - game_interface

  @onLoad: init()
  @onUnload: terminate()

e o arquivo Teste.OTUI também deve estar na pasta, use qualquer um ai pra testar, se quiser, olha aqui

MainWindow
  size: 256 128
  !text: tr('Teste')
  @onEscape: terminate()

  Button
    !text: tr('Enviar')
    width: 64
    anchors.right: next.left
    anchors.bottom: parent.bottom
    margin-right: 10
    @onClick: Thunder:Show()

  Button
    !text: tr('Fechar')
    width: 64
    anchors.right: parent.right
    anchors.bottom: parent.bottom
    @onClick: toggle()

pronto, eu fui editando conforme o post, nem sei se vai funcionar.... tirei os opcodes que tinha e umas funções que criei tambem...

a versão utilizada é o 0.6.2

 

abç

Editado por ArzakOwn
Link para o comentário
Compartilhar em outros sites

  • 0

Brigadão mano, ^^ , só que deu um erro na hora que clica no hide.. precisa de opcode pra rodar?

 
    [C]: ?
    /mode/thunder.lua:49: in function 'Thunderhidex'
    /mode/Thunder.otui:16: [@onClick]:2: in function </mode/Thunder.otui:16: [@onClick]:1>
ERROR: protected lua call failed: LUA ERROR:
/mode/thunder.lua:49: attempt to index global 'Teste' (a nil value)
stack traceback:
Editado por xS0NYx
Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...