+ Reply to Thread
Results 1 to 2 of 2

Thread: Mouse handling

  1. #1
    Shadowlander
    Join Date
    Feb 2016
    Posts
    49

    Question Mouse handling

    Hi, having trouble figuring out how to accomplish this. I'm trying to match npc and loot data.

    1. It'd be nice to have a way to get/set AE looting.

    2. Right now, when you right-click to loot, your target isn't set to what you right-clicked on. Because of this, when Event.Item.Slot and Event.Item.Update fire, you cannot be assured that Inspect.Unit.Detail('player.target') is accurate or is even populated. What about 'mouseover'? Turns out there's enough lag between right-clicking and the Item events that 'mouseover' is also not guaranteed to be accurate or populated. In normal game play, it is almost never accurate.

    So I thought, what if I catch the right-click event (or down or up event), and store the 'mouseover' and time info? When the Item.Slot or Item.Update events fire, they'll refer to this info and if it's within a threshold (500 ms too generous? will test), it will be the assumed source of the loot.

    (A lot of other logic is going to wrap this to filter for crafting, quests, trades, mail, upgrades, etc...)

    I just don't know how to deal with Input events, particularly when they're in the game world and not on a known frame. Any help, pointers, guidance, or anecdotes are welcomed.

    Code:
    -- collect reference info to be handled by Item.Slot and Item.Update handler
    local mo = 0
    local lastclick = 0
    
    function handleLootClick()
      mo = Inspect.Unit.Detail('mouseover')
      lastclick = Inspect.Time.Real
    end
    
    Unknown:EventAttach(Event.UI.Input.Mouse.Right.Click, handleLootClick, "Loot Click Handler")
    -- not UIParent
    Update: Think I found a way around it. If I'm going to assume that the last mouseover target within a time threshold is the looted target, then the right-click event is irrelevant. It would minimize the updating of the last mouseover target and its time, but that's negligible anyway. Still curious about how to implement input event handling, but I think this issue is resolved.
    Last edited by deathbeams; 09-30-2018 at 07:53 AM. Reason: Got some sleep.

  2. #2
    Soulwalker
    Join Date
    Aug 2018
    Posts
    2

    Default

    I haven't done much research, but to my knowledge, there's no way of accomplishing what you want. When a given frame has the focus, it receives input events; no other frames are aware of the event, and I haven't encountered a way to allow the event to propagate, i.e. be ignored by the given frame and passed on to another one that wasn't the focus. That means that the mouse has to be over your frame, and your frame has to steal the click event (the click wouldn't actually loot anything.)

    * Edited to point out that I was apparently wrong. There's some information about Dive and Bubble events, as well as Catch(), Halt(), and GetTarget() here: http://forums.riftgame.com/technical...-redesign.html
    Last edited by Vauren; 10-02-2018 at 09:28 AM.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts