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

TFS 1.X+ OTCv8 Action bar problem

Wilku93

Member
Joined
Jul 7, 2024
Messages
36
Reaction score
9
GitHub
Wilku93
Hi :)
I noticed a bug on my OTCv8. If I have an icon on the Action Bar and want to move it next to another tile or onto a different one, my cursor gets stuck in a "cross" state. Only restarting the client fixes the problem.

Does anyone know how to fix this?

TFS 1.4.2

Thanks in advance! :)


 
Hi :)
I noticed a bug on my OTCv8. If I have an icon on the Action Bar and want to move it next to another tile or onto a different one, my cursor gets stuck in a "cross" state. Only restarting the client fixes the problem.

Does anyone know how to fix this?

TFS 1.4.2

Thanks in advance! :)


I don't know if you still need it, but mine was solved by leaving these two lines as true

actionbar.lua

mouseGrabberWidget:setVisible(true)
mouseGrabberWidget:setFocusable(true)
 
I don't know if you still need it, but mine was solved by leaving these two lines as true

actionbar.lua

mouseGrabberWidget:setVisible(true)
mouseGrabberWidget:setFocusable(true)
Thank you for your answer :)

I managed to fix it in a different way :D But maybe someone will benefit from it

Now I'm struggling with how to display the quantity of items in the backpack on the action bar
 
Last edited:
I did it, but sometimes I still have the same problem - after moving the icons on the action bar from left to right (or vice versa), the action bar suddenly freezes and the cursor changes to "cross" :/ Is there any other way to fix it? OTCv8 TFS 1.4.2
 
Does anyone know how to solve this so that when moving from one place to another on the action bar next to, for example, a rune, the cursor doesn't get bugged? :D I've never seen this on OTS, so I'm sure it can be done somehow.

I have OTCv8 TFS 1.4.2
 
Hi :)
I noticed a bug on my OTCv8. If I have an icon on the Action Bar and want to move it next to another tile or onto a different one, my cursor gets stuck in a "cross" state. Only restarting the client fixes the problem.

Does anyone know how to fix this?

TFS 1.4.2

Thanks in advance! :)




Find:

LUA:
function init()
  connect(g_game, {
    onGameStart = online,
    onGameEnd = offline,
    onSpellGroupCooldown = onSpellGroupCooldown,
    onSpellCooldown = onSpellCooldown
  })

  if g_game.isOnline() then
    online()
  end

  -- taken from game_hotkeys
  mouseGrabberWidget = g_ui.createWidget('UIWidget')
  mouseGrabberWidget:setVisible(false)
  mouseGrabberWidget:setFocusable(false)
  mouseGrabberWidget.onMouseRelease = onDropActionButton
end

replace by:

Code:
function init()
  connect(g_game, {
    onGameStart = online,
    onGameEnd = offline,
    onSpellGroupCooldown = onSpellGroupCooldown,
    onSpellCooldown = onSpellCooldown
  })

  if g_game.isOnline() then
    online()
  end

  createMouseGrabber()
end

function createMouseGrabber()
   if mouseGrabberWidget then
     mouseGrabberWidget:destroy()
   end
 
   mouseGrabberWidget = g_ui.createWidget('UIWidget')
   mouseGrabberWidget:setVisible(false)
   mouseGrabberWidget:setFocusable(false)
   mouseGrabberWidget.onMouseRelease = onDropActionButton
end

find:

Code:
function terminate()
  disconnect(g_game, {
    onGameStart = online,
    onGameEnd = offline,
    onSpellGroupCooldown = onSpellGroupCooldown,
    onSpellCooldown = onSpellCooldown
  })
end

replace:


Code:
function terminate()
   disconnect(g_game, {
     onGameStart = online,
     onGameEnd = offline,
     onSpellGroupCooldown = onSpellGroupCooldown,
     onSpellCooldown = onSpellCooldown
   })
 
   if mouseGrabberWidget then
     mouseGrabberWidget:destroy()
     mouseGrabberWidget = nil
   end
 end

