Pet Battle Scripts

Pet Battle Scripts

265k Downloads

Feature Request: Audible notification if Autobutton is "ready" during battle

nicpot opened this issue · 10 comments

commented

Perhaps it will be functional to have an audible notification when the AutoButton is ready to be used - just a simple "beep" or similar to remind me to look at the screen again? I do certain pet battles a lot and I know the fights pretty well at this stage, so I find myself looking at everything else but the pet battle itself. And yes, I'm lazy and just need reminder to hit the "A" key!!

I have manually edited PetBattle.lua on my machine with a another addon's sound file just to test. It certainly works for me. See below:

function Module:UpdateAutoButton() -- self.AutoButton:SetEnabled(Director:GetScript() and (C_PetBattles.IsSkipAvailable() or C_PetBattles.ShouldShowPetSelect())) local doAuto = Director:GetScript() and (C_PetBattles.IsSkipAvailable() or C_PetBattles.ShouldShowPetSelect()) if doAuto then PlaySoundFile("Interface\\AddOns\\Prat-3.0\\sounds\\Text2.ogg", "Master") end self.AutoButton:SetEnabled(doAuto) end

Thanks for a great addon by the way!

commented

Since pressing A while it can’t be pressed does nothing, have you tried becoming more brain-dead and just pressing A every two seconds? That’s my approach.

Hardest part about adding it is the sound selection. I’ll have to take a look at how other addons get such a list without having to ship audio files themselves.

commented

Thanks for your response, and yes I guess pressing A every 2 secs is fine as well :)

I understand your concern, but just for your info: as for the PlaySoundFile method, you can use something like PlaySound(5274) instead, That would not require to ship any audio files as its built in to wow. I simply used 5274 which is named "AuctionWindowOpen" - but I guess there will be better choices as there are more builtin sounds at wowhead.com/sounds.

commented

use something like PlaySound(5274) instead

Yeah, I'm aware but if I did this feature, I surely would want to be able to configure the sound used as my choice will surely differ from yours :)

commented

Yep of course, it will make perfect sense to allow the user to have a choice of sounds. But that would also be an overkill I guess. I was just trying to avoid adding this hack to my machine every time the addon gets updated. No problemo. Thanks anyways!

commented

#28 adds an implementation of this, including selection for which sound to play. It is missing translation still but that's only the UI. Could you test whether this works for you at some point?

commented

I downloaded the zip from the branch "issue_27-add_sound_notification_on_button_activate" and copied the files into the addon folder but I'm getting errors as in:

10x tdBattlePetScript/UI/PetBattle.lua:287: attempt to index field 'AutoButton' (a nil value)
[string "@tdBattlePetScript/UI/PetBattle.lua"]:287: in function `?'
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:109: in function <...ings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:109>
[string "=[C]"]: ?
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:19: in function <...ings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:15>
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:54: in function `Fire'
[string "@DataStore/libs/AceEvent-3.0-4/AceEvent-3.0.lua"]:120: in function <DataStore/libs/AceEvent-3.0/AceEvent-3.0.lua:119>

Locals:
self = <table> {
 SetDefaultModuleLibraries = <function> defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:363
 Enable = <function> defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:290
 NewModule = <function> defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:231
 EnableModule = <function> defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:328
 modules = <table> {
 }
 GetModule = <function> defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:206
 IterateEmbeds = <function> defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:438
 PET_BATTLE_OPENING_START = <function> defined @tdBattlePetScript/UI/PetBattle.lua:251
SecureHook = <function> defined @Bartender4/libs/AceHook-3.0/AceHook-3.0.lua:335
 defaultModuleLibraries = <table> {
 }
 TimeLeft = <function> defined @DataStore/libs/AceTimer-3.0/AceTimer-3.0.lua:172
 RawHookScript = <function> defined @Bartender4/libs/AceHook-3.0/AceHook-3.0.lua:394
 ScheduleRepeatingTimer = <function> defined @DataStore/libs/AceTimer-3.0/AceTimer-3.0.lua:129
 CancelAllTimers = <function> defined @DataStore/libs/AceTimer-3.0/AceTimer-3.0.lua:160
 PET_BATTLE_SCRIPT_RESET_FRAMES = <function> defined @tdBattlePetScript/UI/PetBattle.lua:265
 baseName = "tdBattlePetScript"

etc...

and also

6x tdBattlePetScript/UI/Minimap.lua:68: attempt to index upvalue 'L' (a nil value)
[string "@tdBattlePetScript/UI/Minimap.lua"]:68: in function `OnTooltipShow'
[string "*templates.xml:29_OnEnter"]:17: in function <[string "*templates.xml:29_OnEnter"]:1>
[string "=[C]"]: ?

Locals:
tooltip = GameTooltip {
 0 = <userdata>
 SetQuestLogRewardSpell = <function> defined @SharedXML/Tooltip/TooltipDataHandler.lua:440
 ItemTooltip = Frame {
 }
 SetHyperlink = <function> defined =[C]:-1
 SetAzeriteEssence = <function> defined @SharedXML/Tooltip/TooltipDataHandler.lua:440
 SetVoidDepositItem = <function> defined @SharedXML/Tooltip/TooltipDataHandler.lua:440
 AllTheThingsOnTooltipClearedHook = true
 SetSocketGem = <function> defined @SharedXML/Tooltip/TooltipDataHandler.lua:440
 SetLootCurrency = <function> defined @SharedXML/Tooltip/TooltipDataHandler.lua:440
 SetWorldCursor = <function> defined @FrameXML/GameTooltip.lua:952
 SetLootItem = <function> defined =[C]:-1
 GetSpell = <function> defined @FrameXML/GameTooltip.lua:990
 SetQuestLogSpecialItem = <function> defined @SharedXML/Tooltip/TooltipDataHandler.lua:440
 SetRecipeReagentItem = <function> defined @Altoholic/Services/Tooltip.lua:621

etc...

I don't see the addon under my menu/options/addons so I guess it's not loading correctly. Am I downloading it from the right place or am I doing something else wrong?

commented

Right, uh, wow. The translations being missing is to be expected, the remainder is not supposed to be that bad. The "issue" is that the source code and releases differ, mostly in terms of translations.

This zip is at version cc72a1f with translations for enUS and deDE. It should be equivalent to what you downloaded, but without errors.

commented

Ok, I must have done something stupid, my bad. It now works 100% for me, no errors.

Thanks - much appreciated! :)

commented

@nicpot Was the zip provided above by @bloerwald all OK for you? Please leave any further comments on #28

commented

Merged and included in next release.