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

New panel

Kleston

New Member
Joined
Oct 28, 2013
Messages
31
Reaction score
3
Hello.
I created a new panel. But I do not know age use it after logging

hud.lua
Lua:
hudPlayerPanel = nil

function init()
  connect(g_game, { onGameEnd = offline })
  hudPlayerPanel = g_ui.displayUI('hud')
end

function terminate()
  disconnect(g_game, { onGameEnd = offline })
  hudPlayerPanel:destroy()
end
hud.otui
Code:
HudPlayerPanel < Panel
  image-source: /images/ui/gui/dolny_panel
  image-border: 4

HudPlayerPanel
  id: hudPlayerPanel
  anchors.top: topMenu.bottom
  anchors.left: gameLeftPanel.left
 
Lua:
hudPlayerPanel:setVisible(false)
Check if game is online and then do :setVisible(true)
 
Could you explain more. I was grateful?
Disappears but I can not now call it after logging in.

Lua:
hudPlayerPanel = nil

function init()
  connect(g_game, { onGameEnd = offline })
  hudPlayerPanel = g_ui.displayUI('hud')
  hudPlayerPanel:setVisible(false)

  if g_game.isOnline() then
    hudPlayerPanel:setVisible(true)
  end
end

function terminate()

  disconnect(g_game, { onGameEnd = offline })

  hudPlayerPanel:destroy()
end

#edit
Its done :)
I did so.

Lua:
hudPlayerPanel = nil

function init()
  connect(g_game, { onGameStart = online,
                    onGameEnd   = offline })
  hudPlayerPanel = g_ui.displayUI('hud')
  hudPlayerPanel:setVisible(false)

  if g_game.isOnline() then
    online()
  end
end

function terminate()

  disconnect(g_game, { onGameEnd = offline })
  offline()
  hudPlayerPanel:destroy()
end

function online()
  hudPlayerPanel:setVisible(true)
end

function offline()
  hudPlayerPanel:setVisible(false)
end

I have another question. How do I show in the player's outfit?
 
Last edited:
How to do to show skin?
But it does not work :/

Lua:
hudPlayerPanel = nil
hudPlayerPanelOutfit = nil
playerOutfit = nil

function init()
  connect(g_game, { onGameStart = online,
                    onGameEnd   = offline })
  hudPlayerPanel = g_ui.displayUI('hud')
  hudPlayerPanelOutfit = hudPlayerPanel:getChildById('hudPlayerPanelOutfit')
  hudPlayerPanel:setVisible(false)
  if g_game.isOnline() then
    online()
  end
end

function terminate()
  disconnect(g_game, { onGameEnd = offline })
  offline()
  hudPlayerPanel:destroy()
end

function online()
  hudPlayerPanel:setVisible(true)
  create()
end

function offline()
  hudPlayerPanel:setVisible(false)
end

function create(outfit)
  playerOutfit = outfit
  if playerOutfit then
    outfit = playerOutfit:getOutfit()
    hudPlayerPanelOutfit:setCreature(playerOutfit)
  end
end

Code:
HudPlayerPanel < Panel
  image-source: /images/ui/gui/hudplayer_panel

HudPlayerPanel
  id: hudPlayerPanel
  anchors.top: topMenu.bottom
  anchors.left: gameLeftPanel.left

  Creature
    id: hudPlayerPanelOutfit
    anchors.top: parent.top
    anchors.left: parent.left
 
Last edited:
Back
Top