-
July 25th, 2022, 05:33 #1
- Join Date
- Mar 2018
- Posts
- 31
Sorting dice results in chat output
I was able to modify the manager_actions.lua to not show the total of the dice rolled, but have been unable to figure out a way to sort the results by value. I would like to have the output message sorted low to high on the dice results, regardless of the die size. Any help?
-
July 25th, 2022, 06:18 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
You don't really want to override ActionsManager, as that is one of the very low level scripts that drives rolls in the CoreRPG layer.
If you want to turn off the dice total for specific rolls, just set "rMessage.dicedisplay = 0" on the result message passed to ActionsManager.messageResult or Comm.deliverChatMessage.
Regards,
JPG
-
July 25th, 2022, 23:27 #3
This code can help you sort the dice into order:
Code:table.sort(rRoll.aDice, function(a,b) return a.result > b.result end);
-
July 26th, 2022, 01:06 #4
- Join Date
- Mar 2018
- Posts
- 31
Think that is what I did, but just to make sure...
-- Build the basic message to deliver
local rMessage = ChatManager.createBaseMessage(rSource, rRoll.sUser);
rMessage.type = rRoll.sType;
rMessage.text = rMessage.text .. sDesc;
rMessage.dice = rRoll.aDice;
rMessage.diemodifier = rRoll.nMod;
rMessage.diceskipexpr = rRoll.diceskipexpr;
rMessage.dicedisplay = 0;
If that is not the right place to add it, please let me know. It does seem to be working correctly, though.
-
July 26th, 2022, 01:08 #5
- Join Date
- Mar 2018
- Posts
- 31
-
July 26th, 2022, 01:44 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
Yes, but by modifying the ActionsManager, you are affecting every roll in the system, including rolls that shouldn't be affected (such as table rolls). By setting that information after getting the rMessage table back from ActionsManager, you don't need to modify ActionsManager at all, and it will only affect specific rolls that shouldn't display the total.
Regards,
JPG
-
July 26th, 2022, 02:39 #7
- Join Date
- Mar 2018
- Posts
- 31
Ok. Will see how I can apply that to what I am doing. Thanks for the advice. This is for a build of Sentinel Comics RPG and I am using Ian Ward's Dice Pool extension, so those are really the only rolls that I do not need totals on.
Honestly, I am kinda sledgehammer programming, so mostly just get lucky in figuring out what I am doing...Last edited by Joram Mistwalker; July 26th, 2022 at 02:45.
-
July 26th, 2022, 03:31 #8
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
No worries; I just like to give advice to make sure people's stuff works the longest without any CoreRPG ruleset changes having an impact.
Cheers,
JPG
-
July 26th, 2022, 06:23 #9
This is not a simple post/thread but it is what you should try and get your head around -
https://www.fantasygrounds.com/forum...ns)-in-CoreRPG
-
July 27th, 2022, 02:12 #10
- Join Date
- Mar 2018
- Posts
- 31
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks