Giter Club home page Giter Club logo

pbs's Introduction



πŸ‰ Battle Pet Combat ScriptingπŸ‰

  • Write scripts to automate pet battles
  • Assign scripts to pet teams
  • Full Rematch integration
  • Export and share scripts

This addon is a fork of the popular, but now abandoned, tdbattlePetScript addon.

Getting Started

It is always a good idea to backup your WTF folder before replacing an addon to ensure no data is lost!
If you already have tdBattlePetScript and tdBattlePetScript_Rematch installed, remove them both.

⚠️ Do not remove any saved variables otherwise this will also wipe your scripts.

You may find that uninstalling these also removes Rematch. If this happens, simply reinstall it.

Then download & install Pet Battle Scripts from either:

This addon takes the same name (tdBattlePetScript) under the hood so you should never have to transfer scripts over manually!

Documentation & Support

Please see the wiki for full addon documentation. If there is a problem, please raise it here or contact Super#0100 on Discord.

Screenshots

Credits

pbs's People

Contributors

axc450 avatar bloerwald avatar cosinussinus avatar dengsir avatar drakmyth avatar ennin avatar gizzmo avatar gurligebis avatar wanderingfox avatar witnesscm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pbs's Issues

Clean up string keys

The string keys are a bit of a mess. We seem to have the following "conventions":

  • Normal English (eg Create script)
  • Caps/snake case (eg NO_TEAM_FOR_SCRIPT)
  • The above but with a prefix that makes sense (OPTION_SETTINGS_NOTIFY_BUTTON_ACTIVE)

Personally, I think we should convert them all to the bottom one there. Or at least look to eliminate the first one

rematch: use REMATCH_TEAM_OVERWRITTEN argument saveMode if Gello adds it

Currently queries UI dialog for it. Gello suggested it to be added as an argument to the event. Use it, if that happens.

diff --git a/Rematch/Addon.lua b/Rematch/Addon.lua
index 6efc310..c0fac1b 100644
--- a/Rematch/Addon.lua
+++ b/Rematch/Addon.lua
@@ -73,5 +73,5 @@ function RematchPlugin:OnEnable()
         end
 
