Mezryss / FVTT-Genesys

Foundry VTT: Unoffocial implementation of the Genesys RPG
MIT License
26 stars 11 forks source link

Support /roll commands with custom rendering for Genesys rolls. #10

Open Mezryss opened 1 year ago

Mezryss commented 1 year ago

Screenshot: The same roll first with the dice roller, then with a /roll command. It'd be nice for the styling of the /roll output to match the dice roller.

This is a "nice to have", not a priority. From cursory investigation it will involve a custom Roll class, a custom ChatMessage, or both.

image

draggor commented 22 hours ago

I put this comment on the dice tray issue as well:

I have made a macro workaround to get dice rolling in the chat box. While the Roll class is a global, for some reason GenesysRoller is not, which is the magic sauce to making everything work. I plucked the compiled version from a running instance, and have this macro file to do some minimal argument parsing: https://github.com/draggor/genesys-dice-textual/blob/main/foundryvtt/macro.js

The simplest usage is /macro dice roll=2dp+1da+2di which rolls 2 proficiency dice, 1 ability, and 2 difficulty. Assuming you have your token selected, it will roll the dice as if you did it through the tray. I am currently on v11, so I don't have the foundry fix which allows for spaces in arguments, ie, description="This is some text with spaces that won't work" doesn't work, hence in the code swapping spaces to | and putting newlines into \n, then re-parsing it back before passing it on to GenesysRoller.

The genesys-dice-textual program that houses the macro file is a thing I'm making to store a library of preconfigured rolls with titles and description text, so I can easily copy one, and just paste it into the foundry chat box, still very much a WIP, but here's a sample of what I have:

bafkreie2iec4tfsf7wkicw4ohknlbcg5f4lnly2wfemckk7is3xxt5745i