Opening menu clears dragged item

  • #1, by EvrenFriday, 02. May 2014, 14:47 6 years ago
    I don't know if it would be considered a real bug, but when you open a menu then swtich back to the scene dragged item gets lost. I tried to get the dragged item to a variable (in definition script) and put it back when going back to the scene but realized GameUsedItem is not scriptable. You can use an action part Set Item, so it seems a bit weird not being able to use it in script. (Action part won't do any good because when using the action part you have to know the item, but in this case dragged item can be anything.) The player can pick the item from the inventory again but what if it's an item that doesn't exist in inventory, and given by the game (imaginary scenario). Thinking of it, it can also be a timed event scenario. Maybe the player wanted to puase the game but when he returns back now he needs to do the actions all over again. Just wanted to let you know. smile

    Newbie

    19 Posts


  • #2, by SimonSFriday, 02. May 2014, 14:54 6 years ago
    It's scriptable with Vis 4.0.
    game:setValue(VGameUsedItem,getObject("(-1,-1)"))
    game:setValue(VGameUsedItemPicked,true)
    1
    2
    3

    Order matters here.

    Thread Captain

    1368 Posts

  • #3, by EvrenFriday, 02. May 2014, 15:32 6 years ago
    I am using Vis 4.0, I created a definition script with a global variable "ItemBeingDragged", and saved the object to that variable. When returning to scene I used this line:

    game:setValue(VGameUsedItem, ItemBeingDragged)

    this didn't work. roll

    http://wiki.visionaire-tracker.net/wiki/Data_Structure, I didn't see VGameUsedItemPicked here roll and getObject("(-1,-1)") is new to me, what does it do?

    Newbie

    19 Posts

  • #4, by AlexFriday, 02. May 2014, 15:57 6 years ago
    getObject('(-1,-1)') returns an empty object, it uses a tuple to specifiy the object (table-id, object-id) - in this case a non-existing object.
    But for better readability I'd recommend to use emptyObject instead.

    Great Poster

    378 Posts

  • #5, by EvrenFriday, 02. May 2014, 17:24 6 years ago
    I can't give the item back to cursor. It's not working. I had some mistakes I corrected them but now the action text has the item's name but there is no item icon and when I click on another object it doesn't drop it, just walks to the object. Then the action text is cleared.

    Is there such a thing as GameUsedItemPicked ? I tried it, didn't work.

    Then the scripts started to change between execution and definition. I guess it's time for a rest again before going crazy.

    @Alex
    Thank you for that.

    Newbie

    19 Posts

  • #6, by AlexFriday, 02. May 2014, 18:49 6 years ago

    Then the scripts started to change between execution and definition. I guess it's time for a rest again before going crazy.


    that's a known bug which will be fixed with the next update. The problem is in the underlying gui lib, when the first tab is selected and you change the script, the selected script gets the same radio button setting as the previously selected.

    Great Poster

    378 Posts

  • #7, by EvrenFriday, 02. May 2014, 19:28 6 years ago
    It's scriptable with Vis 4.0.
    game:setValue(VGameUsedItem,getObject("(-1,-1)"))
    game:setValue(VGameUsedItemPicked,true)
    1
    2
    3

    Order matters here.


    I can't get it to work, is it in a newer build?

    Newbie

    19 Posts

  • #8, by afrlmeFriday, 02. May 2014, 19:58 6 years ago
    It's incorrect. It's actually...
    game:setValue(VGameDestinationItemPicked, true)
    1
    2

    the the gameuseditem part looks correct though. although technically I could store the current item like so...
    if not game:getLink(VGameUsedItem):isEmpty() then
    var = game:getLink(VGameUsedItem) else var = nil
    end
    1
    2
    3
    4

    then I could return it like so...
    if var ~= nil then
    game:setValue(VGameUsedItem, var)
    game:setValue(VGameDestinationItemPicked, true)
    end
    1
    2
    3
    4
    5

    something along the lines of this.

    Imperator

    6842 Posts

  • #9, by SimonSFriday, 02. May 2014, 20:07 6 years ago
    Here, try my inventory scroll script:
    -- author: SimonS
    -- Inventory scrolling by mouse wheel
    registerEventHandler("mouseEvent", "mouseEvtHandler")

    function mouseEvtHandler(evt)
    if evt == eEvtMouseWheelUp then
    wheelUp()
    end
    if evt == eEvtMouseWheelDown then
    wheelDown()
    end
    end

    function wheelUp ()
    local items = game:getLink(VGameCurrentCharacter):getLinks(VCharacterItems)
    local len = table.getn (items)
    local usedItem = game:getLink(VGameUsedItem)

    if len == 0 then
    game:setValue(VGameUsedItem,getObject("(-1,-1)"))
    else
    if usedItem:isEmpty() then
    game:setValue(VGameUsedItem,items[1])
    else
    for index = 0, len-1, 1 do
    if items[len-index]:getName() == usedItem:getName() then
    if len-index == len then
    game:setValue(VGameUsedItem,getObject("(-1,-1)"))
    else
    game:setValue(VGameUsedItem,items[len-index+1])
    end
    break
    end
    end
    end
    end
    game:setValue(VGameUsedItemPicked,true)
    end


    function wheelDown ()
    local character = getObject("Game.GameCurrentCharacter")
    local items = character:getLinks(VCharacterItems)
    local len = table.getn (items)
    local usedItem = game:getLink(VGameUsedItem)

    if len == 0 then
    game:setValue(VGameUsedItem,empty)
    else
    if usedItem:isEmpty() then
    game:setValue(VGameUsedItem,items[len])
    else
    for i = 1, len, 1 do
    if items[i]:getName() == usedItem:getName() then
    if i == 1 then
    game:setValue(VGameUsedItem,getObject("(-1,-1)"))
    else
    game:setValue(VGameUsedItem,items[i-1])
    end
    break
    end
    end
    end
    end
    game:setValue(VGameUsedItemPicked,true)
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67

    Thread Captain

    1368 Posts

  • #10, by afrlmeFriday, 02. May 2014, 22:11 6 years ago
    I also wrote a script a few months ago that allowed you to cycle/scroll through the inventory items. razz http://wiki.visionaire-tracker.net/wiki/Cycle_Inventory_Item... - I've not gone over your script but I think it's scrolling through currently selected item? Mine scrolls the inventory itself.

    Imperator

    6842 Posts

  • #11, by SimonSFriday, 02. May 2014, 23:57 6 years ago
    No, you can scroll through your items here with the wheel, so it is directly dragged. The fastest inventory I can imagine, as seen in Memoria and Chains of Satinavs.

    Thread Captain

    1368 Posts

Write post