-
Notifications
You must be signed in to change notification settings - Fork 15
API
Entities like pets and abilities have different names depending on client language. When sharing scripts with other users, this is not a reliable way to identify them.
To avoid that, it is preferred to use unique numerical IDs instead. For example, instead of Bite, use 110. As that’s harder to read, there can be an optional text part separated by a colon: 110:Bite. The scripts addon first tries to match the numeric id, then the text if it didn’t work. Because of that, you can also just use any semantic text you want instead (as you shouldn’t rely on it matching anyway, client language is random). For example, you can use 110:filler or 227:stun.
Pets use locale independent identifiers. Additionally, they can be identified by their slot in the team:
- by slot:
#1,#2,#3 - by locale independent identifier: the numeric identifier is using the species id (e.g.
39:Mechanical Squirrel,121(Gurky)). - (if you insist: by locale dependent name:
Quietschklirr,Clique-Bielle,Creakclank)
Abilities use locale independent identifiers. Additionally, they can be identified by their slot in the active pet’s ability selection:
- by slot:
#1,#2,#3 - by locale independent identifier: the numeric identifier is using the ability id (e.g.
190:Cyclone,110(Bite)). - (if you insist: by locale dependent name:
Vague de magma,Magma Wave,Магматическая волна)
Uses a pet ability.
The ability must be available, i.e. on the ability bar and not on cooldown or locked out by a silence.
- Arguments: ability identifier
- Use whatever ability is chosen in the active pet’s slot 1
use(#1)
- Use bite, if the active pet has that ability.
use(110:filler)
- If the enemy does not already have the cyclone debuff, apply it (assuming it is not on cooldown).
ability(190:cyclone) [ !enemy.aura(189:cyclone debuff).exists ]
Change your currently active pet.
Does nothing if the selected pet is dead, or already your current pet.
-
Arguments:
next- pet identifier
- Cycle to whatever is the next alive pet (1 -> 2, 2 -> 3, 3 -> 1)
change(next)
- Switch to your next alive Mechanical Squirrel
change(39:squirrel)
- If your pet in slot 3 is dead, activate slot 2
change(#2) [ self(#3).dead ]
Forfeit the current battle.
- Arguments: none
- If your pet in slot 2 is dead, forfeit.
quit [ self(#2).dead ]
- Give up, if the enemy team’s last pet is still alive but your first slot pet is below 10% hp
quit [ enemy(#3).alive & self(#1).hpp < 10 ]
Pass in the current round, if you can.
- Arguments: none
- Do nothing, if decoy is currently up
standby [ self.aura(334:decoy).exists ]
Try catching the enemy pet, if you can.
- Arguments: none
- Try catching the enemy pet (if it is low enough)
catch
Prints the arguments to the main chat box (locally, verbatim) and does nothing.
There is a setting to stop script execution when a test() action is executed which might be useful for debugging. Note that because of this being an option, it is generally advised to not include test() in shared scripts unless it is the very last action anyway. Otherwise, execution is inconsistent!
- Arguments: anything
- Prints ‘Manually finish battle’
test(Manually finish battle)
- If enemy’s health% is below 50%, prints ‘below 50’
test(below 50) [ enemy.hpp < 50 ]
One of your current pets.
-
Selectors:
Name,ID,Position(defaults to current pet if not given) -
Examples:
self,ally(Chrominius),self(1152),ally(#2)
One of the enemy pets.
-
Selectors:
Name,ID,Position(defaults to current pet if not given) -
Examples:
enemy,enemy(Chrominius),enemy(1152),enemy(#2)
If an ability is usable (ie not on cooldown).
-
Return:
bool -
Examples:
self.ability(Moonfire).usable
The remaining cooldown for an ability.
-
Return:
value -
Examples:
self.ability(Moonfire).duration
If the ability is strong against the current enemy pet.
-
Return:
bool -
Examples:
self.ability(Moonfire).strong
If the ability is weak against the current enemy pet.
-
Return:
bool -
Examples:
self.ability(Moonfire).weak
The type of an ability.
-
Return:
value -
Examples:
self.ability(Moonfire).type
If an aura is currently active.
-
Return:
bool -
Examples:
self.aura(Dodge).exists
The remaining rounds of an active aura.
-
Return:
value -
Examples:
self.aura(Dodge).duration
A pets current HP.
-
Return:
value -
Examples:
self.hp
A pets current HP (for use in comparisons).
-
Return:
value -
Examples:
self.hpp
If a pet has full hp.
-
Return:
bool -
Examples:
self.hp.full
If the damage from the opponent pet self-destructing would kill the given pet.
-
Return:
bool -
Examples:
enemy.hp.can_be_exploded(will theenemypet die if theselfpet explodes?) orself.hp.can_be_exploded(will theselfpet die if theenemypet explodes?)
**Note**: You will likely always want to use use(explosion) [ enemy.hp.can_be_exploded ]. Old scripts will be using enemy.hp.can_explode which is equivalent, but should be avoided due to being harder to understand.
If the pets hp is higher than the opponents.
-
Return:
bool -
Examples:
self.hp.high
If the pets hp is lower than the opponents.
-
Return:
bool -
Examples:
self.hp.high
The current pet’s HP minus the current other pet HP.
-
Return:
value -
Examples:
self.hp.diff > 300(self has 300 more hp than enemy, e.g. self at 450 and enemy at 149 hp),enemy.hp.diff > 300(enemy has 300 more hp than own, e.g. enemy at 450 hp and self at 149 hp)
The current pet’s HP percentage minus the current other pet HP percentage.
-
Return:
value -
Examples:
self.hpp.diff > 30(self hp percentage is 30 points more hp percentage than enemy, e.g. self at 10% and enemy at 41%),enemy.hpp.diff > 30(enemy hp percentage is 30 points more hp percentage than self e.g. enemy at 10% and self at 41%)
The pets id.
-
Return:
value -
Examples:
self.id
The pets level.
-
Return:
value -
Examples:
self.level
If the pet is at max level (25).
-
Return:
value -
Examples:
self.level.max
The pets power.
-
Return:
value -
Examples:
self.power
The pets quality.
-
Return:
value -
Examples:
self.quality
The pets family.
-
Return:
value -
Examples:
self.type
The pets speed.
-
Return:
value -
Examples:
self.speed
If the pets speed is higher than the opponents.
-
Return:
bool -
Examples:
self.speed.fast
If the pets speed is lower than the opponents.
-
Return:
bool -
Examples:
self.speed.slow
If the pet is in your collection.
-
Return:
bool -
Examples:
enemy.collected,enemy(#2).collected,enemy(Chrominius).collected
The number of pets in your collection
-
Return:
value -
Examples:
enemy.collected.count,enemy(#2).collected.count,enemy(Chrominius).collected.count < 3
The maximum number of pets you could have in your collection.
Currently returns 1 if the pet is a companion, or 3 if the pet is wild.
-
Return:
value -
Examples:
self.collected.max,enemy(#2).collected.max = 3
If the pet is currently active.
-
Return:
bool -
Examples:
self.active
If the pet is currently dead.
-
Return:
bool -
Examples:
self.dead
If the pet exists in the battle.
-
Return:
bool -
Examples:
self.exists
If the pet matches a selector.
-
Return:
bool -
Selectors:
Name,ID,Position -
Examples:
self.is(Chrominius),self.is(1152),self.is(#2)
If the pet has been played.
-
Return:
bool -
Examples:
self.played
If the trap is usable (or potentially usable if enemy hp is low enough).
-
Return:
bool -
Examples:
catch [trap & enemy.hpp < 35]
If a weather effect is currently active.
-
Selectors:
Name,ID -
Return:
bool -
Examples:
weather(Moonlight:596).existsorweather(Moonlight:596)
The number of turns remaining for a weather effect.
-
Return:
value -
Examples:
weather(Moonlight).duration
The current round.
-
Return:
value -
Examples:
round
Negation.
-
Type:
Unary -
Examples:
!enemy.hp.full
Equality.
-
Type:
Binary -
Examples:
self.level = 15
Inequality.
-
Type:
Binary -
Examples:
self.level !=15
Greater than.
-
Type:
Binary -
Examples:
self.level > 15
Greater than or equal to.
-
Type:
Binary -
Examples:
self.level >=15
Less than.
-
Type:
Binary -
Examples:
self.level < 15
Less than or equal to.
-
Type:
Binary -
Examples:
self.level <=15
Contains.
-
Type:
Binary -
Examples:
weather ~ Mudslide, Scorched Earth, Blizzard
Does not contain.
-
Type:
Binary -
Examples:
weather !~ Mudslide, Scorched Earth, Blizzard
Logical AND.
-
Type:
Binary -
Examples:
weather = Mudslide & self.level = 15
Script comment.
-
Examples:
-- Hello World!
-
1- Humanoid -
2- Dragonkin -
3- Flying -
4- Undead -
5- Critter -
6- Magic -
7- Elemental -
8- Beast -
9- Aquatic -
10- Mechanical
-
1- Poor -
2- Common -
3- Uncommon -
4- Rare