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

[HELP] Help with label not showing

Bionex

New Member
Joined
Aug 14, 2017
Messages
1
Reaction score
0
I need help to add some labels on my miniwindow but it won't show no matter what I do and also the mini window saves the position but don't save that it is open

here is buff_timer.otui
Code:
Buff < UIWidget
  Label
    id: buffText
    color: #FF0000FF
    width:100
    heigth:10
    anchors.top: parent.top
    anchors.left: parent.left
    text: test

  Label
    width:100
    heigth:10
    anchors.top: parent.top
    anchors.left: prev.right
    id: buffDuration




MiniWindow
  text: Buffs
  id: buffWindow
  height: 100
  &save: true
  @onClose: onMiniWindowClose()
  MiniWindowContents
    TextList
      id:buffList
      anchors.top: parent.top
      anchors.left: parent.left
      anchors.right: parent.right
      anchors.bottom: parent.bottom
      visible:true

and here is buff_timer.lua
Lua:
function init()
  connect(g_game, {onTalk = onTextMessage} )



  buffButton = modules.client_topmenu.addRightGameToggleButton('buffButton', tr('buffs'), '', toggle)
  buffButton:setOn(true)

  buffWindow = g_ui.loadUI('buff_timer', modules.game_interface.getRightPanel())

  buffs = buffWindow:recursiveGetChildById('buffList')


  buffWindow:setup()

end


function terminate()
  disconnect(g_game, {onTalk = onTextMessage} )
  buffWindow:close()
  buffWindow:destroy()
  buffButton:destroy()
end


function onTextMessage(name, level, mode, message, channelId, creaturePos)


  if message == "escudo extraplanar" and name == g_game.getLocalPlayer():getName() then
      children = buffs:getChildren()
      found = false
      for k,v in pairs(children) do
        modules.client_terminal.tprint(v:getChildById('buffText'):getPosition())
        if v:getChildById('buffText'):getText() == "Utamo" then
          found = true
          v:getChildById('buffDuration'):setText('30')
          break
        end
      end
     
      if not found then
        local widget = g_ui.createWidget('Buff', buffs)
        widget:getChildById('buffText'):setText('Utamo')
        widget:getChildById('buffDuration'):setText('30')
        widget:setVisible(true)
        modules.client_terminal.tprint(widget:getPosition())
        print(widget:isVisible(), widget:getChildById('buffDuration'):isVisible(), widget:getChildById('buffText'):isVisible())
      end
  end
end


function toggle()
  if buffButton:isOn() then
    buffWindow:close()
    buffButton:setOn(false)
  else
    buffWindow:open()
    buffButton:setOn(true)
  end
end


function onMiniWindowClose()
  buffButton:setOn(false)
end

Edit: Adding screenshot
2020-03-30 (5).png
 
Last edited:
Back
Top