-        Rematch.events:Register(self, 'REMATCH_TEAM_OVERWRITTEN', function(self, overwriteID, teamID)
+        Rematch.events:Register(self, 'REMATCH_TEAM_OVERWRITTEN', function(self, overwriteID, teamID, saveMode)
             -- overwriteID is being overwritten with import, and wont have a script
             if overwriteID and not teamID then
@@ -79,7 +79,8 @@ function RematchPlugin:OnEnable()
             end
 
-            -- Note: Getting the subject from the UI instead of event data is Gello-approved.
-            local subject = Rematch.dialog:GetSubject()
-            if subject and subject.saveMode ~= Rematch.constants.SAVE_MODE_EDIT then
+            -- Note: Getting the subject from the UI instead of event data is Gello-approved. A later version
+            -- added it as an event argument to avoid future breakage.
+            saveMode = saveMode or (Rematch.dialog:GetSubject() and Rematch.dialog:GetSubject().saveMode)
+            if saveMode and saveMode ~= Rematch.constants.SAVE_MODE_EDIT then
                 if teamID and self:GetScript(teamID) then -- team exists, and has script
                     self:CopyScript(teamID, overwriteID)

Errors since patch

I've been getting these pretty often, especially the first one

22x ...PetTracker/libs/Sushi-3.1-5/classes/drops/Dropdown.lua:148: calling 'IsMouseOver' on bad self (Usage: local isMouseOver = self:IsMouseOver([offsetTop, offsetBottom, offsetLeft, offsetRight]))
[string "=[C]"]: in function `IsMouseOver'
[string "@PetTracker/libs/Sushi-3.1-5/classes/drops/Dropdown.lua"]:148: in function <...PetTracker/libs/Sushi-3.1/classes/drops/Dropdown.lua:147>
[string "@PetTracker/libs/Sushi-3.1-5/classes/drops/Dropdown.lua"]:153: in function <...PetTracker/libs/Sushi-3.1/classes/drops/Dropdown.lua:147>
[string "=(tail call)"]: ?
[string "@PetTracker/libs/Sushi-3.1-5/classes/drops/Dropdown.lua"]:93: in function <...PetTracker/libs/Sushi-3.1/classes/drops/Dropdown.lua:92>

3x [ADDON_ACTION_BLOCKED] AddOn 'PetTracker' tried to call the protected function 'GetPlaystyleString()'.
[string "@!BugGrabber/BugGrabber.lua"]:480: in function <!BugGrabber/BugGrabber.lua:480>
[string "=[C]"]: in function GetPlaystyleString' [string "@FrameXML/LFGList.lua"]:3524: in function LFGListUtil_SetSearchEntryTooltip'
[string "@FrameXML/LFGList.lua"]:2597: in function <FrameXML/LFGList.lua:2594>

Pet Battle Scripts is completely missing

The files are installed. I've uninstalled and reinstalled many times. I can make teams but there are no tabs, no right click to make notes or write a script. The buttons for the hat and the sausage are missing. There's no "target" or save. Any suggestions

Feature Request: Database of all Rematch Teams and Pet Battle Scripts from wow-petguide (Xufu's)

It would be the most amazing thing ever if you all had a database that auto looked at your available pets and auto imported associated teams and pet battle scripts that exist on Xufu. I know this would be a huge undertaking, I would be highly motivated to help you dump these, I would also be willing to donate a large sum to get a feature like this made as it would be a very useful thing for the wowaddon world.

change(next) confuses users: it does not skip dead pets

Given the script change(next), currently the behavior is as follows

pet 1 pet 2 pet 3 active result
🟒 🟒 🟒 1 ➑️ 2
🟒 🟒 🟒 2 ➑️ 3
🟒 🟒 🟒 3 ➑️ 1
🟒 🟒 ❌ 1 ➑️ 2
🟒 🟒 ❌ 2 πŸŒ€ freeze
🟒 🟒 ❌ 3 ➑️ 1
🟒 ❌ 🟒 1 πŸŒ€ freeze
🟒 ❌ 🟒 2 ➑️ 3
🟒 ❌ 🟒 3 ➑️ 1
❌ 🟒 🟒 1 ➑️ 2
❌ 🟒 🟒 2 ➑️ 3
❌ 🟒 🟒 3 πŸŒ€ freeze
❌ ❌ 🟒 1 πŸŒ€ freeze
❌ ❌ 🟒 2 ➑️ 3
❌ ❌ 🟒 3 ❄️ freeze
❌ 🟒 ❌ 1 ➑️ 2
❌ 🟒 ❌ 2 ❄️ freeze
❌ 🟒 ❌ 3 πŸŒ€ freeze
🟒 ❌ ❌ 1 ❄️ freeze
🟒 ❌ ❌ 2 πŸŒ€ freeze
🟒 ❌ ❌ 3 ➑️ 1

The results marked πŸŒ€ are confusing to me and at least one user. Our expectation would have been

pet 1 pet 2 pet 3 active result
🟒 🟒 ❌ 2 ➑️ 1
🟒 ❌ 🟒 1 ➑️ 3
❌ 🟒 🟒 3 ➑️ 2
❌ ❌ 🟒 1 ➑️ 3
❌ 🟒 ❌ 3 ➑️ 2
🟒 ❌ ❌ 2 ➑️ 1

i.e. "skip to the next alive pet", not "skip to the next pet if it is alive".

The current implementation is a dumb index = index % C_PetBattles.GetNumPets(Enum.BattlePetOwner.Ally) + 1, so it is working exactly as intended, but I claim that's not what users expect.

There are two options here: Change the behavior of change(next), potentially breaking some user script (but I really doubt people actually expect and rely on this behavior). The alternative is to introduce change(nextusable) which would check whether the new choice actually can be used, only freezing if there is no alternative.

The implementation for either should look somewhat like

local function nextAfter(index)
    return index % C_PetBattles.GetNumPets(Enum.BattlePetOwner.Ally) + 1
end
local function canUse(index)
    return C_PetBattles.GetHealth(Enum.BattlePetOwner.Ally, index) ~= 0 and
           C_PetBattles.CanPetSwapIn(index)
end

index = nextAfter(active)
while not canUse(index) and index ~= active do
    index = nextAfter(index)
end

The and C_PetBattles.CanPetSwapIn(index) condition already exists within this action, but as "if that's the case, don't actually change". It is up for debate whether the pets active, forced-to-not-be-active, alive should switch to alive or fail as forced-to-not-be-active is alive but unusable (the current behavior).

I claim that 99% of change(next) are either in scripts just mindlessly using a filler pet, or in scripts where the expectation is that one pet dies one after another 1, 2, win style.

I'd be happy with both options, but feel that there is no need to keep the old behavior (and educating people is harder than the effects of breaking it).

Test button in script editor

Add an Evaluation/Test button in the script editor that would run the script and let the user know which action would have been carried out, without actually performing the action.

Would often be useful when writing scripts to check that the edit is doing what you'd want (and avoid facepalm moments where it really doesn't do what you want, and the fight moves on to the next turn with an unwanted action)

Autocomplete?

I'm sure a version of tdBattleScript had autocomplete when writing scripts, but I'm not seeing it in the current PBS version. Is autocomplete available, and if so, how is it activated?

Can't hide minimap button and showing icon on Chocolatebar.

Hello.

I recently installed this addon to make pet battling a bit less tedious, but I found an issue:

When I wanted to show the icon on my ChocolateBar addon, but also hide the minimap icon. If I try, it will make ChocolateBar to not register this addon at all, thus not showing its icon on the bar.

Any ideas?

Wiki changes for trap/collected status conditions

Github makes it extremely annoying for a non-collaborator to edit the wiki, here's the wiki edits that should have been included in my original PR!

Pets Heading:

### `collected`
if the pet is in your collection or not

**Return:** `bool`
**Examples:** `enemy.collected`, `enemy(#2).collected`, `enemy(Chrominius).collected`

Status Heading:

### `trap`
if the trap is usable (or potentially usable if enemy hp is low enough)

**Return:** `bool`
**Examples:** `catch [trap & enemy.hpp < 35]`

When I have some time over the weekend I intend to extend these a little further if you're still interested in accepting PRs :)

Thank you for picking up maintenance btw!

Error when using Auto battle with default keybind

I'm not sure if this is from the addon or the script being used. The error pops up when the 2nd pet comes in and tries to execute an action.

The script I'm using is from here: https://pastebin.com/3ywz5n4w

6x tdBattlePetScript/Core/Condition.lua:37: attempt to compare nil with number
[string "@tdBattlePetScript/Core/Condition.lua"]:37: in function <tdBattlePetScript/Core/Condition.lua:37>
[string "=(tail call)"]: ?
[string "=(tail call)"]: ?
[string "@tdBattlePetScript/Core/Condition.lua"]:97: in function Run' [string "@tdBattlePetScript/Core/Director.lua"]:53: in function Action'
[string "@tdBattlePetScript/Core/Director.lua"]:53: in function Action' [string "@tdBattlePetScript/Core/Director.lua"]:24: in function Run'
[string "@tdBattlePetScript/UI/PetBattle.lua"]:340: in function `OnAutoButtonClick'
[string "@tdBattlePetScript/UI/PetBattle.lua"]:86: in function <tdBattlePetScript/UI/PetBattle.lua:85>

Locals:
a = nil
b = 3
(*temporary) = nil
(*temporary) = "attempt to compare nil with number"

self.active "Not found command"

Script imported from XuFu - nil issues prior, now reports

"Found error: Invalid Condition: 'self(#2).active' (Not found cmd 'self.active')

Screenshot attached

image

bug get menu line 53

Message: Interface/AddOns/tdBattlePetScript/Rematch/UI.lua line 53:
attempt to call method 'GetMenu' (a nil value)
Debug:
[string "=(tail call)"]: ?
[string "=(tail call)"]: ?
[string "@Interface/AddOns/tdBattlePetScript/Rematch/UI.lua"]:53:
Interface/AddOns/tdBattlePetScript/Rematch/UI.lua:52
[string "=[C]"]: ?
[string "@Interface/AddOns/Accountant/Libs/AceAddon-3.0/AceAddon-3.0.lua"]:66:
...AddOns/Accountant/Libs/AceAddon-3.0/AceAddon-3.0.lua:61
[string "@Interface/AddOns/Accountant/Libs/AceAddon-3.0/AceAddon-3.0.lua"]:523:
...AddOns/Accountant/Libs/AceAddon-3.0/AceAddon-3.0.lua:516
[string "=(tail call)"]: ?
[string "@Interface/AddOns/tdBattlePetScript/Core/Manager/PluginManager.lua"]:149: LoadPlugins()
[string "@Interface/AddOns/tdBattlePetScript/Core/Manager/PluginManager.lua"]:33:
...Ons/tdBattlePetScript/Core/Manager/PluginManager.lua:32
Locals:
(*temporary) = defined =[C]:-1

Auto Summon

I do not want pets to be Autosummoned when I change teams. tdbattlescript dealt with this. Can't find any option to turn this off

1x tdBattlePetScript/Extension/Round.lua:38: attempt to index field 'rounds' (a nil value)

1x tdBattlePetScript/Extension/Round.lua:38: attempt to index field 'rounds' (a nil value)
[string "@tdBattlePetScript/Extension/Round.lua"]:38: in function OnBattleStart' [string "@tdBattlePetScript/Core/Manager/BattleCacheManager.lua"]:40: in function ?'
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:119: in function <...ded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:119>
[string "=[C]"]: ?
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:29: in function <...ded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:25>
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:64: in function `Fire'
[string "@ActionBarSaverReloaded/Libs/AceEvent-3.0-4/AceEvent-3.0.lua"]:120: in function <...nBarSaverReloaded/Libs/AceEvent-3.0/AceEvent-3.0.lua:119>

Locals:
self =

{
SetDefaultModuleLibraries = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:367
Enable = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:294
UnregisterAllEvents = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:174
EnableModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:332
modules =
{
}
GetModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:210
IterateEmbeds = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:442
defaultModuleLibraries =
{
}
GetName = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:279
name = "tdBattlePetScript_BattleCacheManager_Round"
PET_BATTLE_PET_ROUND_RESULTS = defined @tdBattlePetScript/Extension/Round.lua:20
IsEnabled = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:451
orderedModules =
{
}
DisableModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:350
OnBattleStart = defined @tdBattlePetScript/Extension/Round.lua:37
RegisterMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:90
UnregisterMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:153
IsModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:217
SetDefaultModuleState = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:387
GetRoundByOwner = defined @tdBattlePetScript/Extension/Round.lua:47
SetEnabledState = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:424
baseName = "tdBattlePetScript"
enabledState = true
GetRound = defined @tdBattlePetScript/Extension/Round.lua:43
RegisterEvent = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:90
UnregisterAllMessages = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:174
SendMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:59
SetDefaultModulePrototype = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:409
OnEnable = defined @tdBattlePetScript/Extension/Round.lua:9
IterateModules = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:437
NewModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:235
defaultModuleState = true
PET_BATTLE_PET_CHANGED = defined @tdBattlePetScript/Extension/Round.lua:31
moduleName = "Round"
UnregisterEvent = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:153
Disable = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:314
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field 'rounds' (a nil value)"

[string "@tdBattlePetScript/Extension/Round.lua"]:38: in function OnBattleStart' [string "@tdBattlePetScript/Core/Manager/BattleCacheManager.lua"]:40: in function ?'
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:119: in function <...ded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:119>
[string "=[C]"]: ?
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:29: in function <...ded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:25>
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:64: in function `Fire'
[string "@ActionBarSaverReloaded/Libs/AceEvent-3.0-4/AceEvent-3.0.lua"]:120: in function <...nBarSaverReloaded/Libs/AceEvent-3.0/AceEvent-3.0.lua:119>

Locals:
self =

{
SetDefaultModuleLibraries = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:367
Enable = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:294
UnregisterAllEvents = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:174
EnableModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:332
modules =
{
}
GetModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:210
IterateEmbeds = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:442
defaultModuleLibraries =
{
}
GetName = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:279
name = "tdBattlePetScript_BattleCacheManager_Round"
PET_BATTLE_PET_ROUND_RESULTS = defined @tdBattlePetScript/Extension/Round.lua:20
IsEnabled = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:451
orderedModules =
{
}
DisableModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:350
OnBattleStart = defined @tdBattlePetScript/Extension/Round.lua:37
RegisterMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:90
UnregisterMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:153
IsModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:217
SetDefaultModuleState = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:387
GetRoundByOwner = defined @tdBattlePetScript/Extension/Round.lua:47
SetEnabledState = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:424
baseName = "tdBattlePetScript"
enabledState = true
GetRound = defined @tdBattlePetScript/Extension/Round.lua:43
RegisterEvent = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:90
UnregisterAllMessages = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:174
SendMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:59
SetDefaultModulePrototype = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:409
OnEnable = defined @tdBattlePetScript/Extension/Round.lua:9
IterateModules = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:437
NewModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:235
defaultModuleState = true
PET_BATTLE_PET_CHANGED = defined @tdBattlePetScript/Extension/Round.lua:31
moduleName = "Round"
UnregisterEvent = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:153
Disable = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:314
}
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field 'rounds' (a nil value)"

1x tdBattlePetScript_Rematch/Addon.lua:21: attempt to index global 'RematchSettings' (a nil value)
[string "@tdBattlePetScript_Rematch/Addon.lua"]:21: in function <tdBattlePetScript_Rematch/Addon.lua:20>
[string "=(tail call)"]: ?
[string "=[C]"]: in function xpcall' [string "@tdBattlePetScript/Core/Director.lua"]:209: in function Select'
[string "@tdBattlePetScript/UI/PetBattle.lua"]:278: in function UpdateScriptList' [string "@tdBattlePetScript/UI/PetBattle.lua"]:240: in function ?'
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:119: in function <...ded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:119>
[string "=[C]"]: ?
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:29: in function <...ded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:25>
[string "@ActionBarSaverReloaded/Libs/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:64: in function `Fire'
[string "@ActionBarSaverReloaded/Libs/AceEvent-3.0-4/AceEvent-3.0.lua"]:120: in function <...nBarSaverReloaded/Libs/AceEvent-3.0/AceEvent-3.0.lua:119>

Locals:
self =

{
SetDefaultModuleLibraries = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:367
Enable = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:294
NewModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:235
EnableModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:332
modules =
{
}
GetModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:210
IterateEmbeds = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:442
SecureHook = defined @Plexus/Libs/AceHook-3.0/AceHook-3.0.lua:335
defaultModuleLibraries =
{
}
RawHookScript = defined @Plexus/Libs/AceHook-3.0/AceHook-3.0.lua:394
OnDisable = defined @tdBattlePetScript_Rematch/UI.lua:237
hooks =
{
}
_title = "Rematch"
baseName = "tdBattlePetScript_Rematch"
SetDefaultModulePrototype = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:409
OnExport = defined @tdBattlePetScript_Rematch/UI.lua:249
OnImport = defined @tdBattlePetScript_Rematch/UI.lua:256
IterateKeys = defined @tdBattlePetScript_Rematch/Addon.lua:24
name = "tdBattlePetScript_PluginManager_Rematch"
_icon = "Interface\Icons\PetJournalPortrait"
IsEnabled = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:451
orderedModules =
{
}
OnTooltipFormatting = defined @tdBattlePetScript_Rematch/Addon.lua:49
DisableModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:350
NewClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:322
OnEnable = defined @tdBattlePetScript_Rematch/UI.lua:52
GetPetTip = defined @tdBattlePetScript_Rematch/Addon.lua:36
GetTitleByKey = defined @tdBattlePetScript_Rematch/Addon.lua:32
RegisterMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:90
UnregisterMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:153
FindMenuItem = defined @tdBattlePetScript_Rematch/UI.lua:241
GetCurrentKey = defined @tdBattlePetScript_Rematch/Addon.lua:20
IsHooked = defined @Plexus/Libs/AceHook-3.0/AceHook-3.0.lua:492
OnInitialize = defined @tdBattlePetScript_Rematch/Addon.lua:13
GetClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:332
IsModule = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:217
_notes = "This script selector will be bound to Rematch team."
SetDefaultModuleState = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:387
SendMessage = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:59
UnhookAll = defined @Plexus/Libs/AceHook-3.0/AceHook-3.0.lua:476
SetEnabledState = defined @ActionBarSaverReloaded/Libs/AceAddon-3.0/AceAddon-3.0.lua:424
Hook = defined @Plexus/Libs/AceHook-3.0/AceHook-3.0.lua:273
enabledState = true
Unhook = defined @Plexus/Libs/AceHook-3.0/AceHook-3.0.lua:417
RegisterEvent = defined @ActionBarSaverReloaded/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:90
UnregisterAllMessag

Pet Battle Script bug

43x tdBattlePetScript/Rematch/Addon.lua:214: attempt to index field '?' (a function value)
[string "@tdBattlePetScript/Rematch/Addon.lua"]:214: in function GetTitleByKey' [string "@tdBattlePetScript/UI/Import.lua"]:265: in function menuTable'
[string "@tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua"]:124: in function <...Ons/tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua:120>
[string "=[C]"]: in function `Click'
[string "@tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua"]:41: in function <...Ons/tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua:40>

Locals:
self =

{
SetDefaultModuleLibraries = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:363
UnhookAll = defined @EasyFrames/Libs/AceHook-3.0/AceHook-3.0.lua:476
Enable = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:290
NewModule = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:231
SecureHookScript = defined @EasyFrames/Libs/AceHook-3.0/AceHook-3.0.lua:409
EnableModule = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:328
modules =
{
}
GetModule = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:206
IterateEmbeds = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:438
_icon = "Interface\AddOns\Rematch\Textures\icon"
SecureHook = defined @EasyFrames/Libs/AceHook-3.0/AceHook-3.0.lua:335
defaultModuleLibraries =
{
}
hooks =
{
}
_title = "Rematch"
baseName = "tdBattlePetScript"
RawHookScript = defined @EasyFrames/Libs/AceHook-3.0/AceHook-3.0.lua:394
TeardownUI = defined @tdBattlePetScript/Rematch/UI.lua:212
SendMessage = defined @Bazooka/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:49
UpdateDBRematch4To5 = defined @tdBattlePetScript/Rematch/Addon.lua:325
ResetEverything = defined @tdBattlePetScript/Rematch/Addon.lua:318
SetDefaultModulePrototype = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:405
OnImportContinuation = defined @tdBattlePetScript/Rematch/Addon.lua:305
OnImport = defined @tdBattlePetScript/Rematch/Addon.lua:284
OnExport = defined @tdBattlePetScript/Rematch/Addon.lua:267
name = "PetBattleScripts_PluginManager_Rematch"
OnExportImpl = defined @tdBattlePetScript/Rematch/Addon.lua:256
IsEnabled = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:447
orderedModules =
{
}
OnTooltipFormatting = defined @tdBattlePetScript/Rematch/Addon.lua:220
DisableModule = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:346
NewClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:349
GetTitleByKey = defined @tdBattlePetScript/Rematch/Addon.lua:210
IterateKeys = defined @tdBattlePetScript/Rematch/Addon.lua:196
GetCurrentKey = defined @tdBattlePetScript/Rematch/Addon.lua:186
RegisterMessage = defined @Bazooka/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
UnregisterMessage = defined @Bazooka/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
OnDisable = defined @tdBattlePetScript/Rematch/Addon.lua:167
OnEnable = defined @tdBattlePetScript/Rematch/Addon.lua:25
IsHooked = defined @EasyFrames/Libs/AceHook-3.0/AceHook-3.0.lua:492
OnInitialize = defined @tdBattlePetScript/Rematch/Addon.lua:14
GetClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:359
IsModule = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:213
_notes = "This script selector will be bound to the Rematch team."
SetDefaultModuleState = defined @Bazooka/libs/Ace3/AceAddon-3.0/AceAddon-3.0.lua:383
SetupUI = defined @tdBattlePetScript/Rematch/UI.lua:49
updateFrames = defined @tdBattlePetScript/Rematch/UI.lua:64
SetEnabledStat

Script editor LUA error when moving the window

Sometimes a LUA error can occur when attempting to move the Script Editor window:

3x ...t/Libs/LibWindow-1.1-18/LibWindow-1.1/LibWindow-1.1.lua:129: attempt to perform arithmetic on a nil value
[string "@Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1-18/LibWindow-1.1/LibWindow-1.1.lua"]:129: in function `SavePosition'
[string "@Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Widget/BasicPanel.lua"]:39: in function <...s/tdBattlePetScript/Libs/tdGUI/Widget/BasicPanel.lua:37>

Locals:
frame = Frame {
 0 = <userdata>
 TitleText = FontString {
 }
 RightBorder = Texture {
 }
 LeftBorder = Texture {
 }
 Drag = Frame {
 }
 Update = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:688
 TopRightCorner = Texture {
 }
 TopLeftCorner = Texture {
 }
 Bg = Texture {
 }
 TopBorder = Texture {
 }
 TopTileStreaks = Texture {
 }
 TitleBg = Texture {
 }
 BottomBorder = Texture {
 }
 SetRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:31
 IsRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:36
 Refresh = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:21
 CloseButton = Button {
 }
 _storage = <table> {
 }
 Resize = Button {
 }
 BotLeftCorner = Texture {
 }
 Portrait = Frame {
 }
 SetTitle = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:30
 BotRightCorner = Texture {
 }
}
parent = UIParent {
 0 = <userdata>
 Tabs = <table> {
 }
 ContainerFrames = <table> {
 }
 firstTimeLoaded = 1
 variablesLoaded = true
}
s = 1
(*temporary) = nil
(*temporary) = Frame {
 0 = <userdata>
 TitleText = FontString {
 }
 RightBorder = Texture {
 }
 LeftBorder = Texture {
 }
 Drag = Frame {
 }
 Update = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:688
 TopRightCorner = Texture {
 }
 TopLeftCorner = Texture {
 }
 Bg = Texture {
 }
 TopBorder = Texture {
 }
 TopTileStreaks = Texture {
 }
 TitleBg = Texture {
 }
 BottomBorder = Texture {
 }
 SetRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:31
 IsRefreshOnShow = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:36
 Refresh = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/tdGUI/Embed/Refresh.lua:21
 CloseButton = Button {
 }
 _storage = <table> {
 }
 Resize = Button {
 }
 BotLeftCorner = Texture {
 }
 Portrait = Frame {
 }
 SetTitle = <function> defined @Interface/AddOns/tdBattlePetScript/UI/MainPanel.lua:30
 BotRightCorner = Texture {
 }
}
(*temporary) = <userdata>
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to perform arithmetic on a nil value"
nilParent = <table> {
 GetHeight = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:115
 GetWidth = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:112
 GetScale = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:118
}
abs = <function> defined =[C]:-1
setStorage = <function> defined @Interface/AddOns/tdBattlePetScript/Libs/LibWindow-1.1/LibWindow-1.1/LibWindow-1.1.lua:61

image

REMATCH_TEAM_OVERWRITTEN inconstancy with how scripts are managed.

Rematch.events:Register(self, 'REMATCH_TEAM_OVERWRITTEN', function(self, newTeamID, oldTeamID)

This is what i was worried about. After some testing i found some inconstancy with how things are handled, with scripts moving when teams are overwritten. I don't know if its our implementation, or an issue with how Rematch is firing/using the event.

Scenario 1:

If the old team has a script, when the new team overwrites it, the script still exists. That's ok i guess. The user can just delete the script.

Steps:

  • Create a team named Team 1 and add a script test(This is Team 1)
  • Import/load random pets (edit: Save and overwrite Team 1)
  • Script still exists.

Scenario 2:

If the old team does not have a script, and the new team does, the script moves. As expected. πŸ‘πŸ»

Steps:

  • Create two teams (Team 1/Team 2)
  • Add script to "Team 2" with script test(Team 2)
  • Edit "Team 2" , change name to "Team 1" and overwrite existing team
  • Team 1 now has a script with the name "Team 1" and contents test(Team 2)

Scenario 3:

If both teams have scripts, the new teams script does not overwrite old team's script. The old team's script should be deleted.

Steps:

  • Create two teams (Team 1/Team 2)
  • Add a script to to both of them, with contents that's easily tracked: test(This is Team 1)`test(This is Team 2)`
  • Edit "Team 2" and change name to "Team 1" and overwrite the existing team.
  • "Team 1" keeps the scripted named "Team 1" with test(This is Team 1).
  • "Team 1" should have the script test(This is Team 2) script.

Scenario 4:

Steps:

  • Create two teams with easily trackable scripts.
  • Load Team 1. (you can change pets to make it easier to track, just as long as Team 1 remains the loaded team)
  • Click "Save As" name it "Team 2", and overwrite existing team.
  • Team 1 remains, but has script named "Team 2" with contents test(Team 2)
  • Team 2 has no script.

Team 1 shouldn't have been touched, and Team 2 should either maintain the old Team 2 script, or have no script.

Auto Button Not Working

There was previous functionality where the Auto Button would be a single press key that would step through the script. This functionality is either missing or not working. Is there any update on whether this functionality will be fixed or re-implemented? If this can no longer be done due to changes to Blizzard's API or something, can we please get that statement added to the addon description in CurseForge?

[Feature Request] Allow export/share/import the script along with teams in Rematch integration

One of the best features of Rematch is allowing you to export/share/import teams (or even entire groups of teams) with your friends.

The integration of PBS with Rematch currently only contemplates writing the scripts directly for each team. It would be super useful if when exporting/sharing/importing teams they could be shared along with their associated script. This may also require some modifications to be made from Rematch side, so it may also be necessary to contact the author of that addon.

As a practical example, lately I have been doing quite a few achievements with a friend, we make large collections of teams for each situation along with its script. While teams and their notes can be shared directly with a single click almost instantly, for scripts we need to copy them to a text file one by one, share it by other means, and then "import" manually them, which requires considerable time.

Any chance of this being implemented in the future? Thank you and greetings.

LUA error PetBattle Script 1.8

LUA error on load in

4x tdBattlePetScript/Rematch/UI.lua:53: attempt to call method 'GetMenu' (a nil value)
[string "@tdBattlePetScript/Rematch/UI.lua"]:53: in function <tdBattlePetScript/Rematch/UI.lua:52>
[string "=[C]"]: ?
[string "@Ailo/Libs/AceAddon-3.0-13/AceAddon-3.0.lua"]:66: in function <...rfaceAilo/Libs/AceAddon-3.0/AceAddon-3.0.lua:61>
[string "@Ailo/Libs/AceAddon-3.0-13/AceAddon-3.0.lua"]:523: in function <...rfaceAilo/Libs/AceAddon-3.0/AceAddon-3.0.lua:516>
[string "=(tail call)"]: ?
[string "@tdBattlePetScript/Core/Manager/PluginManager.lua"]:149: in function `LoadPlugins'
[string "@tdBattlePetScript/Core/Manager/PluginManager.lua"]:33: in function <...Ons/tdBattlePetScript/Core/Manager/PluginManager.lua:32>

Locals:
self =

{
SetDefaultModuleLibraries = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:363
Enable = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:290
NewModule = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:231
EnableModule = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:328
modules =
{
}
GetModule = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:206
IterateEmbeds = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:438
SecureHook = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:335
defaultModuleLibraries =
{
}
RawHookScript = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:394
IterateKeys = defined @tdBattlePetScript/Rematch/Addon.lua:24
hooks =
{
}
_title = "Rematch"
SetDefaultModulePrototype = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:405
baseName = "tdBattlePetScript"
OnImport = defined @tdBattlePetScript/Rematch/UI.lua:256
OnExport = defined @tdBattlePetScript/Rematch/UI.lua:249
name = "PetBattleScripts_PluginManager_Rematch"
_icon = "Interface\Icons\Icon_petfamily_dragon"
IsEnabled = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:447
orderedModules =
{
}
OnTooltipFormatting = defined @tdBattlePetScript/Rematch/Addon.lua:36
DisableModule = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:346
NewClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:349
OnDisable = defined @tdBattlePetScript/Rematch/UI.lua:237
OnEnable = defined @tdBattlePetScript/Rematch/UI.lua:52
GetTitleByKey = defined @tdBattlePetScript/Rematch/Addon.lua:32
RegisterMessage = defined @Ailo/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
UnregisterMessage = defined @Ailo/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
FindMenuItem = defined @tdBattlePetScript/Rematch/UI.lua:241
GetCurrentKey = defined @tdBattlePetScript/Rematch/Addon.lua:20
IsHooked = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:492
OnInitialize = defined @tdBattlePetScript/Rematch/Addon.lua:13
GetClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:359
IsModule = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:213
_notes = "This script selector will be bound to the Rematch team."
SetDefaultModuleState = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:383
SendMessage = defined @Ailo/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:49
UnhookAll = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:476
SetEnabledState = defined @Ailo/Libs/AceAddon-3.0/AceAddon-3.0.lua:420
Hook = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:273
enabledState = true
Unhook = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:417
RegisterEvent = defined @Ailo/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
UnregisterAllMessages = defined @Ailo/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:164
SecureHookScript = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:409
HookScript = defined @Ailo/Libs/AceHook-3.0/AceHook-3.0.lua:365
UnregisterAllEvents = defined @Ailo/Libs/CallbackHandler-1.0/CallbackH

Errors recently

Been getting these recently, not sure when it started, maybe weekly reset on the 9th?

19x tdBattlePetScript/Rematch/UI.lua:53: attempt to call method 'GetMenu' (a nil value)
[string "@tdBattlePetScript/Rematch/UI.lua"]:53: in function <tdBattlePetScript/Rematch/UI.lua:52>
[string "=[C]"]: ?
[string "@Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:66: in function <Ace3/AceAddon-3.0/AceAddon-3.0.lua:61>
[string "@Ace3/AceAddon-3.0-13/AceAddon-3.0.lua"]:523: in function <Ace3/AceAddon-3.0/AceAddon-3.0.lua:516>
[string "=(tail call)"]: ?
[string "@tdBattlePetScript/Core/Manager/PluginManager.lua"]:149: in function `LoadPlugins'
[string "@tdBattlePetScript/Core/Manager/PluginManager.lua"]:33: in function <...Ons/tdBattlePetScript/Core/Manager/PluginManager.lua:32>

Update Autoformatter

As #49 relaxed whitespace in the language, the auto formatter should take advantage of this and format scripts in a more readable way (see example on the PR). Once done, is it worth running this against all scripts in XuFus?

broken conditions like `enemy.hp < 1)` are not diagnosed

A user submitted a script using

use (ability) [ cond & enemy.hp < 100) ]

which just silently stopped evaluating when cond became true. Without Lua errors enabled, it just fails silently, with them

1x tdBattlePetScript/Core/Condition.lua:35: attempt to compare number with string
[string "@tdBattlePetScript/Core/Condition.lua"]:35: in function <tdBattlePetScript/Core/Condition.lua:35>

Locals:
a = 479
b = "100)"
(*temporary) = "attempt to compare number with string"

indicates the typo, but this is of course really bad to understand for users.

As part of the syntax checker,

  • conditions should be checked to begin with in this situation
  • when checking conditions, this needs to not be short circuit but independent of actual values.

If this is hard in the syntax checker, the runtime error should somehow be transported with Lua errors disabled as well.

Rematch 5 Support

Since this will be the new version can we get an update that these work together again. Without scripts is like life without coffee

Iron Starlette's self.aura(Wind-Up:459) not recognised with ID in the selectors

When the Iron Starlette's Wind-Up aura is present, if I include the ID in the selectors, the conditional fails as it doesn't see the aura.

Ability: https://www.wowhead.com/pet-ability=459/wind-up

This works:
test(Without ID) [!self.aura(Wind-Up).exists]

This fails:
test(With ID) [!self.aura(Wind-Up:459).exists]

Full script against Glitterdust in Ardenweald:

quit [ally(Stormborne Whelpling:1721).dead & enemy(Slugger:3000).active]
change(Iron Starlette:1387) [enemy(Slugger:3000).dead]
change(Chrominius:1152) [ally(Iron Starlette:1387).dead]

if [self.is(Stormborne Whelpling:1721)]
  use(Tail Sweep:122) [round >= 3]
  use(Call Lightning:204)
  use(Arcane Storm:589)
endif
if [self.is(Iron Starlette:1387)]
  use(Wind-Up:459) [!self.aura(Wind-Up).exists] -- Problematic line
  use(Supercharge:208) [enemy.is(Runehoof:3001)]
  use(Wind-Up:459)
endif
if [self.is(Chrominius:1152)]
  use(Howl:362)
  use(Surge of Power:593)
  use(Arcane Explosion:299)
endif

Latest version.

1x AceLocale-3.0-6: PetBattleScripts: Missing entry for 'OPTION_SETTINGS_NOTIFY_BUTTON_ACTIVE_SOUND'
[string "@tdBattlePetScript/UI/Options.lua"]:57: in function `InitOptions'
[string "@tdBattlePetScript/UI/Options.lua"]:12: in function <tdBattlePetScript/UI/Options.lua:11>

NOT AN ISSUE - Clarification Request

Does this program "record" a match so I can save it if something works for me?

When I returned to retail in 2020, I used an addon that would record a step-by-step match for saving; after one update right before Shadowlands, it stopped working and interfered with some of my other addons, and I had to delete it from my addons.

I just have some perfect matches ... remember what to do but since I do so many, not all the time. Then, after one corruption after a patch update (which never fails), I lost my scripts and my teams.

I had previously backed up my WTF regularly, but I had just moved to a new computer and had forgotten to grab those backup files.

Help!?!?

Additional support for sounds

Would it be possible to add two more "Play sound when..." events to this addon?

  1. When pressing "Autobattle" does nothing (excluding "test" action)
  2. When pressing "Autobattle" causes you to forfeit ("quit" action was used)

let editor window have focus when opening

Curse comment # 6359680 from orlith77:

Hello
Thx for this addon and the work you did.
May I ask for a small enhancement ? or any solution to the below "issue"

When opening the pet battle script windows, the focus is elsewhere than inside the windows. Would it be possible to set the focus to be the place where we paste the script ? That will reduce the number of click :
Opening the window then we just have to type or paste. ONe click less :)

As you see this is not a big issue so no hurry ;)

Thx

can_explode threshold (minor issue)

Addon:RegisterCondition('hp.can_explode', { type = 'boolean', arg = false }, function(owner, pet)
return pet and C_PetBattles.GetHealth(owner, pet) < floor(logical_max_health(getOpponentActivePet(owner)) * 0.4)
end)

should be changed to

Addon:RegisterCondition('hp.can_explode', { type = 'boolean', arg = false }, function(owner, pet)
return pet and C_PetBattles.GetHealth(owner, pet) <= floor(logical_max_health(getOpponentActivePet(owner)) * 0.4)
end)

Script Selector Button always showing?!

Why do I always have to press the button to select the rematch script? Is this not saved or is there a Key for it? that's really annoying when leveling new pets.

Only the first line of instructions will be executed.

Rematch: Rematch_5_1_4.zip
Pet Battle Scripts: PetBattleScripts-v1.10.1.zip

When I click the test button multiple times, only the first line of instructions is executed.

Note: I only enable Rematch and Pet Battle Scripts addon, but the problem is the same.
I copy some sample script from https://www.wow-petguide.com/ to double check. The problem is the same.
How should I debug this?

Thanks

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

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!

Write Script Missing

The ability to write scripts is missing when right-clicking on an existing saved team.
image

Addon.lua:214: attempt to index field '?' (a function value)

Running 1.9.3. Tried to import a script from Xu-Fu's and when I go to select the NPC I'm battling (Select the Key), after selecting Rematch from the first dropdown menu, I get the following error and it will not let me continue with the import. Thanks.

16x tdBattlePetScript/Rematch/Addon.lua:214: attempt to index field '?' (a function value)
[string "@tdBattlePetScript/Rematch/Addon.lua"]:214: in function GetTitleByKey' [string "@tdBattlePetScript/UI/Import.lua"]:265: in function menuTable'
[string "@tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua"]:124: in function <...Ons/tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua:120>
[string "=[C]"]: in function `Click'
[string "@tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua"]:41: in function <...Ons/tdBattlePetScript/Libs/tdGUI/Widget/Dropdown.lua:40>

Locals:
self =

{
SetDefaultModuleLibraries = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:363
UnhookAll = defined @BattlePetCompletionist/Libs/AceHook-3.0/AceHook-3.0.lua:476
Enable = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:290
NewModule = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:231
SecureHookScript = defined @BattlePetCompletionist/Libs/AceHook-3.0/AceHook-3.0.lua:409
EnableModule = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:328
modules =
{
}
GetModule = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:206
IterateEmbeds = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:438
_icon = "Interface\AddOns\Rematch\Textures\icon"
SecureHook = defined @BattlePetCompletionist/Libs/AceHook-3.0/AceHook-3.0.lua:335
defaultModuleLibraries =
{
}
hooks =
{
}
_title = "Rematch"
baseName = "tdBattlePetScript"
RawHookScript = defined @BattlePetCompletionist/Libs/AceHook-3.0/AceHook-3.0.lua:394
TeardownUI = defined @tdBattlePetScript/Rematch/UI.lua:215
SendMessage = defined @DataStore/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:49
UpdateDBRematch4To5 = defined @tdBattlePetScript/Rematch/Addon.lua:325
ResetEverything = defined @tdBattlePetScript/Rematch/Addon.lua:318
SetDefaultModulePrototype = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:405
OnImportContinuation = defined @tdBattlePetScript/Rematch/Addon.lua:305
OnImport = defined @tdBattlePetScript/Rematch/Addon.lua:284
OnExport = defined @tdBattlePetScript/Rematch/Addon.lua:267
name = "PetBattleScripts_PluginManager_Rematch"
OnExportImpl = defined @tdBattlePetScript/Rematch/Addon.lua:256
IsEnabled = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:447
orderedModules =
{
}
OnTooltipFormatting = defined @tdBattlePetScript/Rematch/Addon.lua:220
DisableModule = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:346
NewClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:349
GetTitleByKey = defined @tdBattlePetScript/Rematch/Addon.lua:210
IterateKeys = defined @tdBattlePetScript/Rematch/Addon.lua:196
GetCurrentKey = defined @tdBattlePetScript/Rematch/Addon.lua:186
RegisterMessage = defined @DataStore/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
UnregisterMessage = defined @DataStore/libs/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
OnDisable = defined @tdBattlePetScript/Rematch/Addon.lua:167
OnEnable = defined @tdBattlePetScript/Rematch/Addon.lua:25
IsHooked = defined @BattlePetCompletionist/Libs/AceHook-3.0/AceHook-3.0.lua:492
OnInitialize = defined @tdBattlePetScript/Rematch/Addon.lua:14
GetClass = defined @tdBattlePetScript/Libs/tdGUI/Libs/LibClass-2.0/Class-2.0.lua:359
IsModule = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:213
_notes = "This script selector will be bound to the Rematch team."
SetDefaultModuleState = defined @DataStore/libs/AceAddon-3.0/AceAddon-3.0.lua:383
SetupUI = defined @tdBattlePetScript/Rematch/UI.lua:49
updateFrames = defined @tdBattlePetScript/

customizable can_explode condition

We have hp.can_explode to return true when the target's actual Health is lower than 40% of the source pet's MaxHealth.

Would like to see a customizable version being added, where we add a value for this Maximum Health (percent), i.E. 40 for Explode/Burst or 15 for Corpse Explosion (and whatever numbers new abilities might bring).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.