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

Thread: Issues with Inspect.Unit.Detail

  1. #1
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default Issues with Inspect.Unit.Detail

    ** Issue fixed as of latest update on PTS **

    Hi there, firstly, I may be doing this all wrong, learning Lua as I go sort of thing (from a C++, ASM and other delightful languages background).

    Anyhoo.. as an explicit example I'm doing the following.

    Code:
    unitspec = "group01" -- 2nd in group 1 and it's occupied
    unitdetails = Inspect.Unit.Detail(unitspec)
    print(tostring(unitdetails.name)) -- tostring to avoid boom-dead on nil
    It'll either return the .name as myself (not the person in question) or a nil. I've tried using the unit ID but that always returns a nil value.

    While listing the "Inspect.Unit.List" and running through it, the person's ID @ group01 does match the ID of that player (when you use player.target or mouseover etc) but when pulling the data via .Detail it seems to fail to read the Unit correctly.

    Unless.. I'm just doing it wrong. Any help would be appreciated as I'm at the stage where I'm not entirely sure if the API is borked or my syntax is off. Gotta start somewhere.

    Excerpt for syntax checking - Not optimized just poking around.
    Code:
    local function populateRaid()
    	local count = 0
    	local playerList = Inspect.Unit.List()
    	print("Player list :", playerList)
    	for unitid, unitspec in pairs(playerList) do
    		count = count + 1
    		unitdetails = Inspect.Unit.Detail(unitspec)
    		print(count ..") ID:".. unitid .. " ; Specifier:" .. unitspec .. " ; " .. tostring(unitdetails))
    		if unitdetails then
    			print (count ..") ".. unitdetails.name)
    		else
    			print ("Nil value returned")
    		end
    	end
    	print("End List")
    end
    Last edited by Semele; 07-07-2011 at 09:29 AM. Reason: Issue resolved
    Rank 76 Guardian Mage

  2. #2
    Plane Walker Kreiri's Avatar
    Join Date
    Feb 2011
    Posts
    402

    Default

    Did you try unitspec = "group02"?
    Feminism is the radical notion that women are people.

  3. #3
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Quote Originally Posted by Kreiri View Post
    Did you try unitspec = "group02"?
    unitspec is assigned manually for the purpose of an example, this is the specifier filled in by Inspect.Unit.List() etc. Either way groupXX is reporting correctly as a filled "raid" slot from group00-group19.
    Rank 76 Guardian Mage

  4. #4
    Plane Walker Kreiri's Avatar
    Join Date
    Feb 2011
    Posts
    402

    Default

    Quote Originally Posted by Semele View Post
    Either way groupXX is reporting correctly as a filled "raid" slot from group00-group19.
    Hmm. Wasn't it group01 to group20? When did it change?
    Last edited by Kreiri; 07-01-2011 at 10:11 AM.
    Feminism is the radical notion that women are people.

  5. #5
    Soulwalker
    Join Date
    Jun 2011
    Posts
    10

    Default

    Quote Originally Posted by Semele View Post
    Code:
    print(tostring(unitdetails.name)) -- tostring to avoid boom-dead on nil
    to avoid boomdead nils you can do print(unitdetails.name or "nil") so if unitdetails.name is evaluated nil, the or condition will always be taken, unitdetails.name and "EXIST" or "NOTEXIST" cannot produce nil but only strings

    Cannot help you on your code, Lua is still disabled on Realms right ?
    Author of Spambayes (first bayesian antispam for WoW and War) and BrokerCPU (real time addon performances)

  6. #6
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Quote Originally Posted by Kreiri View Post
    Hmm. Wasn't it group01 to group20? When did it change?
    Not entirely sure when, but if you place someone in raid group 1, spot 1, their specifier reads as group00, and likewise raid group 4, spot 5 reports their specifier as group19. Maybe that's part of the problem! Would explain it reading my name instead of the player in that slot. hmmmm....
    Rank 76 Guardian Mage

  7. #7
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Quote Originally Posted by M e r a View Post
    to avoid boomdead nils you can do print(unitdetails.name or "nil") so if unitdetails.name is evaluated nil, the or condition will always be taken, unitdetails.name and "EXIST" or "NOTEXIST" cannot produce nil but only strings

    Cannot help you on your code, Lua is still disabled on Realms right ?
    Thanks on the conditional strings, and addons are back on the PTS (both PvP and PvE).
    Rank 76 Guardian Mage

  8. #8
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    Ok, I can confirm. The problem is that when using Inspect.Unit.List() the specifier returned is one place out. So, it should indeed be group01-group20, but the call is returning values group00-group19.
    Rank 76 Guardian Mage

  9. #9
    Soulwalker
    Join Date
    Jun 2011
    Posts
    10

    Default

    ho here in Europe I still get the message Lua is disabled when typing /Script on server: PTS PvP (English) maybe has something to do with my French client

    btw my bad, a cleaner one to not produce nil is (type(unitdetails) == "table" and unitdetails.name) and "EXIST" or "NOTEXIST") because you risk to get the attempt to index 'unitdetails' a nil value if not table
    Last edited by M e r a; 07-01-2011 at 11:16 AM.
    Author of Spambayes (first bayesian antispam for WoW and War) and BrokerCPU (real time addon performances)

  10. #10
    Plane Walker Kreiri's Avatar
    Join Date
    Feb 2011
    Posts
    402

    Default

    Quote Originally Posted by Semele View Post
    Ok, I can confirm. The problem is that when using Inspect.Unit.List() the specifier returned is one place out. So, it should indeed be group01-group20, but the call is returning values group00-group19.
    Reminds me of the error I once had with Borland C++ Builder: OnClick() in first ("0th") column of the table wasn't triggered - that's what you get when devs weren't careful when combining Delphi VCL/IDE and C++ compiler.
    Feminism is the radical notion that women are people.

  11. #11
    Plane Walker Kreiri's Avatar
    Join Date
    Feb 2011
    Posts
    402

    Default

    Quote Originally Posted by M e r a View Post
    ho here in Europe I still get the message Lua is disabled when typing /Script on server: PTS PvP (English) maybe has something to do with my French client
    I'm in Europe, and addons were working just fine for me all day. I'm on PvE server, though.
    Feminism is the radical notion that women are people.

  12. #12
    Soulwalker
    Join Date
    Jun 2011
    Posts
    10

    Default

    I have tried on a the other PvE server and locked too, probably the french client not yet allowed
    Author of Spambayes (first bayesian antispam for WoW and War) and BrokerCPU (real time addon performances)

  13. #13
    Sword of Telara Semele's Avatar
    Join Date
    Mar 2011
    Posts
    872

    Default

    I'm on NA shards to clear that up.

    Also, after the update to the PTS (NA), Unit ID's are working correctly. Meaning I "can" bypass the below, but surely below should work also.

    Group specifiers are still broken and reporting 1 place lower. Return ranges are still group00-group19 while look-up ranges only accept group01-group20. (yes I know it can be kludged to change the string with a +1, but not entirely sure this is working as intended).
    Rank 76 Guardian Mage

  14. #14
    Soulwalker
    Join Date
    Jun 2011
    Posts
    10

    Default

    I had missed the addon button, I was trying /script which allow the use of Lua code while playing, so this is not 100% enabled because /script always returns the Lua environnement is disabled but addon button is here while starting the client
    Last edited by M e r a; 07-02-2011 at 09:30 AM.
    Author of Spambayes (first bayesian antispam for WoW and War) and BrokerCPU (real time addon performances)

  15. #15
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Semele View Post
    Group specifiers are still broken and reporting 1 place lower. Return ranges are still group00-group19 while look-up ranges only accept group01-group20. (yes I know it can be kludged to change the string with a +1, but not entirely sure this is working as intended).
    I can believe that, that code got redesigned a few times and this may have slipped through. I'll look at it next week.

    Intended behavior is consistent group01 through group20.

+ 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