PDA

View Full Version : how to determine client who "manually" rolls (5E)?



jkeller
December 1st, 2025, 05:16
Hi. I'm developing a 5E extension, and I'm having trouble figuring out who the roller is when dice are "manually" rolled.

I've added handlers for lots of different types of rolls, and most work fine.

ActionsManager.registerPostRollHandler("dice", postRoll);

But for some reason, when the "dice" handler is called (when a player uses the dice at the bottom of the screen as opposed to clicking on a button to roll), the rSource parameter is nil (although the dice parameter is valid). I assume this is because the source (e.g. character) is unknown, since a player may be using 0 or multiple characters.

Is there any way for me to programmatically determine which client rolled? ... and maybe from there get the character(s) that client is controlling?

(The handler is called on the client.)

Thanks!

superteddy57
December 1st, 2025, 07:10
Manual rolls are handled through the ManualRollManager. Specifically the addRoll function. I would check out that process as the rSource is passed and sets the source of the manual roll entry when it is performed.
65897

Trenloe
December 1st, 2025, 14:43
(The handler is called on the client.)
If the handler is called on the client (player side) then you could maybe use User.getCurrentIdentity to get the currently active PC if rSource is nil? This still wouldn't work if the player hadn't selected any PCs for the session, but it's probably the best you're going to get.

https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644683/User#getCurrentIdentity