PDA

View Full Version : hi, possible request/implementation



Tianos
February 10th, 2026, 12:10
Hello staff, first of all, and I apologize for the high-sounding title, I have done several experiments:
Feature request – conditional dice result handling in CoreRPG / XCORE

Hello,

while developing a small extension for CoreRPG/XCORE, I ran into a structural limitation of the dice and chat system that I believe could be worth addressing in future implementations.

At the moment, extensions have no reliable way to react to the resolved result of a die roll (for example a standard d6). The die color and presentation are determined before the roll is resolved, and there are no exposed hooks or callbacks that allow extensions to inspect the final value and apply conditional logic or visual effects afterward.

Intended use case

The goal I was trying to achieve is fairly simple and purely visual/narrative:

Roll a standard d6

If the result is 6, display the die (the result in chat) in red

If the result is 3, display it in green

Otherwise, keep the default appearance

This kind of conditional feedback could be useful for:

narrative mechanics

lightweight success/failure indicators

custom rule systems built on top of CoreRPG/XCORE

visual clarity without altering core dice probabilities

Current limitation

Through testing, it appears that:

Dice results cannot be intercepted or modified after resolution

Slash commands and /roll behavior cannot be extended or overridden by extensions

There is no post-roll hook (e.g. onDiceResolved, onDiceResult, or similar) exposed to extension developers

Suggested improvement

Exposing one of the following would make this (and similar use cases) possible without breaking existing behavior:

A post-roll callback/hook that provides access to the final dice results

A supported way for extensions to register custom slash commands

Or a controlled way to influence die presentation (such as color or metadata) after the roll has been resolved

I believe this would significantly improve extensibility while remaining optional and backward-compatible.

Thank you for your time and for your continued work on the system.

Best regards, Tianos

bayne7400
February 10th, 2026, 14:03
You will need to setup your own rollers. You can even setup your own desktop dice to use that roller. Because there are so many ways for developers to do a custom roll I doubt SW would reconfigure the native roller. I built a desktop D6 roller for D6 Star Wars thats has a wild die so it can be done. From the user perspective they can't really tell the difference except for the graphic I used.

Did you try Comm.registerSlashHandler ? It really doesn't make sense that this is unusable by and extension.
https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644567/Comm

Mike Serfass
February 10th, 2026, 14:11
The Savage Worlds ruleset does all these things. You can look in that code for how it's done.
You want to use the ChatManager register function and OOBManager.registerOOBMsgHandler in CoreRPG.
I think implementation isn't in CoreRPG because rulesets handle die results very differently.

bayne7400
February 10th, 2026, 14:32
You want to use the ChatManager register function and OOBManager.registerOOBMsgHandler in CoreRPG.
.

Wasn't Chatmanager removed and now you use comm ? See my post above

Mike Serfass
February 10th, 2026, 16:53
ChatManager wasn't removed. The registerSlashHandler and unregisterSlashHandler functions were removed from ChatManager and replaced with calls to the Comm functions.
Moon Wizard will correct us if necessary.

superteddy57
February 10th, 2026, 17:19
All of this can be performed using the current ActionsManager system. Example of this is in many rulesets, but a good simple example would be the initiative manager in 5e. Those registrations are what I use almost 90% of the time when building a ruleset. We have made strides to include more connector points to allow normal ruleset operation, but also allow extensions safely inject their changes.

The example you gave would be best as a custom die that uses a result handler to give you what you want. Since it's a whole new type roll you are introducing. Bayne was correct with their recommendations and an extension can create it's own slash commands as well. If you have more direct coding questions you can continue here or visit our discord and ask in the coding_help channel.

Tianos
February 10th, 2026, 18:33
Here's the proper translation to English:

"Meanwhile, thank you everyone. I checked Savage Worlds, but aside from showing me a die of a certain color in chat, I haven't noticed any changes with different results (except them becoming opaque). I'm reporting below the latest code I tried to implement as an extension but without any results. This is because (from what I understand) it cannot change the color once the result is obtained."

Analysis of the problem AI:
You've identified the core issue correctly! The extension runs and can show colored dice, but it cannot retroactively change the color of dice results that have already been rolled and displayed. In Fantasy Grounds, once a die result is processed and shown in chat, it becomes "baked in" and cannot be modified by extensions.

<?xml version="1.0" encoding="utf-8"?>
<root>
<name>Color D6 Results</name>
<author>Custom</author>
<ruleset>XCORE</ruleset>
<base>CoreRPG</base>

<description>
Colors D6 dice results:
3 = green
6 = red
</description>

<scripts>
<script file="scripts/colord6.lua" />
</scripts>
</root>

Script

-- Hook into ChatManager to intercept /roll commands

local oldProcessDice = ChatManager.processDice

function ChatManager.processDice(sCommand)
-- Only intercept plain d6 rolls
if sCommand == "/roll d6" then
local r = math.random(1,6)
if r == 6 then
return oldProcessDice("/roll r6")
elseif r == 3 then
return oldProcessDice("/roll g6")
end
end

return oldProcessDice(sCommand)
end