• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

OTClient repeatedly open written items otv8

bpm91

Advanced OT User
Joined
May 23, 2019
Messages
1,046
Solutions
7
Reaction score
180
Location
Brazil
YouTube
caruniawikibr
Hi, has anyone had this bug? does anyone have an idea how to fix this?
all items such as papers, letters, written things etc... can be opened innumerable windows, instead of opening and closing item by item normally.
i use otv8 tf 1.5
WhatsApp Image 2023-01-19 at 20.26.50.jpeg
 
what about the issue related to openning backpack multiple times in the same panel did you fixed that man? D: i've searched but have had no success
 
I couldn't, I have the feeling that the right panel is bigger in size however the screen doesn't show the rest of the panel
I need to find out the name of that panel on the right that holds inventories, backpacks, etc... it has an extra size down that I need to reduce


WhatsApp Image 2023-01-19 at 22.13.44.jpeg
 
I'm not sure if anyone is still looking for this, but this was my solution to this problem:
modules\game_textwindow\textwindow.lua
LUA:
windows = {}
local activeTextWindow = nil

function init()
  g_ui.importStyle('textwindow')

  connect(g_game, {
    onEditText = onGameEditText,
    onEditList = onGameEditList,
    onGameEnd  = destroyWindows
  })
end

function terminate()
  disconnect(g_game, {
    onEditText = onGameEditText,
    onEditList = onGameEditList,
    onGameEnd  = destroyWindows
  })

  destroyWindows()
end

function destroyWindows()
  for _, window in pairs(windows) do
    window:destroy()
  end
  windows = {}
  activeTextWindow = nil
end

function onGameEditText(id, itemId, maxLength, text, writer, time)

  if activeTextWindow then
    return
  end

  local writeable = maxLength > 0 and #text < maxLength

  local textWindow = g_ui.createWidget('TextWindow', rootWidget)
  activeTextWindow = textWindow

  local textItem    = textWindow:getChildById('textItem')
  local description = textWindow:getChildById('description')
  local textEdit    = textWindow:getChildById('text')
  local okButton    = textWindow:getChildById('okButton')
  local cancelButton= textWindow:getChildById('cancelButton')

  local thing = g_things.getThingType(itemId)
  if writeable and thing and thing:hasAttribute(ThingAttrWritableOnce) and #writer > 0 then
    writeable = false
  end

  textItem:setItemId(itemId)
  textEdit:setMaxLength(maxLength)
  textEdit:setText(text)
  textEdit:setEditable(writeable)
  textEdit:setCursorVisible(writeable)

  local desc = tr('You read the following.')
  if #writer > 0 then
    desc = tr('You read the following, written by \n%s', writer)
    if #time > 0 then
      desc = desc .. tr(' on %s.\n', time)
    else
      desc = desc .. '.\n'
    end
  elseif #time > 0 then
    desc = tr('You read the following, written on \n%s.\n', time)
  end

  if #text == 0 and not writeable then
    desc = tr('It is empty.')
  elseif writeable and #text == 0 then
    desc = tr('It is currently empty.\nYou can enter new text.')
  elseif writeable then
    desc = desc .. tr('You can enter new text.')
  end

  description:setText(desc)

  if not writeable then
    textWindow:setText(tr('Show Text'))
    cancelButton:hide()
    cancelButton:setWidth(0)
  else
    textWindow:setText(tr('Edit Text'))
  end

  local function destroy()
    activeTextWindow = nil
    textWindow:destroy()
    table.removevalue(windows, textWindow)
  end

  okButton.onClick = function()
    if writeable then
      g_game.editText(id, textEdit:getText())
    end
    destroy()
  end

  cancelButton.onClick = destroy
  textWindow.onEscape = destroy

  table.insert(windows, textWindow)
end

function onGameEditList(id, doorId, text)

  if activeTextWindow then
    return
  end

  local textWindow = g_ui.createWidget('TextWindow', rootWidget)
  activeTextWindow = textWindow

  local textEdit    = textWindow:getChildById('text')
  local description = textWindow:getChildById('description')
  local okButton    = textWindow:getChildById('okButton')
  local cancelButton= textWindow:getChildById('cancelButton')

  local textItem = textWindow:getChildById('textItem')
  if textItem then textItem:hide() end

  textEdit:setMaxLength(8192)
  textEdit:setText(text)
  textEdit:setEditable(true)

  description:setText(tr('Enter one name per line.'))
  textWindow:setText(tr('Edit List'))

  local function destroy()
    activeTextWindow = nil
    textWindow:destroy()
    table.removevalue(windows, textWindow)
  end

  okButton.onClick = function()
    g_game.editList(id, doorId, textEdit:getText())
    destroy()
  end

  cancelButton.onClick = destroy
  textWindow.onEscape = destroy

  table.insert(windows, textWindow)
