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

otcv8 bot custom button help

Dran Ryszard

Active Member
Joined
Apr 25, 2023
Messages
136
Reaction score
30
Location
Poland
Hi, i was tried make a custom button when i put a others script, then i want few button, one per ots where i play.
But for now i have problem, couse if i use a button in extras then nothing happend, but if that butten is used (lighting green) then when i turn off and on bot, then it show me that window :(

Code:
setDefaultTab("Main")

-- securing storage namespace
local panelName = "TEST.COM"
if not storage[panelName] then
  storage[panelName] = {}
end
local settings = storage[panelName]

-- basic elements
extrasWindow2 = UI.createWindow('ExtrasWindow2', rootWidget)
extrasWindow2:hide()
extrasWindow2.closeButton.onClick = function(widget)
  extrasWindow2:hide()
end

extrasWindow.onGeometryChange = function(widget, old, new)
  if old.height == 0 then return end
 
  settings.height = new.height
end

extrasWindow2:setHeight(700)

-- available options for dest param
local rightPanel = extrasWindow2.content.right
local leftPanel = extrasWindow2.content.left

-- objects made by Kondrah - taken from creature editor, minor changes to adapt
local addCheckBox = function(id, title, defaultValue, dest, tooltip)
  local widget = UI.createWidget('ExtrasCheckBox', dest)
  widget.onClick = function()
    widget:setOn(not widget:isOn())
    settings[id] = widget:isOn()
    if id == "checkPlayer" then
      local label = rootWidget.newHealer.targetSettings.vocations.title
      if not widget:isOn() then
        label:setColor("#d9321f")
        label:setTooltip("! WARNING ! \nTurn on check players in extras to use this feature!")
      else
          label:setColor("#dfdfdf")
          label:setTooltip("")
      end
    end
  end
  widget:setText(title)
  widget:setTooltip(tooltip)
  if settings[id] == nil then
    widget:setOn(defaultValue)
  else
    widget:setOn(settings[id])
  end
  settings[id] = widget:isOn()
end


UI.Button("TEST.COM", function()
  extrasWindow2:show()
  extrasWindow2:raise()
  extrasWindow2:focus()
end)


-- START
addCheckBox("text_with_answers", "test text box", true, rightPanel, "test text box")
if true then
if not settings.text_with_answers then return end
  UI.MultilineEditorWindow("blablablalbalblablalba", {title="test text box"}, function(text)
    storage.textWithAnswers = text
  end)
end
-- END
 
Back
Top