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

[MOD] Windows (BP, EQ, Battle etc.) can be dragged only to 'panels' (right/left)

how to make it work using otcv8?

fixed:

you have to replace the whole
Code:
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
with this one:

Code:
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)

  if self.movedWidget then
    self.setMovedChildMargin(self.movedOldMargin or 0)
    self.movedWidget = nil
    self.setMovedChildMargin = nil
    self.movedOldMargin = nil
    self.movedIndex = nil
  end


      local children = rootWidget:recursiveGetChildrenByMarginPos(mousePos)
      local dropInPanel = 0
      for i=1,#children do
        local child = children[i]
        if child:getId() == 'gameLeftPanel' or child:getId() == 'gameRightPanel' then
          dropInPanel = 1
        end
      end
      if dropInPanel == 0 then
        tmpp = self
        if(modules.game_interface.getLeftPanel():isVisible()) then
         if modules.game_interface.getRootPanel():getWidth() / 2 < mousePos.x then
           addEvent(function() tmpp:setParent(modules.game_interface.getRightPanel()) end)
         else
           addEvent(function() tmpp:setParent(modules.game_interface.getLeftPanel()) end)
         end
        else
          addEvent(function() tmpp:setParent(modules.game_interface.getRightPanel()) end)
        end
      end

end
I have another issue with this system..
when i add more than 1 panel in each side, i cant drag windows to secondary panels :oops:
Screenshot_1.png
 
thats true blasphemy,
you've gotta do it for yourself,
following the code you get the instructions, we gotta verify if the extra panel is active :)
 
thats true blasphemy,
you've gotta do it for yourself,
following the code you get the instructions, we gotta verify if the extra panel is active :)
nah.. just change a line
if child:getId() == 'gameLeftPanel' or child:getId() == 'gameRightPanel' then
for this
if child:getId() == 'gameLeftPanels' or child:getId() == 'gameRightPanels' then
But now, I have the "space" error (im with otcv8)

apparently fixed:

Lua:
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
  local children = rootWidget:recursiveGetChildrenByMarginPos(mousePos)
  local dropInPanel = 0
  for i=1,#children do
    local child = children[i]
    if child:getId() == 'gameLeftPanels' or child:getId() == 'gameRightPanels' then
      dropInPanel = 1
    end
  end
  if dropInPanel == 0 then
    tmpp = self
    if(modules.game_interface.getLeftPanel():isVisible()) then
     if modules.game_interface.getRootPanel():getWidth() / 2 < mousePos.x then
       addEvent(function() tmpp:setParent(modules.game_interface.getRightPanel()) end)
     else
       addEvent(function() tmpp:setParent(modules.game_interface.getLeftPanel()) end)
     end
    else
      addEvent(function() tmpp:setParent(modules.game_interface.getRightPanel()) end)
    end
  end

  if self.movedWidget then
    self.setMovedChildMargin(self.movedOldMargin or 0)
    self.movedWidget = nil
    self.setMovedChildMargin = nil
    self.movedOldMargin = nil
    self.movedIndex = nil
  end

  UIWindow:onDragLeave(self, droppedWidget, mousePos)
  self:saveParent(self:getParent())
end

if some one can test? and please tell me if has errors, i actually dont, ty
 
Last edited:
Back
Top