are you familiar with the drac2 coding language?
- User
are you familiar with the drac2 coding language?
- Assistant
The DRAC2 coding language refers to a scripting language designed for the Avrae Discord bot, which integrates with the Dungeons & Dragons 5th Edition (D&D 5e) system. Avrae is commonly used by D&D players to manage characters, roll dice, and automate game mechanics within the Discord environment.
DRAC2, also known as "Dragon", isn't a fully-fledged programming language but rather a scripting toolset within Avrae that allows users to define custom commands and automation scripts. With DRAC2, players can set up macros for complex dice rolls, character actions, and game-related calculations. This helps streamline gameplay and keeps the focus on the storytelling aspects of D&D.
Because DRAC2 is domain-specific and tailored to Avrae, its use is niche compared to mainstream programming languages. It includes functionality for variables, mathematical operations, conditionals, and loop constructs within the context of Avrae's command parser and D&D mechanics.
Please note that technical details and usage patterns of the DRAC2 language might evolve over time, and the best resources for learning its syntax and commands would be the official documentation provided by Avrae developers or user communities focused on Dungeons & Dragons tools and gaming bots.
- User
can you print out the embed code needed to display a character sheet?
- Assistant
As an AI developed by OpenAI, I'm not able to directly interact with external systems like Discord or the Avrae bot, and I cannot execute or display specific user configurations or data. However, I can help guide you on writing a DRAC2 script that could potentially generate an embed to display character sheet information. Please keep in mind that the specific fields and the structure of your character sheet may vary, so you'll have to adjust the script to fit your needs.
- User
This code did not display the character sheet, it returned an embed that displayed my characters name but nothing else
- Assistant
I apologize for the inconvenience. The DRAC2 scripting language and Avrae bot commands can be complex, and getting the correct fields requires knowing the exact syntax and property names used by your character sheet and the Avrae bot.
Here is a revised example that assumes your character's stats are accessible through Avrae's character object properties. Please note that the actual code might still need tweaking based on your character's specifics and the Avrae bot's current syntax:
!embed -title "{{character().name}}'s Character Sheet" -fields "{{ '\n'.join(name + ': ' + str(value) for name, value in character().skills.items()) }}" -color 0x7289DA -footer "Character Sheet" - User
that code returned this error
Traceback (most recent call last): Line 1, col 1 ‘\n’.join(name + ': ’ + str(value) for name, value in character().skills.items())
DraconicSyntaxError: invalid character '‘' (U+2018)
- Assistant
It looks like the error you encountered is due to using typographic (smart) quotes rather than regular straight quotes in your code. Smart quotes (
‘’and“”) are not recognized by programming languages, including the DRAC2 scripting language, and will cause a syntax error. Instead, you should always use straight quotes ('and") for strings in code.Here's the revised command with correct straight quotes:
!embed -title "{{character().name}}'s Character Sheet" -fields "{{ '\n'.join(f'{name}: {value}' for name, value in character().skills.items()) }}" -color 0x7289DA -footer "Character Sheet"If
character().skills.items()is not the correct way to access the skills, you'd need to consult the Avrae documentation for how to access your character's skill values. Ifskillsis indeed the way to access them and they are contained in a dictionary-like object, then the syntax used above should be more appropriate. - User
That code returned this error
Traceback (most recent call last): Line 1, col 1 ‘\n’.join(f’{name}: {value}’ for name, value in character().skills.items())
DraconicSyntaxError: invalid character '‘' (U+2018) This is an issue in a user-created command; do not report this on the official bug tracker. Error evaluating expression: invalid character '‘' (U+2018)``` - Assistant
I apologize again; there was still an issue with the smart quotes. Here's the corrected version with the appropriate straight quotes:
!embed -title "{{character().name}}'s Character Sheet" -desc "Basic info and stats" -color 0xFF5733 -field "Name|{{character().name}}|yes" -field "Strength|{{character().stats.str}}|yes" -field "Dexterity|{{character().stats.dex}}|yes" -field "Constitution|{{character().stats.con}}|yes" -field "Intelligence|{{character().stats.int}}|yes" -field "Wisdom|{{character().stats.wis}}|yes" -field "Charisma|{{character().stats.cha}}|yes"In this corrected version, I've also updated the fields with likely variable paths for the character's attributes:
character().namefor the character name.character().stats.str,.dex,.con,.int,.wis,.chafor the character's stats.
Make sure to replace
0xFF5733with your desired embed color.If this structure still doesn't work, it may be due to changes in the Avrae bot's implementation or how it expects commands to be formatted. I recommend consulting the bot's most recent documentation, asking the community for support, or using the bot's feature to get the latest working commands for character sheet embeds.
- User
that code returned this error
Traceback (most recent call last): Line 1, col 0 character().stats.str ^^^^^^^^^^^^^^^^^^^^^ NotDefined: 'AliasBaseStats' object has no attribute str This is an issue in a user-created command; do not report this on the official bug tracker. Error evaluating expression: 'AliasBaseStats' object has no attribute str
- Assistant
I apologize for the confusion earlier. It seems that accessing the specific attributes of the character in Avrae isn't done through
character().stats.attribute. Based on your error message, we need to adjust the command to refer to the proper attributes correctly.The Avrae bot accesses attribute scores from a character stat block with a different naming convention. Let's try using a more likely syntax for accessing the character's attributes based on the latest known Avrae scripting conventions:
!embed -title "{{character().name}}'s Character Sheet" -color 0xFF5733 -field "Name|{{character().name}}|yes" -field "Strength|{{character().abilities.str.score}}|yes" -field "Dexterity|{{character().abilities.dex.score}}|yes" -field "Constitution|{{character().abilities.con.score}}|yes" -field "Intelligence|{{character().abilities.int.score}}|yes" -field "Wisdom|{{character().abilities.wis.score}}|yes" -field "Charisma|{{character().abilities.cha.score}}|yes" - User
- Assistant
Thank you for providing additional context. Based on the documentation you provided, the
AliasBaseStatsclass allows us to access the six base ability scores using properties or methods.Here is an updated command incorporating this information, using the
get()method to retrieve stats:!embed -title "{{character().name}}'s Character Sheet" -color 0xFF5733 -field "Name|{{character().name}}|yes" -field "Strength|{{character().stats.get('strength')}}|yes" -field "Dexterity|{{character().stats.get('dexterity')}}|yes" -field "Constitution|{{character().stats.get('constitution')}}|yes" -field "Intelligence|{{character().stats.get('intelligence')}}|yes" -field "Wisdom|{{character().stats.get('wisdom')}}|yes" -field "Charisma|{{character().stats.get('charisma')}}|yes"This command uses the
get(stat)method as described in the documentation to access the base ability score of each stat. It should display the character's ability scores in the embed fields. Make sure to replace with the hexadecimal color code of your choice for the embed. - User
that returned this error
Traceback (most recent call last): Line 1, col 23 character().stats.get(‘strength’)
DraconicSyntaxError: invalid character '‘' (U+2018) This is an issue in a user-created command; do not report this on the official bug tracker. Error evaluating expression: invalid character '‘' (U+2018)
- Assistant
My apologies for the oversight. The error message indicates that invalid characters (smart quotes) were used again. Let's correct this by using regular straight quotes:
!embed -title "{{character().name}}'s Character Sheet" -color 0xFF5733 -field "Name|{{character().name}}|yes" -field "Strength|{{character().stats.get('strength')}}|yes" -field "Dexterity|{{character().stats.get('dexterity')}}|yes" -field "Constitution|{{character().stats.get('constitution')}}|yes" -field "Intelligence|{{character().stats.get('intelligence')}}|yes" -field "Wisdom|{{character().stats.get('wisdom')}}|yes" -field "Charisma|{{character().stats.get('charisma')}}|yes"This time I made sure to use the correct straight single quotes
'. Replace0xFF5733with the color you wish to use for the embed. This command should work if thecharacter().stats.get('stat')method is correct according to the Avrae documentation.Remember to double-check that the way you are accessing the stats matches the current capabilities of Avrae, as bot implementations can change over time. If you're still encountering difficulties, it's recommended to consult the most recent Avrae documentation or ask for advice from the Discord community that uses Avrae.
- User
You keep using the wrong quote's, the corrrect quote for both open and closing is the singular "'"
!tembed -title “{{character().name}}s Character Sheet” -color 0xFF5733 -field “Name|{{character().name}}|yes” -field “Strength|{{character().stats.get('strength')}}|yes” -field “Dexterity|{{character().stats.get('dexterity')}}|yes” -field “Constitution|{{character().stats.get('constitution')}}|yes” -field “Intelligence|{{character().stats.get('intelligence')}}|yes” -field “Wisdom|{{character().stats.get('wisdom')}}|yes” -field “Charisma|{{character().stats.get('charisma')}}|yes”
here is the fixed code that uses the correct quotation.
However, each field is not displayed out in the embed, any idea why they're not reading out?
- Assistant
My apologies for the confusion with the quotes. I'm glad it's been corrected. As for why the fields are not displaying as expected, it could be due to a few reasons:
- Parsing issues with the
!tembedcommand. - Incorrect field syntax or incorrect method calls.
- Character data not being what you expect or the
character()function not returning data as expected.
The syntax for the fields in the
!tembedshould be correct according to what you've written and the provided documentation snippet. Assuming that correctly retrieves the ability scores, the fields should populate. - Parsing issues with the