Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get dice chat data #115

Closed
jacobwojoski opened this issue Mar 5, 2023 · 10 comments
Closed

How to get dice chat data #115

jacobwojoski opened this issue Mar 5, 2023 · 10 comments

Comments

@jacobwojoski
Copy link

jacobwojoski commented Mar 5, 2023

I was asked to add support of my mod dice-stats and was wondering how you post the chat msg's?

It seems like they're not posted as roll data objects like most systems.
I can't seem to even view the roll data anywhere in the msg object. The rolls arrays are empty (Chatmessage.rolls)
(View image at bottom)

All I can see is the raw html of the msg.context property.

I was wondering if there was any other way to get the data besides parsing the context as getting the die-type and value would be very difficult

Is there a hook or something that I dont know about that could be used?

image

@juanferrer
Copy link
Contributor

juanferrer commented Mar 26, 2023

The code currently does not pass the roll data to the chatMessage. I don't think there is a specific reason why that is the case, but I will find out if we can support it. Would you expect a Roll to be in the chatMessage.rolls array? Something like this:
image

@jacobwojoski
Copy link
Author

jacobwojoski commented Mar 26, 2023

Normally if you roll you would get a chat msg that has info like this (This was retrieved by rolling /r 20d20 in chat in shadow of the demon lord)
image

If I was to roll strength in your system is doesn't set msg type to a roll (msg.isRoll returns false unlike if you do a /r 1d20 normally msg.isRoll returns true)

Looks like when you roll something is just makes an HTML section in the ChatMsg.content area rather then populating the msg.rolls[] like most systems do.

Not a system developer so wish I could be more help as to why. Its nbd Was just asked to add the mod and found this issue when looking into it. Its possible for me to get it working by doing some text parsing in the chatMsg.content area but much harder as if you were to ever change the HTML it would break it.

@juanferrer
Copy link
Contributor

No, I agree that it should be populating those fields. I'll put the necessary changes in a PR and update when it's merged.

To confirm:

  1. Set type to "roll"
  2. Add Roll to chatMessage.rolls

@doctorthoss
Copy link

The code currently does not pass the roll data to the chatMessage. I don't think there is a specific reason why that is the case, but I will find out if we can support it. Would you expect a Roll to be in the chatMessage.rolls array? Something like this: image

could this have something to do with the compatibility issues with Dice so Nice? (https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/issues/367)

@jacobwojoski
Copy link
Author

Dice Stats works with Dice So Nice on both PF2e and D&D but this most certainly can be be related to why dice so nice isn't working correctly with the system.

@doctorthoss
Copy link

doctorthoss commented Mar 30, 2023

The code currently does not pass the roll data to the chatMessage. I don't think there is a specific reason why that is the case, but I will find out if we can support it. Would you expect a Roll to be in the chatMessage.rolls array? Something like this: image

If this is something the system could be modified to support it would probably fix multiple compatibility issues, I think there a few other modules that don't work wright with SotDL because of this. Not sure if this is helpful but I opened a separate issue for this here: #118

@juanferrer
Copy link
Contributor

@jacobwojoski I just tested with v2.2.5 and was able to retrieve rolls from attributes and weapons. If you are able to confirm this is fixed, we can close the issue.

@doctorthoss
Copy link

@juanferrer unfortunately this didn't fix the issue with Dice so Nice where you can only see other player's rolls if they use the roll table (i.e. you don't see them if they do a challenge roll, weapon attack, etc). Was hoping that was related but I guess it's some other weird thing

@juanferrer
Copy link
Contributor

Ah, yeah. I didn't test DSN, only DiceStats. We'll have to investigate.

@doctorthoss
Copy link

Ah, yeah. I didn't test DSN, only DiceStats. We'll have to investigate.

I made a post for it on the DSN gitlab but haven't heard anything over there yet
https://gitlab.com/riccisi/foundryvtt-dice-so-nice/-/issues/367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants