Drag items problem [solved]

  • #1, by magiclightFriday, 14. September 2018, 10:38 6 years ago
    Hi!
    I have enabled "drag" of items from inventory, the invontory interface is transparent and is top of the scene, so when I put the mouse cursor on top of an item and hold down the mouse button the "coin" interface will popup because it detects the mouse hold down event so instead of dragging the coin interface pops up, if I let go of the mouse button the draggable image is there.

    Is there a way to avoid the mouse hold down event to trigger if I am over an inventory item in some way ?

    Newbie

    13 Posts


  • #2, by afrlmeFriday, 14. September 2018, 11:21 6 years ago
    Dragging doesn't actually occur by holding down the mouse button & dragging, it works by left clicking & releasing over the item you want to drag. The term dragging is misleading, as in this case it just means that you are setting the mouse cursor to the same image as the item as if you are actually dragging it around.

    If you want to actually drag an item around in the way you want it to work, then you will need to create a custom system with scripting that will allow you to do that.

    Imperator

    7285 Posts

  • #3, by magiclightFriday, 14. September 2018, 12:36 6 years ago
    Ah, ok, that explains it, I guess that will be ok, I just assumed the normal interpretation of "dragging" wink never crossed my mind it could mean something else.

    thanks

    Newbie

    13 Posts

  • #4, by magiclightFriday, 14. September 2018, 12:47 6 years ago
    Another question related to the drag function, if I pick up an item from the inventory, is there some way I can "cancel" it if I change my mind, does not look like there is, once it is picked up it has to be dropped somewhere ?

    Newbie

    13 Posts

  • #5, by afrlmeFriday, 14. September 2018, 13:37 6 years ago
    right click should cancel the item & switch back to the default command providing you assigned one in the properties section of the main command interface you should have created - if it's not working then you could create some action parts inside of the global right click action under mouse properties in the main game settings section of the editor.



    This is the code in the script block...
    if not game.UsedItem:isEmpty() then
     return true
    else
     return false
    end 

    The code checks if an item is currently held & returns true or false depending on the query. if it's true then the action parts shown in the screenshot are for setting the item in hand to empty & setting the current command back to the default command.

    Imperator

    7285 Posts

  • #6, by magiclightFriday, 14. September 2018, 14:00 6 years ago
    Many thanks

    Newbie

    13 Posts