Check which item is dragged, can it be done?

  • #1, by fabian-schurgersMonday, 20. May, 16:34 3 months ago
    Hi here,

    I was wondering if it is possible to check which item is dragged by the cursor and make that an if statement.

    I would like to change the item that is being dragged into a larger version when a specific area is entered with the mouse, and change it back to it's smaller size when the mouse cursor leaves the area.

    So when the mouse cursor enters an area: 'If puzzle piece 1_small is dragged: change the dragged item into puzzle piece 1_large' for example. And vice versa when the mouse cursor leaves an area.

    Would this be possible?

    Thanks!


    Forum Fan

    134 Posts


  • #2, by esmeraldaMonday, 20. May, 19:50 3 months ago
    yes, possible, but you would need to use some scripting.


    there is the action part "if lua result" that acts as if query. You just need to type in : return  and what you want to query.

    For examply you can check if you are holding an item: return not game.UsedItem.empty  (this will retrun "true" if you are currently holding an item)

    There is also the action part "execute script" that let's you do all kinds of stuff.

    you can get the name of the item you are holding by :  game.UsedItem.name

    or you could compare the item you are holding with one of your items
    if game.UsedItem == Objects["my_item"] then
       do something
    end




    But... one of the users (Christopher A. Summer) wrote a wonderful script that draws the item next to the cursor (instead of replacing the cursor) and included some settings to change the scale when on a hotspot or wriggle a bit. All you have to do is change the settings to your liking.
    And you would need to change from the build-in dragging and "drop item" command to "use command with item". Depending on how far you are with your project, this may be a lot of work...
    https://wiki.visionaire-tracker.net/wiki/Custom_Item-Draggin...

    Key Killer

    525 Posts

  • #3, by fabian-schurgersMonday, 20. May, 20:45 3 months ago
    yes, possible, but you would need to use some scripting.


    there is the action part "if lua result" that acts as if query. You just need to type in : return  and what you want to query.

    For examply you can check if you are holding an item: return not game.UsedItem.empty  (this will retrun "true" if you are currently holding an item)

    There is also the action part "execute script" that let's you do all kinds of stuff.

    you can get the name of the item you are holding by :  game.UsedItem.name

    or you could compare the item you are holding with one of your items
    if game.UsedItem == Objects["my_item"] then
       do something
    end




    But... one of the users (Christopher A. Summer) wrote a wonderful script that draws the item next to the cursor (instead of replacing the cursor) and included some settings to change the scale when on a hotspot or wriggle a bit. All you have to do is change the settings to your liking.
    And you would need to change from the build-in dragging and "drop item" command to "use command with item". Depending on how far you are with your project, this may be a lot of work...
    https://wiki.visionaire-tracker.net/wiki/Custom_Item-Draggin...


    Thanks for your help. Again! smile Will try this!

    Forum Fan

    134 Posts

Write post