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

Lua disable otcv8 using the same letter over and over + containers appearing behind windows10task bar

Jpstafe

Well-Known Member
Joined
Aug 8, 2011
Messages
507
Reaction score
68
Disable opening letters over and over(and maybe other readable) in otcv8.
Also containers does not respect the windows10 bar margin, so if i open a container i will appear behind windows10 task bar(this might be occurring in linux too(not sure). is there a way to avoid this? have not found solution for this



Sin título.png
 
The current code of RightPanel:
Lua:
function getContainerPanel()
  local containerPanel = g_settings.getNumber("containerPanel")
  if containerPanel >= 5 then
    containerPanel = containerPanel - 4
    return gameRightPanels:getChildByIndex(math.min(containerPanel, gameRightPanels:getChildCount()))
  end
  if gameLeftPanels:getChildCount() == 0 then
    return getRightPanel()
  end
  return gameLeftPanels:getChildByIndex(math.min(containerPanel, gameLeftPanels:getChildCount()))
end

local function addRightPanel()
  if gameRightPanels:getChildCount() >= 4 then
    return
  end
  local panel = g_ui.createWidget('GameSidePanel')
  panel:setId("rightPanel" .. (gameRightPanels:getChildCount() + 1))
  gameRightPanels:insertChild(1, panel)
end

function getRightPanel()
  if gameRightPanels:getChildCount() == 0 then
    addRightPanel()
  end
  return gameRightPanels:getChildByIndex(-1)
end

local function removeRightPanel()
  if gameRightPanels:getChildCount() <= 1 then
    return
  end
  local panel = gameRightPanels:getChildByIndex(1)
  panel:moveTo(gameRightPanels:getChildByIndex(2))
  gameRightPanels:removeChild(panel)
end

function refreshViewMode() 
  local classic = g_settings.getBoolean("classicView") and not g_app.isMobile()
  local rightPanels = g_settings.getNumber("rightPanels") - gameRightPanels:getChildCount()
  local leftPanels = g_settings.getNumber("leftPanels") - 1 - gameLeftPanels:getChildCount()

  while rightPanels ~= 0 do
    if rightPanels > 0 then
      addRightPanel()
      rightPanels = rightPanels - 1
    else
      removeRightPanel()
      rightPanels = rightPanels + 1
    end
  end
    local minimumWidth = (g_settings.getNumber("rightPanels") + g_settings.getNumber("leftPanels") - 1) * 200 + 200
  minimumWidth = math.max(minimumWidth, g_resources.getLayout() == "mobile" and 640 or 800)
  g_window.setMinimumSize({ width = minimumWidth, height = (g_resources.getLayout() == "mobile" and 360 or 600)})
  if g_window.getWidth() < minimumWidth then
    local oldPos = g_window.getPosition()
    local size = { width = minimumWidth, height = g_window.getHeight() }
    g_window.resize(size)
    g_window.move(oldPos)
  end

  for i=1,gameRightPanels:getChildCount()+gameLeftPanels:getChildCount() do
    local panel
    if i > gameRightPanels:getChildCount() then
      panel = gameLeftPanels:getChildByIndex(i - gameRightPanels:getChildCount())
    else
      panel = gameRightPanels:getChildByIndex(i)
    end
    if classic then
      panel:setImageColor('white')
    else
      panel:setImageColor('alpha')
    end
  end
 
  if classic then
    gameRightPanels:setMarginTop(0)
    gameLeftPanels:setMarginTop(0)
    gameMapPanel:setMarginLeft(0)
    gameMapPanel:setMarginRight(0)
    gameMapPanel:setMarginTop(0)
  end

Modifications:
To limit to 4 the max right panels

Lua:
local maxRightPanels = 4

Modify function "addRightPanel" to:
Lua:
local function addRightPanel()
  if gameRightPanels:getChildCount() >= maxRightPanels then
    return
  end
  local panel = g_ui.createWidget('GameSidePanel')
  panel:setId("rightPanel" .. (gameRightPanels:getChildCount() + 1))
  gameRightPanels:insertChild(1, panel)
end

Update the function "refreshViewMode" to
Lua:
function refreshViewMode() 
  -- The rest of the existing code here
  -- Checks if you have exceeded the maximum limit of open panels in the right panel
  while gameRightPanels:getChildCount() > maxRightPanels do
    removeRightPanel()
  end
  -- The rest of the existing code here
end
 
The current code of RightPanel:
Lua:
function getContainerPanel()
  local containerPanel = g_settings.getNumber("containerPanel")
  if containerPanel >= 5 then
    containerPanel = containerPanel - 4
    return gameRightPanels:getChildByIndex(math.min(containerPanel, gameRightPanels:getChildCount()))
  end
  if gameLeftPanels:getChildCount() == 0 then
    return getRightPanel()
  end
  return gameLeftPanels:getChildByIndex(math.min(containerPanel, gameLeftPanels:getChildCount()))
end

local function addRightPanel()
  if gameRightPanels:getChildCount() >= 4 then
    return
  end
  local panel = g_ui.createWidget('GameSidePanel')
  panel:setId("rightPanel" .. (gameRightPanels:getChildCount() + 1))
  gameRightPanels:insertChild(1, panel)
end

function getRightPanel()
  if gameRightPanels:getChildCount() == 0 then
    addRightPanel()
  end
  return gameRightPanels:getChildByIndex(-1)
end

local function removeRightPanel()
  if gameRightPanels:getChildCount() <= 1 then
    return
  end
  local panel = gameRightPanels:getChildByIndex(1)
  panel:moveTo(gameRightPanels:getChildByIndex(2))
  gameRightPanels:removeChild(panel)
end

function refreshViewMode()
  local classic = g_settings.getBoolean("classicView") and not g_app.isMobile()
  local rightPanels = g_settings.getNumber("rightPanels") - gameRightPanels:getChildCount()
  local leftPanels = g_settings.getNumber("leftPanels") - 1 - gameLeftPanels:getChildCount()

  while rightPanels ~= 0 do
    if rightPanels > 0 then
      addRightPanel()
      rightPanels = rightPanels - 1
    else
      removeRightPanel()
      rightPanels = rightPanels + 1
    end
  end
    local minimumWidth = (g_settings.getNumber("rightPanels") + g_settings.getNumber("leftPanels") - 1) * 200 + 200
  minimumWidth = math.max(minimumWidth, g_resources.getLayout() == "mobile" and 640 or 800)
  g_window.setMinimumSize({ width = minimumWidth, height = (g_resources.getLayout() == "mobile" and 360 or 600)})
  if g_window.getWidth() < minimumWidth then
    local oldPos = g_window.getPosition()
    local size = { width = minimumWidth, height = g_window.getHeight() }
    g_window.resize(size)
    g_window.move(oldPos)
  end

  for i=1,gameRightPanels:getChildCount()+gameLeftPanels:getChildCount() do
    local panel
    if i > gameRightPanels:getChildCount() then
      panel = gameLeftPanels:getChildByIndex(i - gameRightPanels:getChildCount())
    else
      panel = gameRightPanels:getChildByIndex(i)
    end
    if classic then
      panel:setImageColor('white')
    else
      panel:setImageColor('alpha')
    end
  end
 
  if classic then
    gameRightPanels:setMarginTop(0)
    gameLeftPanels:setMarginTop(0)
    gameMapPanel:setMarginLeft(0)
    gameMapPanel:setMarginRight(0)
    gameMapPanel:setMarginTop(0)
  end

Modifications:
To limit to 4 the max right panels

Lua:
local maxRightPanels = 4

Modify function "addRightPanel" to:
Lua:
local function addRightPanel()
  if gameRightPanels:getChildCount() >= maxRightPanels then
    return
  end
  local panel = g_ui.createWidget('GameSidePanel')
  panel:setId("rightPanel" .. (gameRightPanels:getChildCount() + 1))
  gameRightPanels:insertChild(1, panel)
end

Update the function "refreshViewMode" to
Lua:
function refreshViewMode()
  -- The rest of the existing code here
  -- Checks if you have exceeded the maximum limit of open panels in the right panel
  while gameRightPanels:getChildCount() > maxRightPanels do
    removeRightPanel()
  end
  -- The rest of the existing code here
end
don't want to limits max panells i want to make a margin at the bottom so the issue related to containers would not happen
Disable opening letters over and over(and maybe other readable) in otcv8.
Also containers does not respect the windows10 bar margin, so if i open a container i will appear behind windows10 task bar(this might be occurring in linux too(not sure). is there a way to avoid this? have not found solution for this



View attachment 75290
as you can see a container is opening behind the task bar

also want to make not possible to use a ltter more than once
 
Lua:
local maxRightPanelHeight = g_window.getHeight() - g_window.getTaskbarHeight()
local function addRightPanel()
  local panelHeight = 100

  if gameRightPanels:getChildCount() >= 1 then
    local totalHeight = panelHeight * gameRightPanels:getChildCount()
    if totalHeight >= maxRightPanelHeight then
      removeRightPanel()
    end
  end

  local panel = g_ui.createWidget('GameSidePanel')
  panel:setId("rightPanel" .. (gameRightPanels:getChildCount() + 1))
  gameRightPanels:insertChild(1, panel)
end

local function removeRightPanel()
  if gameRightPanels:getChildCount() <= 1 then
    return
  end
  local panel = gameRightPanels:getChildByIndex(1)
  gameRightPanels:removeChild(panel)
end
:D
 
Lua:
local maxRightPanelHeight = g_window.getHeight() - g_window.getTaskbarHeight()
local function addRightPanel()
  local panelHeight = 100

  if gameRightPanels:getChildCount() >= 1 then
    local totalHeight = panelHeight * gameRightPanels:getChildCount()
    if totalHeight >= maxRightPanelHeight then
      removeRightPanel()
    end
  end

  local panel = g_ui.createWidget('GameSidePanel')
  panel:setId("rightPanel" .. (gameRightPanels:getChildCount() + 1))
  gameRightPanels:insertChild(1, panel)
end

local function removeRightPanel()
  if gameRightPanels:getChildCount() <= 1 then
    return
  end
  local panel = gameRightPanels:getChildByIndex(1)
  gameRightPanels:removeChild(panel)
end
:D
Lua:
OTCv8 3.1 rev 163 (dev) made by otclient.net built on Mar 31 2022 for arch x86
FATAL ERROR: Unable to load module 'game_interface': /modules/game_interface/gameinterface.lua:854: attempt to call field 'getTaskbarHeight' (a nil value)
stack traceback:
    [C]: in function 'getTaskbarHeight'
    /modules/game_interface/gameinterface.lua:854: in main chunk
    [C]: in function 'ensureModuleLoaded'
    /init.lua:76: in function 'loadModules'
    /init.lua:97: in main chunk
tried to change for this but had no lucky
Code:
g-window.getmaxRightPanelHeight
 
Lua:
function getContainerPanel()
  local containerPanel = g_settings.getNumber("containerPanel")
  if containerPanel >= 5 then
    containerPanel = containerPanel - 4
    return gameRightPanels:getChildByIndex(math.min(containerPanel, gameRightPanels:getChildCount()))
  end
  if gameLeftPanels:getChildCount() == 0 then
    return getRightPanel()
  end
  return gameLeftPanels:getChildByIndex(math.min(containerPanel, gameLeftPanels:getChildCount()))
end
--code /open containers behind taskbar
local maxRightPanelHeight = g_window.getHeight() - g_window.getTaskbarHeight()
local function addRightPanel()
  local panelHeight = 100

  if gameRightPanels:getChildCount() >= 1 then
    local totalHeight = panelHeight * gameRightPanels:getChildCount()
    if totalHeight >= maxRightPanelHeight then
      removeRightPanel()
    end
  end
  --code /open containers behind taskbar
  local panel = g_ui.createWidget('GameSidePanel')
  panel:setId("rightPanel" .. (gameRightPanels:getChildCount() + 1))
  gameRightPanels:insertChild(1, panel)
end

Code:
local function getTaskbarHeight()
  if g_window.getTaskbarHeight then
    return g_window.getTaskbarHeight()
  end
  return 40
end

if there is a little space in the panel the backpack get still open even if i can not see if because it's behind the windows task bar
 
it is anti cheat feature.
it works like this you create opcode that detects items being looted and present the "botting player" to more monsters that he can loot if he loots you have a verdict. (he didnt send close container opcode before looting (based on his client resolution ))
 
Back
Top