+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 24

Thread: My Question Thread

  1. #1
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default My Question Thread

    well this is the thread where i'm going to ask a lot and hope that someone is able to answer.

    first of all i'm not new to the Addon API. i experimented with creating frames, sending data between my addon via the addon chat and inspecting abilitys. but i'm new to the new Event API so i dont know how to attach and detach custom events and stuff like that.

    here is my first question:
    is it possible to get more information out of UI.Native.Character like the items that are shown or the playerid? i know how to get these for my own toon. but this native is also used as inspect window and the way Inspect.Unit.Detail("player.target") to get the playerid is the last one i want to go.

    second question:
    how can i inspect the points spend in the different souls?

  2. #2
    Plane Touched
    Join Date
    Feb 2012
    Posts
    228

    Default

    Welcome Mirila,

    Quote Originally Posted by Mirila View Post
    first of all i'm not new to the Addon API. i experimented with creating frames, sending data between my addon via the addon chat and inspecting abilitys. but i'm new to the new Event API so i dont know how to attach and detach custom events and stuff like that.
    Check Wildtide's thread on that topic: http://forums.riftgame.com/technical...ent-model.html

    Quote Originally Posted by Mirila View Post
    is it possible to get more information out of UI.Native.Character like the items that are shown or the playerid? i know how to get these for my own toon. but this native is also used as inspect window and the way Inspect.Unit.Detail("player.target") to get the playerid is the last one i want to go.
    You can't extract any data from the Native frames, but their position and whether they're loaded or not, so IUDetail is the way to get their playerID. Also note you can't inspect other players' items: if you need that, the other player will need to have an addon installed that messages you the data.

    Quote Originally Posted by Mirila View Post
    second question:
    how can i inspect the points spend in the different souls?
    There isn't an API for that yet.

  3. #3
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default

    Quote Originally Posted by Baanano View Post
    You can't extract any data from the Native frames, but their position and whether they're loaded or not, so IUDetail is the way to get their playerID. Also note you can't inspect other players' items: if you need that, the other player will need to have an addon installed that messages you the data.
    so have to do it with Inspect.Unit.Detail("player.target") ?
    any idea how i am able to differentiate between my character window and the inspect window?

  4. #4
    Plane Touched
    Join Date
    Feb 2012
    Posts
    228

    Default

    Quote Originally Posted by Mirila View Post
    so have to do it with Inspect.Unit.Detail("player.target") ?
    Yes, you'd use the .id or .type member of the IUDetail table (I haven't used the Unit API enough to know which one is the playerID).

    Quote Originally Posted by Mirila View Post
    any idea how i am able to differentiate between my character window and the inspect window?
    If UI.Native.Character is being used for both of them, as you stated on your original post, I think you won't be able to distinguish them.


    Maybe if you told us what you are trying to do, we'd be able to help you better.

  5. #5
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default

    Quote Originally Posted by Baanano View Post
    Maybe if you told us what you are trying to do, we'd be able to help you better.
    ok so here is what i am trying to do:

    an addon that shows you all stats of the inspected player directly in the inspect window.

    containing planar attunement points,unbuffed and buffed stats (in the future maybe detailed information about the souls and conquestpoints).

    so when the inspect window is loading/loaded i'd send a request to the player shown in the window. the response contains all stats. (this only works when both have the addon.)
    the request and response would be send via whisper. and well if i "inspect" me. (open the character window) i cant send a whisper to me and maybe i have no target to check whether i am the target or any other player.

    the ui would be something like this:
    http://www10.pic-upload.de/22.06.13/nmhsa3fpgr6j.png
    Last edited by Mirila; 06-22-2013 at 06:23 AM.

  6. #6
    Plane Touched
    Join Date
    Feb 2012
    Posts
    228

    Default

    Ah, I see.

    Unfortunately, I believe you can't do it right now as you can't know for which player the Native Character frame is being shown. Maybe some day we'll be able to get limited data out of native frames (the Map frame is probably the most requested one).

    Meanwhile, as a workaround, you could use a combobox to let the user select any data snapshot you've collected from other players, and autoselect the one corresponding to the latest player.target.

  7. #7
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default

    ok thank you so far.

    and another question:
    is there an event that is fired when i right click on the UI.Native.PortraitTarget ? or is it possible to register one that would behave like this?

    EDIT:
    Code:
    local target = UI.Native.PortraitTarget 
    target:EventAttach(Event.UI.Input.Mouse.Right.Click, function() print("target") end , "MouseDown")
    does not work...
    Last edited by Mirila; 06-22-2013 at 08:32 AM.

  8. #8
    Sword of Telara DoomSprout's Avatar
    Join Date
    Apr 2011
    Posts
    876

    Default

    With the limitations on accessing the native UI, I think your best bet may be to do something like this:

    Use LibUnitChange (provided by ZorbaTHut), to watch for whenever your target changes. You'd do this by registering to watch "player.target".

    When the unit changes, use Inspect.Unit.Detail to pull back the target's unit information. If they are a player unit and you haven't already requested their stats, send an addon message to them requesting their stats.

    If they are running the addon, they will respond to the message, and you'll get the message back. At this point, you can populate your inspection window with their details (or light up a button if the window is not currently open).

    If you target the same player again and you have recently obtained their stats, you could skip the message and just populate the window. You would probably want a "Refresh" button as stats obviously change with gear/role changes.

    As Baanano says, trying to get any information out of native windows simply isn't possible at the moment.

    Gadgets: Unit Frames and Other Stuff for RIFT

  9. #9
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default

    Quote Originally Posted by DoomSprout View Post
    Use LibUnitChange (provided by ZorbaTHut), to watch for whenever your target changes. You'd do this by registering to watch "player.target".
    this sounds like the way to go until there is a better one. but one thing i never understood was, how to implement and then use the LibUnitChange? i havent found a short documentation or tutorial on this so far.

  10. #10
    Sword of Telara DoomSprout's Avatar
    Join Date
    Apr 2011
    Posts
    876

    Default

    Quote Originally Posted by Mirila View Post
    this sounds like the way to go until there is a better one. but one thing i never understood was, how to implement and then use the LibUnitChange? i havent found a short documentation or tutorial on this so far.
    It's pretty much the best and only sensible way to go, and as I far as I know, always will be. Zorba did mention possibly including it in the base API at some point, but he hasn't as yet.

    To use it, you'd use something like:

    Code:
    local function OnPlayerTargetChange(hEvent, unitId)
        print("Player target is now: " .. tostring(unitId))
    end
    
    Command.Event.Attach(
        Library.LibUnitChange.Register("player.target"), 
        OnPlayerTargetChange, 
        "OnPlayerTargetChange"
    )
    Note: I haven't tested that code, it could contain typos, but hopefully it's correct!

    Gadgets: Unit Frames and Other Stuff for RIFT

  11. #11
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default

    this might be a dumb question but how does the RiftAddon.toc look like to enable the use of the LibUnitChange in my main.lua?

    EDIT: made it work with
    Code:
    Embed = {
    	LibUnitChange = true,
    }
    
    Dependencies = {
    	LibUnitChange = {"required", "before"},
    }
    works perfectly and no typos thanks
    Last edited by Mirila; 06-22-2013 at 10:24 AM.

  12. #12
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default

    is the UIParent the whole UI and what am i doing wrong with:
    Code:
    function UIParent:EventInputMouseLeftClickHandler(handle)
      print("click")
    end
    it is not firing

  13. #13
    Soulwalker
    Join Date
    Jun 2013
    Posts
    16

    Default

    You can't hook into UIParent or any of the native frames. What are you trying to achieve with it?

    EDIT: The UIParent frame is the native frame that all the others are children of. We're not really given a lot of access to these native frames. We can tell whether they're loaded and where on the screen they're placed. Everything else we have to do with our own custom frames. I'm assuming you're trying to handle a left mouse button click on yours. You should hook into the event from your own frame. I'll write up an example when I get back to my computer, since writing code on a phone isn't really ideal.

    EDIT 2: Just a simple example to demonstrate left mouse button handling:
    Code:
    -- Create the context
    local ctx = UI.CreateContext("Addon Context")
    
    -- Create the frame
    local frm = UI.CreateFrame("Frame", "Addon Frame", ctx)
    
    -- The event handler function
    local function Addon_Handle_LeftMouseDown(handle)
        print("Mouse down")
    end
    
    -- Attach to the event on the created frame
    frm:EventAttach(Event.UI.Input.Mouse.Left.Click, Addon_Handle_LeftMouseDown, "Addon Event Handler")
    Last edited by Zhevron; 06-25-2013 at 06:37 AM. Reason: Elaboration, code example
    Zhevron
    Lyrai @ Faeblight NA
    Author of Tome (BETA)

  14. #14
    Plane Walker Imhothar's Avatar
    Join Date
    Feb 2012
    Posts
    439

    Default

    UIParent is only useful to get the screen size. You cannot manipulate it in any way (as you cannot any of the UI.Native.* frames).
    Author of the Imhothar's Bags addon.

  15. #15
    Shadowlander
    Join Date
    Mar 2013
    Posts
    28

    Default

    well now i am trying to hook a frame to the context menu that appears when rightclicking the portrait or the raidframe but seems to be impossible aswell.
    i hope there will come some ways to get information out of the Rift UI or maybe some more events that are fired when interacting with it.

    and maybe the last question for now:
    any way to get the current conquestpoints?

+ Reply to Thread
Page 1 of 2 1 2 LastLast

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