View Full Version : Slash command: secret ("blind") roll?
peterb
February 5th, 2024, 11:16
I'm trying to create a slash command that makes a secret skill roll (to begin with). The roll should only be seen by the GM. I'm using "rRoll.bSecret = true;", but it has no effect.
I'm aware of the dice tower, but I want to create a slash command because then the players can store the command in a hotkey, potentially speeding up game play quite a bit.
Any tips?
LordEntrails
February 5th, 2024, 16:35
Try "-hide" on the chat die roll. i.e.
/die 1d20 -hide
I don't know if it works. It's not documented for working on die rolls, but it does for table rolls. See https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996640083/Using+the+Chat+Window#Chat-Commands
Trenloe
February 5th, 2024, 17:07
Not knowing exactly how you're implementing this roll action, it may be hard for us to provide accurate assistance.
In theory, setting rRoll.bSecret = true in the standard FG action cycle should hide the roll from the players. But there may be additional code needed, depending on exactly how you're coding the action (dice roll).
peterb
February 5th, 2024, 19:44
Not knowing exactly how you're implementing this roll action, it may be hard for us to provide accurate assistance.
In theory, setting rRoll.bSecret = true in the standard FG action cycle should hide the roll from the players. But there may be additional code needed, depending on exactly how you're coding the action (dice roll).
I'm coding this for the Basic Roleplaying ruleset.
I could not upload the files nor post the code so I put the code on google drive: scripts\blind_skill_roll_command.lua (https://drive.google.com/file/d/1LYct0rz0a-bpEp9h-rLyhch_bqOp7lHn/view?usp=drive_link) and scripts\manager_action_blind_skill.lua (https://drive.google.com/file/d/1rnDQBYHOuUZBirzyfQJdQhVV0ElUJUVA/view?usp=drive_link)
blind_skill_roll_command.lua registers the slash command and looks up the skill value and manager_action_blind_skill.lua does the actual die roll.
Trenloe
February 5th, 2024, 21:52
Thanks for including the files, that helps to examine the issue. As you're using a custom action, with a custom onRoll script, you'll need to code for the secret flag in that onRoll function - because it's this function that displays the data in chat.
Also, as the script is running on the client, we're limited in what Comm.deliverChatMessage can do in terms of delivering to just the GM. As detailed in the Wiki here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644567/Comm#deliverChatMessage "If client, then the message will always be distributed to all connected clients (regardless of recipients parameter)."
So, the final delivery of the message has to be ran on the GM side, and this requires OOB Messaging, where the player client offloads processing to the GM instance. See the attached for an example of using OOB messaging to transfer processing to the GM instance. In this example, the presentation of the message is transferred to the GM side - you may want to transfer the processing earlier, so that the base dice roll is also initiated from the GM side and the players can't see it.
Trenloe
February 5th, 2024, 22:14
Try this one - it moves the OOB messaging to earlier in the process. Use your original manager_action_blind_skill.lua and the blind_skill_roll_command.lua from the attached ZIP file.
peterb
February 6th, 2024, 13:58
Try this one - it moves the OOB messaging to earlier in the process. Use your original manager_action_blind_skill.lua and the blind_skill_roll_command.lua from the attached ZIP file.
Thanks for the code. After cleaning up my own code and doing some testing this extension now works. It doesn't have the same output as the dice tower but that can be a later development. It's enough (for now) that the result of the dice roll is only visible to the GM. I'm going to publish this extension as a free download on the forge. It will help avoiding a lot of micro-pauses in the gameplay in my games and hopefully it will improve the FG experience for others as well.
superteddy57
February 6th, 2024, 14:05
Well CoreRPG has a built in function that might handle this whole thing if you wanted to use the dice tower.
DiceTowerManager.sendRoll(rRoll, rSource);
The rRoll structure would need to be calling ActionSkill.getRoll(rActor, rAction) to collect the rRoll and the rSource would be the same rActor fed to the ActionSkill.getRoll. So sounds like it's about 2 or 3 lines of code. This is some napkin coding from reading the exchange, so more work might be needed.
peterb
April 13th, 2025, 10:56
Re-opening this issue to try and get it to show more info on the client side.
This is my current code (scripts\manager_action_blind_skill.lua):
function onInit()
ActionsManager.registerModHandler("blindskill", modRoll);
ActionsManager.registerResultHandler("blindskill", sendRoll);
end
function sendRoll(rActor, rAction)
local rRoll = getRoll(rActor, rAction);
DiceTowerManager.sendRoll(rRoll, rActor);
Comm.deliverChatMessage()
end
function getRoll(rActor, rAction)
local rRoll = {};
rRoll.sType = "skill";
rRoll.aDice = { "d100" };
rRoll.nMod = 0;
rRoll.nTarget = rAction.totalskill or nil;
rRoll.bSecret = true;
rRoll.sDesc = "[BLIND SKILL] " .. StringManager.capitalizeAll(rAction.label) .. " check";
local sModDesc, nMod = ModifierStack.getStack(true);
if rRoll.nTarget then
rRoll.nTarget = rRoll.nTarget + nMod;
end
if (sModDesc or "") ~= "" then
rRoll.sDesc = rRoll.sDesc .. " (" .. sModDesc .. ")";
end
return rRoll;
end
When the user executes the command it looks like this on the client side:
64032
The roll itself looks like this:
64033
On the server side it looks like this:
64034
I'm a bit stumped. As you see in the code I use the Dice Towers's sendRoll and then I add a chat message that, AFAIK, would display a message to all players, but that doesn't happen. So what might I be doing wrong?
Trenloe
April 14th, 2025, 14:59
Comm.deliverChatMessage() needs the message data. See the API definition here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644567/Comm#deliverChatMessage
peterb
April 14th, 2025, 17:24
Comm.deliverChatMessage() needs the message data. See the API definition here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644567/Comm#deliverChatMessage
Ouff... Of course. Thanks for spotting that one...
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.