void222x Posted April 9, 2015 Share Posted April 9, 2015 Hello folks. I have recently made a drop button mod to drop one item at a time from a stack on the keyboard controls. Essential I would have keys assigned to moving left and right on the inventory and then pressing a key drop the item I would want. What I'am trying to do now is make it so I don't have to press keys to move left and right on the toolbar and just drop the item that is currently being highlighted by the mouse cursor. In Invslot.lua I Imported the CONTROL_DROP_ITEM from playercontroller.lua. While I can still drop my item by pressing a hotkey, I cannot drop it when I'm highlighting a slot on the inventory which is telling me that its working but I seem to need a variable of some sort inside the "()" on "self.owner.components.inventory:DropItem()" I have tried calling variables for inv_obj and inv_item but I would get the NIL errors when doing this. If anyone can let me know what my next step with this would be, It would be much appreciated! Thanks!function InvSlot:OnControl(control, down) if InvSlot._base.OnControl(self, control, down) then return true end if down then if control == CONTROL_ACCEPT then --generic click, with possible modifiers if TheInput:IsControlPressed(CONTROL_FORCE_INSPECT) then self:Inspect() else if TheInput:IsControlPressed(CONTROL_FORCE_TRADE) then self:TradeItem(TheInput:IsControlPressed(CONTROL_FORCE_STACK)) else self:Click(TheInput:IsControlPressed(CONTROL_FORCE_STACK)) end end elseif control == CONTROL_SECONDARY and self.tile and self.tile.item then --alt use (usually RMB) GetPlayer().components.inventory:UseItemFromInvTile(self.tile.item) -- the rest are explicit control presses for controllers elseif control == CONTROL_SPLITSTACK then self:Click(true) elseif control == CONTROL_TRADEITEM then self:TradeItem(false) elseif control == CONTROL_TRADESTACK then self:TradeItem(true) elseif control == CONTROL_INSPECT then self:Inspect() elseif control == CONTROL_INVENTORY_DROP then self.owner.components.inventory:DropItem() else return false end return true endend Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.
Please be aware that the content of this thread may be outdated and no longer applicable.