Can't use toy on first attempt due to id-name mapping not in cache yet
LootFever opened this issue · 19 comments
I setup the advanced "Key Bind 2" for Hearthstones.
For example:
IF [class:SHAMAN]
IF [aura:79206,known:556]
Spell 556
END
#Elemental
#Use [spec:262]
#Enhancement
#Use [spec:263]
#Restoration
#Use [spec:264]
#
Use 200630
Spell 556
END
The basic idea behind it does work but for some reason the first click/execution of the code does not access the toys/items.
On classes where I have spell fallbacks configured like with the shaman example it uses the spell instead of the toy.
On other classes it shows me the "you can't mount here" error even when mounting would be possible in theory (even though it's not intended).
This doesn't seem to happen if I use the toy name instead of the ID.
Not sure if that is the intended way or not so I thought I would open a issue.
Thanks for the bug report, that's a good one.
I know why this is. The names of items by ID aren't known in the client, and they have to be requested from the server the first time they are looked up, and there is some delay before they are known. So the first time you use an item by ID LiteMount can't translate it into the name it needs to use it so it doesn't work. Every time after that it is cached by the client and available instantly.
You can test this yourself by logging in and immediately running /dump GetItemInfo(200630)
and note that LiteMount will work the first time then.
Items that you have in your inventory are pre-cached by the client so they're always available (as far as I know). I assumed this applied to toys also but it does not.
I'm not sure what the fix for this is yet. An obvious solution is to run GetItemInfo for any items when LiteMount first loads, so they are available when you try to activate it. Unfortunately the way LiteMount is written makes that quite hard.
Stay tuned. For now, using by name will always work.
Thanks for the reply.
Running a GetItemInfo()
for every item seems bad for performance at a first look from my view but then im no addon author. :D
Maybe it's possible to limit this to just toys. But even this wouldn't be future proof if the same problem arises with other use-items.
My opt-in mind then thinks of a future project called LiteToys :D
But for now I know the problem and can easily get around it by using the toy name instead of ID.
(Maybe a little bracket about this in the wiki in the advanced section would be the best "solution" for this minor problem for now.)
Oh no, definitely not for every item just for the ones in any rules.
The problem is LiteMount doesn't really do much on startup. It doesn't look at the rules at all until you try to activate it. Partly so that it's not slowing down login time, and generally just for efficiency so it's not using up CPU for no reason.
Easy problem to diagnose, difficult to fix. :(
Ok little correction I just made sure of:
Using the name of the toy produced the same error as using the ID.
The one time it worked must had the toy cached for some reason.
Oh that's interesting, it must be an overall problem for the game itself. Like if you made a macro for a toy it wouldn't work the first time either.
I guess the macro system must pre-cache, probably when the action bars are shown I suspect.
Edit: typing directly /use <item>
fails.
I have what I hope is a fix for this but it's a bit blocked behind some monkeying around for classic that I'm doing. It should work in the next release.
Ouh now Im excited.
Last night I thought about solutions on my and and thought of putting the toys on a hidden actionbar.
But if you have a possible fix I shall wait for the next release.
I think I fixed it
lemme double check my theory...
nvm... "" wasn't the magic I hoped for
tried now the ID again
3/3 times it worked diretly after the UI reload
I shall keep an eye on it
Here's the debug from the ID use just in case
Debug:
[07:18] LiteMount: PreClick handler called on LM_B2 (inputButton=LeftButton, isDown=false)
[07:18] LiteMount: Refreshing status of all mounts.
[07:18] LiteMount: Initializing rule IF [class:DEATHKNIGHT]
[07:18] LiteMount: Initializing rule Use [spec:252] Necrolord Hearthstone
[07:18] LiteMount: Initializing rule Use Dominated Hearthstone
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:DEMONHUNTER]
[07:18] LiteMount: Initializing rule Use Tome of Town Portal
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:DRUID]
[07:18] LiteMount: Initializing rule CancelAura [noflying] 783
[07:18] LiteMount: Initializing rule Use Night Fae Hearthstone
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:EVOKER]
[07:18] LiteMount: Initializing rule Use Timewalker's Hearthstone
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:HUNTER]
[07:18] LiteMount: Initializing rule Use Ohn'ir Windsage's Hearthstone
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:MAGE]
[07:18] LiteMount: Initializing rule Use Ethereal Portal
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:MONK]
[07:18] LiteMount: Initializing rule Use Kyrian Hearthstone
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:PALADIN]
[07:18] LiteMount: Initializing rule Use Path of the Naaru
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:PRIEST]
[07:18] LiteMount: Initializing rule Use [spec:256] Path of the Naaru
[07:18] LiteMount: Initializing rule Use [spec:257] Path of the Naaru
[07:18] LiteMount: Initializing rule Use [spec:258] Etheral Portal
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:ROGUE]
[07:18] LiteMount: Initializing rule Use Dominated Hearthstone
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:SHAMAN]
[07:18] LiteMount: Initializing rule IF [aura:79206,known:556]
[07:18] LiteMount: Initializing rule Spell 556
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule Use 200630
[07:18] LiteMount: Initializing rule Spell 556
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:WARLOCK]
[07:18] LiteMount: Initializing rule Use Tome of Town Portal
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule IF [class:WARRIOR]
[07:18] LiteMount: Initializing rule Use Path of the Naaru
[07:18] LiteMount: Initializing rule END
[07:18] LiteMount: Initializing rule Use Eternal Traveler's Hearthstone
[07:18] LiteMount: Dispatching flow control action IF [class:DEATHKNIGHT]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:DEMONHUNTER]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:DRUID]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:EVOKER]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:HUNTER]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:MAGE]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:MONK]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:PALADIN]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:PRIEST]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:ROGUE]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching flow control action IF [class:SHAMAN]
[07:18] LiteMount: - IF test is true
[07:18] LiteMount: Dispatching flow control action IF [aura:79206,known:556]
[07:18] LiteMount: - IF test is false
[07:18] LiteMount: Dispatching flow control action END
[07:18] LiteMount: Dispatching rule Use 200630
[07:18] LiteMount: - trying item Ohn'ir Windsage's Hearthstone
[07:18] LiteMount: - setting action to use item Ohn'ir Windsage's Hearthstone
[07:18] LiteMount: PreClick ok time 13.077800035477
[07:18] LiteMount: PostClick handler called on LM_B2 (inputButton=LeftButton, isDown=false)
[07:18] LiteMount: - setting action to in-combat action
10.1.7-7 beta3
(classes added as a reference point)
- Hunter first try failed
- logged to Warrior
- Warrior worked instantly
- logged back to Hunter
- Hunter needed 2 tries again
Edit: - restarte the client
- logged on Shaman (same to as Hunter)
- enabled debugging
- fails again
Debug:
[07:01] LiteMount: PreClick handler called on LM_B2 (inputButton=LeftButton, isDown=false)
[07:01] LiteMount: Refreshing status of all mounts.
[07:01] LiteMount: Initializing rule IF [class:DEATHKNIGHT]
[07:01] LiteMount: Initializing rule Use [spec:252] Necrolord Hearthstone
[07:01] LiteMount: Initializing rule Use Dominated Hearthstone
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:DEMONHUNTER]
[07:01] LiteMount: Initializing rule Use Tome of Town Portal
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:DRUID]
[07:01] LiteMount: Initializing rule CancelAura [noflying] 783
[07:01] LiteMount: Initializing rule Use Night Fae Hearthstone
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:EVOKER]
[07:01] LiteMount: Initializing rule Use Timewalker's Hearthstone
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:HUNTER]
[07:01] LiteMount: Initializing rule Use Ohn'ir Windsage's Hearthstone
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:MAGE]
[07:01] LiteMount: Initializing rule Use Ethereal Portal
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:MONK]
[07:01] LiteMount: Initializing rule Use Kyrian Hearthstone
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:PALADIN]
[07:01] LiteMount: Initializing rule Use Path of the Naaru
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:PRIEST]
[07:01] LiteMount: Initializing rule Use [spec:256] Path of the Naaru
[07:01] LiteMount: Initializing rule Use [spec:257] Path of the Naaru
[07:01] LiteMount: Initializing rule Use [spec:258] Etheral Portal
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:ROGUE]
[07:01] LiteMount: Initializing rule Use Dominated Hearthstone
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:SHAMAN]
[07:01] LiteMount: Initializing rule IF [aura:79206,known:556]
[07:01] LiteMount: Initializing rule Spell 556
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule Use Ohn'ir Windsage's Hearthstone
[07:01] LiteMount: Initializing rule Spell 556
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:WARLOCK]
[07:01] LiteMount: Initializing rule Use Tome of Town Portal
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule IF [class:WARRIOR]
[07:01] LiteMount: Initializing rule Use Path of the Naaru
[07:01] LiteMount: Initializing rule END
[07:01] LiteMount: Initializing rule Use Eternal Traveler's Hearthstone
[07:01] LiteMount: Dispatching flow control action IF [class:DEATHKNIGHT]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:DEMONHUNTER]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:DRUID]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:EVOKER]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:HUNTER]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:MAGE]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:MONK]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:PALADIN]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:PRIEST]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:ROGUE]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching flow control action IF [class:SHAMAN]
[07:01] LiteMount: - IF test is true
[07:01] LiteMount: Dispatching flow control action IF [aura:79206,known:556]
[07:01] LiteMount: - IF test is false
[07:01] LiteMount: Dispatching flow control action END
[07:01] LiteMount: Dispatching rule Use Ohn'ir Windsage's Hearthstone
[07:01] LiteMount: - trying item Ohn'ir Windsage's Hearthstone
[07:01] LiteMount: - setting action to use item Ohn'ir Windsage's Hearthstone
[07:01] LiteMount: PreClick ok time 12.36360001564
[07:01] LiteMount: PostClick handler called on LM_B2 (inputButton=LeftButton, isDown=false)
[07:01] LiteMount: - setting action to in-combat action
10.1.7-7 beta4
using names:
- Evoker ✓
- Paladin ✗
- DK ✗
- Druid ✗
- DH ✓
using IDs:
- DH ✓
- Warrior ✓
- Priest ✗
- Mage ✗
- Rogue ✗
DH is probably being chached since I use that toys #showtooltip
It's also strange that Warrior worked but Priest and Paladin who use the same toy didn't
let me know if u need a debug
Btw, if you find any other addons with a solution or any information on how it could be fixed, please let me know.
I'm afraid, having looked into it, it's just not possible. The toy items get evicted from the item cache even after I've gotten them in there, and afterwards they don't work until they get back in.
There's no way around it I can see except some constant process trying to keep them cached, and that's so likely to cause problems I'm not prepared to do it.
I consider it a blizzard bug that /use Toyitem
doesn't work the first time, and I can't work around it. You can easily reproduce this by manually typing /use ToyItem
into the chat on first login (and sometimes after /reload). You can also see it by making a macro like this and clicking it (having showtooltip/icon be different from the toy in use).
#showtooltip Hearthstone
/use ToyItem
As far as I know Blizzard don't provide any information about how the item cache works, so I have nothing to go on. I've tried aggressively to get the items in the cache but can't.
The UI seems to keep cached or keeps refreshing items on actionbars if the icon is shown (but fails if it's not as with the above macro). In essence the actionbars are doing the "constantly keep refreshing the item in the cache".
Feel free to log this with Blizzard as a bug or report it on https://github.com/Stanzilla/WoWUIBugs/issues. I think Blizzard should probably be pre-caching or at least not evicting the toy item data, but who knows. (When (edit: typo) I say log it I mean the /use and macro problems not the LiteMount specifics).
Going to have to close this off. Sorry, small indie dev's games just don't always work reliably.
No worries, I'm grateful for the effort you put in, trying to fix it. 🙇
I will report the Blizzard caching problem as a bug.
Btw, if you find any other addons with a solution or any information on how it could be fixed, please let me know.
Will do. 👌