end
 
I'm not sure if anyone is still looking for this, but this was my solution to this problem:
modules\game_textwindow\textwindow.lua
LUA:
windows = {}
local activeTextWindow = nil

function init()
  g_ui.importStyle('textwindow')

  connect(g_game, {
    onEditText = onGameEditText,
    onEditList = onGameEditList,
    onGameEnd  = destroyWindows
  })
end

function terminate()
  disconnect(g_game, {
    onEditText = onGameEditText,
    onEditList = onGameEditList,
    onGameEnd  = destroyWindows
  })

  destroyWindows()
end

function destroyWindows()
  for _, window in pairs(windows) do
    window:destroy()
  end
  windows = {}
  activeTextWindow = nil
end

function onGameEditText(id, itemId, maxLength, text, writer, time)

  if activeTextWindow then
    return
  end

  local writeable = maxLength > 0 and #text < maxLength

  local textWindow = g_ui.createWidget('TextWindow', rootWidget)
  activeTextWindow = textWindow

  local textItem    = textWindow:getChildById('textItem')
  local description = textWindow:getChildById('description')
  local textEdit    = textWindow:getChildById('text')
  local okButton    = textWindow:getChildById('okButton')
  local cancelButton= textWindow:getChildById('cancelButton')

  local thing = g_things.getThingType(itemId)
  if writeable and thing and thing:hasAttribute(ThingAttrWritableOnce) and #writer > 0 then
    writeable = false
  end

  textItem:setItemId(itemId)
  textEdit:setMaxLength(maxLength)
  textEdit:setText(text)
  textEdit:setEditable(writeable)
  textEdit:setCursorVisible(writeable)

  local desc = tr('You read the following.')
  if #writer > 0 then
    desc = tr('You read the following, written by \n%s', writer)
    if #time > 0 then
      desc = desc .. tr(' on %s.\n', time)
    else
      desc = desc .. '.\n'
    end
  elseif #time > 0 then
    desc = tr('You read the following, written on \n%s.\n', time)
  end

  if #text == 0 and not writeable then
    desc = tr('It is empty.')
  elseif writeable and #text == 0 then
    desc = tr('It is currently empty.\nYou can enter new text.')
  elseif writeable then
    desc = desc .. tr('You can enter new text.')
  end

  description:setText(desc)

  if not writeable then
    textWindow:setText(tr('Show Text'))
    cancelButton:hide()
    cancelButton:setWidth(0)
  else
    textWindow:setText(tr('Edit Text'))
  end

  local function destroy()
    activeTextWindow = nil
    textWindow:destroy()
    table.removevalue(windows, textWindow)
  end

  okButton.onClick = function()
    if writeable then
      g_game.editText(id, textEdit:getText())
    end
    destroy()
  end

  cancelButton.onClick = destroy
  textWindow.onEscape = destroy

  table.insert(windows, textWindow)
end

function onGameEditList(id, doorId, text)

  if activeTextWindow then
    return
  end

  local textWindow = g_ui.createWidget('TextWindow', rootWidget)
  activeTextWindow = textWindow

  local textEdit    = textWindow:getChildById('text')
  local description = textWindow:getChildById('description')
  local okButton    = textWindow:getChildById('okButton')
  local cancelButton= textWindow:getChildById('cancelButton')

  local textItem = textWindow:getChildById('textItem')
  if textItem then textItem:hide() end

  textEdit:setMaxLength(8192)
  textEdit:setText(text)
  textEdit:setEditable(true)

  description:setText(tr('Enter one name per line.'))
  textWindow:setText(tr('Edit List'))

  local function destroy()
    activeTextWindow = nil
    textWindow:destroy()
    table.removevalue(windows, textWindow)
  end

  okButton.onClick = function()
    g_game.editList(id, doorId, textEdit:getText())
    destroy()
  end

  cancelButton.onClick = destroy
  textWindow.onEscape = destroy

  table.insert(windows, textWindow)
end
ty bro
 
Back
Top