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

turning the top menu into pop-up menu

Nitned

New Member
Joined
Sep 5, 2012
Messages
6
Reaction score
0
Hi, I turned Topmenu into a Suspended Menu, and left only 1 button to test, I would like to know how to make this button execute another script.
example;
clicking this button will launch Client_Options, opening the Options window.
23kvn0n.png


Lua code:
Lua:
function init()
  menuWindow = g_ui.displayUI('menu.otui')
  menuWindow:hide()
  menuButton = modules.client_topmenu.addLeftButton('menuButton', tr('Menu'), '/images/topbuttons/menu', onoff, true)
  g_keyboard.bindKeyDown('Ctrl+Z', toggle)
  menuWindow:disableResize()
  local mw = g_ui.createWidget('Panel')
  mw:setParent(modules.game_interface.getRootPanel())
end

function terminate()
  menuWindow:hide()
end


function onoff()
  if menuWindow:isVisible() then
    menuWindow:hide()
  else
  menuWindow:show()
  end
end

Otui code:
Code:
Panel
  id: menuWindow
  !text: tr("")
  font: terminus-14px-bold
  text-align: center, top
  color: black
  anchors.left: parent.left
  anchors.top: parent.top
  anchors.right: parent.left
  anchors.bottom: parent.top
  margin-left: 32
  margin-top: 0
  margin-right: -190
  margin-bottom: -240
  width: 190
  height: 240
  @onEnter: mods.client_menu.hide()
  @onEscape: mods.client_menu.hide()

  Button
    id: optionsButton
    size: 190 40
    anchors.left: parent.left
    anchors.top: parent.top
    icon: /images/game/menu/botaoBranco
    $hover !disabled:
      icon: /images/game/menu/botaoLaranja
 
Last edited:
in .otui file under the button's declaration add:
Lua:
@onClick: modules.client_options
or something similar.

Lua:
Button
    id: optionsButton
    size: 190 40
    anchors.left: parent.left
    anchors.top: parent.top
    icon: /images/game/menu/botaoBranco
    $hover !disabled:
      icon: /images/game/menu/botaoLaranja
    @onClick: modules.client_options
 
Back
Top