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

[OTCLIENT] Choose how many items u want drag only pressing CTRL

sucibob

Member
Joined
Mar 28, 2017
Messages
128
Reaction score
13
I've start to use OTClient i liked this a lot, but there is only one thing i miss from tibia 11...
And it's about The Box: 'Move Stackable Item'

F6TFUjw.png


When you drag items on OTClient you need to keep pressing CTRL + move item to don't show this box.
It's too tiring...

On tibia 11 is just opposite, you need to keep pressing CTRL + drag item to show this box and select how many you need to push...

Anybody know how to fix it and make like tibia 11? I think everybody agree thats better and a lot peoples will use this!
 
Probably in gameinterface.lua there is function responsible for, just switch belonging of keymodifier and it should do the trick.

@edit:

Replace default function moveStackableItem with this:
Lua:
function moveStackableItem(item, toPos)
  if countWindow then
    return
  end

  if g_keyboard.isCtrlPressed() then
    local count = item:getCount()

    countWindow = g_ui.createWidget('CountWindow', rootWidget)
    local itembox = countWindow:getChildById('item')
    local scrollbar = countWindow:getChildById('countScrollBar')
    itembox:setItemId(item:getId())
    itembox:setItemCount(count)
    scrollbar:setMaximum(count)
    scrollbar:setMinimum(1)
    scrollbar:setValue(count)

    local spinbox = countWindow:getChildById('spinBox')
    spinbox:setMaximum(count)
    spinbox:setMinimum(0)
    spinbox:setValue(0)
    spinbox:hideButtons()
    spinbox:focus()
    spinbox.firstEdit = true

    local spinBoxValueChange = function(self, value)
      spinbox.firstEdit = false
      scrollbar:setValue(value)
    end
    spinbox.onValueChange = spinBoxValueChange

    local check = function()
      if spinbox.firstEdit then
        spinbox:setValue(spinbox:getMaximum())
        spinbox.firstEdit = false
      end
    end
    g_keyboard.bindKeyPress("Up", function() check() spinbox:up() end, spinbox)
    g_keyboard.bindKeyPress("Down", function() check() spinbox:down() end, spinbox)
    g_keyboard.bindKeyPress("Right", function() check() spinbox:up() end, spinbox)
    g_keyboard.bindKeyPress("Left", function() check() spinbox:down() end, spinbox)
    g_keyboard.bindKeyPress("PageUp", function() check() spinbox:setValue(spinbox:getValue()+10) end, spinbox)
    g_keyboard.bindKeyPress("PageDown", function() check() spinbox:setValue(spinbox:getValue()-10) end, spinbox)

    scrollbar.onValueChange = function(self, value)
      itembox:setItemCount(value)
      spinbox.onValueChange = nil
      spinbox:setValue(value)
      spinbox.onValueChange = spinBoxValueChange
    end

    local okButton = countWindow:getChildById('buttonOk')
    local moveFunc = function()
      g_game.move(item, toPos, itembox:getItemCount())
      okButton:getParent():destroy()
      countWindow = nil
    end
    local cancelButton = countWindow:getChildById('buttonCancel')
    local cancelFunc = function()
      cancelButton:getParent():destroy()
      countWindow = nil
    end

    countWindow.onEnter = moveFunc
    countWindow.onEscape = cancelFunc

    okButton.onClick = moveFunc
    cancelButton.onClick = cancelFunc
  elseif g_keyboard.isShiftPressed() then
    g_game.move(item, toPos, 1)
    return
  else
    g_game.move(item, toPos, item:getCount())
  end
end
 
Last edited:
Probably in gameinterface.lua there is function responsible for, just switch belonging of keymodifier and it should do the trick.

@edit:

Replace default function moveStackableItem with this:
Lua:
function moveStackableItem(item, toPos)
  if countWindow then
    return
  end

  if g_keyboard.isCtrlPressed() then
    local count = item:getCount()

    countWindow = g_ui.createWidget('CountWindow', rootWidget)
    local itembox = countWindow:getChildById('item')
    local scrollbar = countWindow:getChildById('countScrollBar')
    itembox:setItemId(item:getId())
    itembox:setItemCount(count)
    scrollbar:setMaximum(count)
    scrollbar:setMinimum(1)
    scrollbar:setValue(count)

    local spinbox = countWindow:getChildById('spinBox')
    spinbox:setMaximum(count)
    spinbox:setMinimum(0)
    spinbox:setValue(0)
    spinbox:hideButtons()
    spinbox:focus()
    spinbox.firstEdit = true

    local spinBoxValueChange = function(self, value)
      spinbox.firstEdit = false
      scrollbar:setValue(value)
    end
    spinbox.onValueChange = spinBoxValueChange

    local check = function()
      if spinbox.firstEdit then
        spinbox:setValue(spinbox:getMaximum())
        spinbox.firstEdit = false
      end
    end
    g_keyboard.bindKeyPress("Up", function() check() spinbox:up() end, spinbox)
    g_keyboard.bindKeyPress("Down", function() check() spinbox:down() end, spinbox)
    g_keyboard.bindKeyPress("Right", function() check() spinbox:up() end, spinbox)
    g_keyboard.bindKeyPress("Left", function() check() spinbox:down() end, spinbox)
    g_keyboard.bindKeyPress("PageUp", function() check() spinbox:setValue(spinbox:getValue()+10) end, spinbox)
    g_keyboard.bindKeyPress("PageDown", function() check() spinbox:setValue(spinbox:getValue()-10) end, spinbox)

    scrollbar.onValueChange = function(self, value)
      itembox:setItemCount(value)
      spinbox.onValueChange = nil
      spinbox:setValue(value)
      spinbox.onValueChange = spinBoxValueChange
    end

    local okButton = countWindow:getChildById('buttonOk')
    local moveFunc = function()
      g_game.move(item, toPos, itembox:getItemCount())
      okButton:getParent():destroy()
      countWindow = nil
    end
    local cancelButton = countWindow:getChildById('buttonCancel')
    local cancelFunc = function()
      cancelButton:getParent():destroy()
      countWindow = nil
    end

    countWindow.onEnter = moveFunc
    countWindow.onEscape = cancelFunc

    okButton.onClick = moveFunc
    cancelButton.onClick = cancelFunc
  elseif g_keyboard.isShiftPressed() then
    g_game.move(item, toPos, 1)
    return
  else
    g_game.move(item, toPos, item:getCount())
  end
end

Thank you!
 
Back
Top