1. Requirements

Link copied
For this guide, it is necessary to install the addon
Pet Battle Scripts.
It is assumed that installation and setup are already done, and teams are set or easy to set by you.
2. How it works

Link copied
Basically, the addon selects the required ability following instructions written in the script. E.g.:
use(Уклонение:312)
use(Защита природы:574) [!self.aura(Защита природы:820).exists]
use(Альфа-удар:504)
This set of lines results in the following actions:
round 1: it casts
Уклонение
round 2: it tries to cast
Уклонение, but since it is on CD, it goes to the next line and casts
Защита природы
round 3: it tries to cast
Уклонение, but since it is on CD, it tries the next line. Since aura
Защита природы is active, it goes to the next line and casts
Альфа-удар, and so on.
To summarize: each line is read sequentially until it finds a command that can be executed. The challenge here is writing scripts able to cast the spells according to the desired strategy.
3. Script creation

Link copied
3.1 The editor

Link copied
The easiest way to write a script is when you are doing a pet battle with a team previously saved on Rematch.
After starting the fight, open Rematch, right click over the corresponding team and select “Write script”.
It will open a new window, the “Script editor”. During the battle, and while the script editor is active, it is possible to write a script using the autocomplete feature.
With the script editor opened and during a fight, start typing the desired action and it will soon show an dropdown list.
After selecting an action (type Enter or click over the action) a new list with the abilities available to the active pet will be shown.
Again, select the desired ability and, if needed, add the conditions when this action will be executed. Start by typing a bracket “[” followed by the first letter of the condition. Options are a target (self, enemy) or weather.
Anyway, a new list will be shown, it there is any.
In case there are additional required parameters, as with auras, a new list will be shown. As before, select the appropriate option.
Once you are familiar with the commands, you might just type the command followed by a dot to activate the dropdown list with the available options. Remember to close the condition with a bracket: ']'.
Writing and editing a script is not difficult itself, since the addon makes it very easy with the dropdown lists. Good luck!
3.2 Actions

Link copied
ability/
use: casts an ability
change: changes active pets
catch: catches a pet, if possible
standby: pass a round
quit: quits the fight
3.3 Conditions

Link copied
Conditions are written between brackets ([condition]):
if &
endif
3.4 Target

Link copied
self: checks a condition on your own pets
enemy: checks for a condition on your enemy’s pet
3.5 Functions

Link copied
dead (boolean)
exists (boolean)
hp (compare)
hp.can_explode (boolean)
hp.full (boolean)
hp.high (boolean)
hp.low (boolean)
hpp (compare)
aura.exists (boolean)
aura.duration (compare)
weather (boolean)
weather.duration (compare)
active (boolean)
ability.usable (boolean)
ability.duration (compare)
ability.strong (boolean)
ability.weak (boolean)
ability.type (equality)
round (boolean)
played (boolean)
speed (compare)
speed.fast (boolean)
speed.slow (boolean)
level (compare)
level.max (boolean)
power (compare)
type (equality)
quality (compare)
id (equality)
is (boolean)
4. Pratical examples

Link copied
Although the script helps a lot with its autocomplete feature, it won’t be enough to write good scripts. It is a good idea to choose a fight and play with the script editor until you feel more confident with the commands and become able to write more complex scripts. Below there will be some examples taken from pet battlers using specific strategies. It is assumed that the team is loaded, the abilities are the ones mentioned in the strategy guide, and that the recommended pet is being used, not an equivalent.
4.1 Wailing Critters

Link copied
The Wailing Critters dungeon offers a nice opportunity to start improving your skills. Until you win the last fight, the dungeon is repeatable and you might leave the dungeon, heal, and restart. There are also some random pets in the back row, but only a few families and abilities. The first 3 fights require only one pet with a fixed set of abilities, turning it into a nice place to practice your skills. The script might work for most of the fight where the same pet+abilities are being used, making it a very useful script. The link for the strategy is
here.
The strategy:
Prio 1: Keep Emerald Presence active
Prio 2: Use Emerald Dream when you drop below ~1000 health
Prio 3: Emerald Bite
use(Власть изумруда:597)
use(Изумрудный сон:598)
use(Изумрудные клыки:525)
As it is written, the script will cast
Власть изумруда every time it is available. This ability does not have a CD, so we have to add a condition that prevents it from casting if the aura is already present.
The only conditions available are the “aura(
Власть изумруда:823).exists” or “aura(
Власть изумруда:823).duration”. The condition that seems to fit the strategy better is the first one.
After writing it, we would have
use(Власть изумруда:597) [self(Emerald Proto-Whelp:68850).aura(Власть изумруда:823).exists], which could be read as “cast
Власть изумруда if my
Изумрудный протодракончик has
Власть изумруда active”.
We want the opposite of that, so deny the condition by using a “!” before the target:
use(Власть изумруда:597) [!self(Emerald Proto-Whelp:68850).aura(Власть изумруда:823).exists], translating into “cast
Власть изумруда if my
Изумрудный протодракончик does NOT have
Власть изумруда active”. Yay!
use(Власть изумруда:597) [!self(Emerald Proto-Whelp:68850).aura(Власть изумруда:823).exists]
Next step: as of now, the script will cast
Изумрудный сон on CD, which might not be required, specially at the beginning of the fight. Let’s add the condition that will cast the ability once your whelp is low on health.
use(Изумрудный сон:598) [self(Emerald Proto-Whelp:68850).hp<1000]
You might choose to heal your whelp if it is below an amount expressed in percents, and not a fixed amount:
use(Изумрудный сон:598) [self(Emerald Proto-Whelp:68850).hpp<50]
This last condition will cast
Изумрудный сон if your Whelp is below 50% health.
The final script:
use(Власть изумруда:597) [!self(Emerald Proto-Whelp:68850).aura(Власть изумруда:823).exists]
use(Изумрудный сон:598) [self(Emerald Proto-Whelp:68850).hp<1000]
use(Изумрудные клыки:525)
If your proto-whelp dies, you may change it to another equivalent pet with the same abilities, and the script will keep working. To change pets, add the following line:
change(#2) [self(#1).dead] (change to pet number 2 if my pet number 1 is dead)
Now, some remarks about the way the script is written.
- If your team has two Изумрудный протодракончик, the script might not work as expected if you change pets. To avoid problems, instead of naming it, give it the team position, or just use the “self” target. This will also allow you to use a different pet with the same skills, like the Dream Whelpling or the Маленький изумрудный дракончик
- Do not use a slot number for abilities. It might cause problems if you use an alternative pet whose abilites are on different slot positions, like the Zandalari pets where the abilites Групповая охота and Черный коготь sometimes are on a different tier.
- Use either the ability’s code number or both name and code. Some players might use a localized version of the game, and for them the script will not work if you use only the name of the abilities
- You might leave only the abilities code number, which will result in a shorter script, but it is not necessary
A suggestion for all scripts (change to the appropriate team slot):
change(#2) [self(#1).dead]
use(Власть изумруда:597) [!self.aura(Власть изумруда:823).exists]
use(Изумрудный сон:598) [self.hp<1000]
use(Изумрудные клыки:525)
4.2 Small fragments

Link copied
Scripts are written for a specific strategy, but there are many common actions that can be use in many scripts. Adjust them to your needs, checking for the right conditions, and apply them when suitable.
standby [round=1]
- Change pet to leveling and back (change slot numbers where appropriate):
change(#2) [self(#1).dead & !self(#2).played]
change(#3) [self(#2).active]
- Use a dodge ability to block an enemy’s ability (in this case, Закопаться)
use(Отклонение:490) [enemy.aura(Уход под землю:340).exists]
- Change the use of abilities depending on active enemy pet
If the enemy’s pets are the first or second, you pet will cast
Дыхание. Once the third pet enters the fight, your pet will cast
Бомбардировочный заход on CD and
Приманка if your enemy uses
Закопаться
if [enemy(#3).active]
use(Приманка:334) [enemy.aura(Уход под землю:340).exists]
use(Бомбардировочный заход:647)
endif
use(Дыхание:115)
5. Resources

Link copied
Новый комментарий: