Speaking the Language of Dragons
Development HighlightSo recently I’ve been playing a lot of Dungeons and Dragons on Discord, using D&D Beyond. Now ever since I first started coding I’ve always been looking for tools and methods in order to incorporate and make D&D easier and therefore, more fun to play with. Now a good bot that a lot of people use is Avrae, it does a lot of things like displaying rolls from D&D Beyond straight into the channel on discord. Despite using it since forever, it hasn’t been until recently that I realized it also has its own commands to roll dice, make saves and checks, and even run combat. Even with my newest group I am finding out Avrae even has commands to incorporate maps positioning and does a decent job in keeping track of any effects that are affecting all the combatants.
Now that’s not the biggest thing about it, it’s just what most poeple do with a bit of practice, but if you look through the docs, you start getting into aliesing and snippets. These are more technical aspects of Avrae that allow you to autimate or code features with the language Draconic, which is based in Python. There’s a lot of really talented people in the Avrae Development server that create extra aliases to help support classes or homebrew to allow them to work on Discord. I’ve been messing around with it in order to flavor some of my Paladin’s features. For example I don’t really like the way you are expected to use Lay on Hands, as it treats it like an attack, and it get’s really long. You also have to remember to add -rr in order to call it multiple times as each call lowers it’s use by 1 which makes the resulting embed really long and ugly to look at in my opinion. So I created a !pet command that allows me to show how much healing I did rather than just heal by 1, 5 times. It’s a lot more complicated than that tbh, as it is like coding, you have to consider possible scenarios where the user might try to heal when they don’t have anymore.
Another alias I created was a Fighting Style Protection which allows a character to impose disadvantage on an attack that targets an ally as long as you remain within 5 ft. Now there is no native Protection command because frankly, it would be hard to implement with the way the combat system works. As if an attack hits it will automatically apply damage and change the health of the target. My only solution to this was to roll another d20 to simulate disadvantage until I find a way to pass the information from the battle rolls into this command.
That’s not to say though, that I am an expert in all of this yet, Draconic is a really fun language to learn and it can get very complicated. I’m sure though with more practice I can create really complex, really wonderful things maybe even changing fate itself when I upgrade my protection alias. You’ll definetly be hearing more about this in the future.
Anyway Here is the code to my command, might not be too complex but I’m proud that it works.
!alias pet embed
<drac2>
#Define Variables
cc = "Lay On Hands: Healing Pool"
desc = "Your blessed touch can heal wounds! so pet all your friends!"
rest = "You're out of heals, you need to have a Long Rest before you can pet again."
noCC = "You do not have this ability"
target = str("&1&")
healing = int("&2&")
ch=character()
#Logic
succ = "tries to pet"
if ch.cc_exists(cc) and ch.get_cc(cc):
succ = "pets"
D = desc
ch.mod_cc(cc, - healing)
elif ch.cc_exists(cc):
D = rest
healing = 0
else:
D = noCC
#Prepare the output
T = f"{name} {succ} {target}!"
F = f"{cc}|{ch.cc_str(cc) if ch.cc_exists(cc) else '*None*'}"
</drac2>
-title "{{T}}"
-desc "{{D}}"
-f "{{F}}"
-f "Healing Done|{{healing}} [heal damage]"
-color <color>
-thumb <image>
Discover more from Lad's CS Blog
Subscribe to get the latest posts sent to your email.