find:

Code:
function offline()
  -- save settings to json
  save()

  -- destroy windows
  destroyAssignWindows()
  mouseGrabberWidget:destroy()

  -- remove binds
  for index, actionbar in ipairs(actionBars) do
    if actionbar.tabBar then
      for i, actionButton in ipairs(actionbar.tabBar:getChildren()) do
        local callback = actionButton.callback
        local hotkey = actionButton.hotkey and actionButton.hotkey:len() > 0 and actionButton.hotkey or false

        if callback and hotkey then
          local gameRootPanel = modules.game_interface.getRootPanel()
          g_keyboard.unbindKeyPress(hotkey, callback, gameRootPanel)
        end
      end
    end
  end

  -- destroy actionbars
  for i, panel in ipairs(actionBars) do
    panel:destroy()
  end
end

replace by:

Code:
function offline()
   -- save settings to json
   save()
 
   -- destroy windows
   if cachedSettings then
     cachedSettings.widget.item:setBorderColor('#00000000')
     cachedSettings = nil
   end
   g_mouse.popCursor('target')
   mouseGrabberWidget:destroy()
 
   if g_ui.isMouseGrabbed() then
     mouseGrabberWidget:ungrabMouse()
   end
 
   destroyAssignWindows()
 
   for _, actionbar in ipairs(actionBars) do
     if actionbar.tabBar and actionbar.tabBar.scrollTimer then
       removeEvent(actionbar.tabBar.scrollTimer)
       actionbar.tabBar.scrollTimer = nil
       actionbar.tabBar:setScrollable(true)
     end
   end
 
   mouseGrabberWidget:destroy()
 
   -- remove binds
   for index, actionbar in ipairs(actionBars) do
     if actionbar.tabBar then
       for i, actionButton in ipairs(actionbar.tabBar:getChildren()) do
         local callback = actionButton.callback
         local hotkey = actionButton.hotkey and actionButton.hotkey:len() > 0 and actionButton.hotkey or false
 
         if callback and hotkey then
           local gameRootPanel = modules.game_interface.getRootPanel()
           g_keyboard.unbindKeyPress(hotkey, callback, gameRootPanel)
         end
       end
     end
   end
 
   -- destroy actionbars
   for i, panel in ipairs(actionBars) do
     panel:destroy()
   end
 
   actionBars = {}
   cachedSettings = nil
 end

find:

Code:
function online()
  settingsFile = modules.client_profiles.getSettingsFilePath("actionbar_v2.json")
  -- load settings
  load()

  -- create actionbars
  createActionBars()

  -- show & setup actionbars
  show()

  destroyAssignWindows()
end

replace:

Code:
function online()
   settingsFile = modules.client_profiles.getSettingsFilePath("actionbar_v2.json")
 
   if g_ui.isMouseGrabbed() then
     mouseGrabberWidget:ungrabMouse()
   end
   g_mouse.popCursor('target')
   cachedSettings = nil
 
   createMouseGrabber()
   -- load settings
   load()
 
   -- create actionbars
   createActionBars()
 
   -- show & setup actionbars
   show()
 
   destroyAssignWindows()
 end


