Skip to content
TheChatArchiveThe Chat Archive
gpt-4-1106-preview· openaiHugging Face Suzhen/CodeChat

I am in need of help coding in the drac2 coding language designed for the avrae discord…

  1. User

    I am in need of help coding in the drac2 coding language designed for the avrae discord bot

  2. Assistant

    The drac2 scripting language is a subset of Python with additional features to help with roleplaying and automation in Discord, specifically tailored for use with the Avrae Discord bot. It includes shortcuts for rolling dice, retrieving character stats, spell slots, managing conditions, and other D&D 5e-specific functionalities.

    Here's a quick breakdown of how you can use drac2 with Avrae in Discord. We'll go through the basics of rolling a dice, retrieving a character stat, and checking spell slots.

    Basic Dice Roll

    You can make a basic roll with:

    !r 1d20+5
    

    This will roll a 20-sided dice and add 5 to the result.

    Using drac2 for Dice Rolls with Character Stats

    If you want to include character stats in a roll, you can use drac2. For example, to roll an attack with your character's strength modifier:

    !r 1d20+{character().skills.strength.mod}
    

    Here, character() is a drac2 function that retrieves your character data, and skills.strength.mod gets the strength modifier.

    Checking Spell Slots

    To check for available spell slots, you can use:

    !svars
    

    To check a specific spell level slot:

    {{character().spellbook.get_slots(level)}}
    

    Replace level with the spell level you want to check.

    Advanced Scripting

    For more complex automation, you might write a custom alias that lets you perform a full attack action with just one command. This could use character stats, account for certain conditions (like advantage or disadvantage), and automatically decrement a spell slot or class resource if needed.

    Creating Custom Alias Example:

    !alias attack embed
    {{attack_roll = vroll("1d20+@mod")}}
    -title "{{name}} attacks!"
    -desc "Rolling to hit: {{attack_roll}}"
    -footer "Attack bonus: @mod"
    -color <color_code>
    

    Replace @mod with the attack modifier you want to use, and <color_code> with a hex color code for the embed color.

    To execute your new alias, you'd use:

    !attack
    

    Remember to keep the scripting within Discord's and Avrae's rate limits and usage guidelines.

    For more in-depth documentation, you can check the Avrae documentation and the D&D Beyond forums, where many Avrae users share their custom commands and aliases. The Avrae Discord server is also a good resource for real-time assistance and community discussion.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.