find:
Code:
function onDropActionButton(self, mousePosition, mouseButton)
  if not g_ui.isMouseGrabbed() then return end

  local clickedWidget = modules.game_interface.getRootPanel():recursiveGetChildByPos(mousePosition, false)
  if clickedWidget and clickedWidget:getParent() and clickedWidget:getParent():getStyleName():find('ActionButton') then
    if cachedSettings then
      clickedWidget = clickedWidget:getParent()
      if clickedWidget ~= cachedSettings.widget then
        local clickedHotkey = clickedWidget.hotkey
        local cachedHotkey = cachedSettings.widget.hotkey

        settings[cachedSettings.id] = settings[clickedWidget:getId()]
        settings[clickedWidget:getId()] = cachedSettings.data
        
        local clickedTill = clickedWidget.cooldownTill or 0
        local clickedStart = clickedWidget.cooldownStart or 0
        local cachedTill = cachedSettings.widget.cooldownTill or 0
        local cachedStart = cachedSettings.widget.cooldownStart or 0

        cachedSettings.widget.cooldownTill = clickedTill
        cachedSettings.widget.cooldownStart = clickedStart
        clickedWidget.cooldownTill = cachedTill
        clickedWidget.cooldownStart = cachedStart

        -- hotkeys remain unchanged
        settings[cachedSettings.id] = settings[cachedSettings.id] or {}
        settings[cachedSettings.id].hotkey = cachedHotkey
        settings[clickedWidget:getId()] = settings[clickedWidget:getId()] or {}
        settings[clickedWidget:getId()].hotkey = clickedHotkey

        updateCooldown(clickedWidget)
        updateCooldown(cachedSettings.widget)
        setupButton(cachedSettings.widget)
        setupButton(clickedWidget)
      end
    end
  end

  cachedSettings.widget.item:setBorderColor('#00000000')
  cachedSettings = nil
  g_mouse.popCursor('target')
  self:ungrabMouse()
end

replace by:

Code:
function onDropActionButton(self, mousePosition, mouseButton)
   if not g_ui.isMouseGrabbed() then return end
 
   local clickedWidget = modules.game_interface.getRootPanel():recursiveGetChildByPos(mousePosition, false)
 
   if not clickedWidget then
     if cachedSettings then
       cachedSettings.widget.item:setBorderColor('#00000000')
       cachedSettings = nil
     end
     g_mouse.popCursor('target')
     self:ungrabMouse()
     return
   end
 
   if clickedWidget and clickedWidget:getParent() and clickedWidget:getParent():getStyleName():find('ActionButton') then
     if cachedSettings then
       clickedWidget = clickedWidget:getParent()
       if clickedWidget ~= cachedSettings.widget then
         local clickedHotkey = clickedWidget.hotkey
         local cachedHotkey = cachedSettings.widget.hotkey
 
         settings[cachedSettings.id] = settings[clickedWidget:getId()]
         settings[clickedWidget:getId()] = cachedSettings.data
 
         local clickedTill = clickedWidget.cooldownTill or 0
         local clickedStart = clickedWidget.cooldownStart or 0
         local cachedTill = cachedSettings.widget.cooldownTill or 0
         local cachedStart = cachedSettings.widget.cooldownStart or 0
 
         cachedSettings.widget.cooldownTill = clickedTill
         cachedSettings.widget.cooldownStart = clickedStart
         clickedWidget.cooldownTill = cachedTill
         clickedWidget.cooldownStart = cachedStart
 
         -- hotkeys remain unchanged
         settings[cachedSettings.id] = settings[cachedSettings.id] or {}
         settings[cachedSettings.id].hotkey = cachedHotkey
         settings[clickedWidget:getId()] = settings[clickedWidget:getId()] or {}
         settings[clickedWidget:getId()].hotkey = clickedHotkey
 
         updateCooldown(clickedWidget)
         updateCooldown(cachedSettings.widget)
         setupButton(cachedSettings.widget)
         setupButton(clickedWidget)
       end
     end
   end
 
   cachedSettings.widget.item:setBorderColor('#00000000')
   cachedSettings = nil
   g_mouse.popCursor('target')
   self:ungrabMouse()
 end


Find and delete this line inside setupActionBar function:
Code:
actionbar.tabBar.onMouseWheel = nil -- disable scroll wheel

find setupButton(widget) function, at the bottom, before the end add:
Code:
widget.item.onDragStart = onDragStart


Then before function load() add:

Code:
function onDragStart(self)
   if g_ui.isMouseGrabbed() then return end
   local actionbar = self:getParent():getParent()
   if actionbar and actionbar.tabBar then
     actionbar.tabBar.scrollTimer = scheduleEvent(function()
       actionbar.tabBar:setScrollable(true)
     end, 100)
     actionbar.tabBar:setScrollable(false)
   end
 end


Mark as solved if this help you.
 
Back
Top