Thread: Auto-totals in chat window?
-
August 1st, 2007, 03:25 #1
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,833
Auto-totals in chat window?
My players and I would like to see the sum of each roll plus modifiers automatically displayed (just like when you use the 'Display Sum' option in the radial menu).
Has anyone figured out how to make this happen automatically?
Thanks,
JPG
-
August 6th, 2007, 22:44 #2
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,833
No ideas on how to access the dice widget that shows in the chat window? Or how someone might turn on dice totals for all rolls?
Thanks,
JPG
-
August 6th, 2007, 23:51 #3
Its not too bad to get the total and modify the message going out. In the chat_chat.lua file on the onDiceLandedEvent on the isType("dice") part, process the results of the roll and send your own message. Make sure you end the code block with a return true unless you want your total on a seperate line.
-
August 7th, 2007, 08:28 #4
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
I still can't read these Lua scripts like I read VBScript or JavaScript.
Can you help me with this Joshuha? A basic explanation of the entire onDiceLanded function would be highly appreciated.
-
August 7th, 2007, 16:58 #5
Well onDiceLanded is triggered whenever a dice hits the chatwindow. Ignoring the fullattack type check for now (that is a special d20 thing) the part where the magic happens so to speak is relatively small:
Code:elseif draginfo.isType("dice") then applyModifierStackToRoll(draginfo); end
So we can calculate the total pretty easily if we access the dice results which are known at the time this event is fired. So to do that after the applyModifierStackToRoll has done the work of getting the total of all the modifiers we take the dielist, loop through that, and add the numberdata.
I am not gonna write the code line by line but will provide the building blocks for you. So after the applyModiferStackToRoll function you get the dielist like so:
Code:local dice = {}; dice = draginfo.getDieList();
So over you loop you would total the results, than add the numberdata with a draginfo.getNumberData() and then build a message to display the total.
Note that if you don't return true at the end of the block you will get your message plus the normal processing of the roll. If you want it to just be your message you can return true and that prevents the default processing on the function (this works for many different event functions in FG).
If you still need further help let me know but that should be enough to set you down the right path.
-
August 8th, 2007, 02:57 #6
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,833
Thanks for the suggestion, joshuha. It's a fairly straightforward hack, though somewhat kloodgy.
After looking at the scripts and objects, it doesn't look there is a way to access the values actually rolled by the dice.
Using your method, you would essentially need to use the math.random() function for each die in the dieList, and then display your own totals in the chat window as a regular line of text.
The result would be that you wouldn't be able to access or re-use the nice dice + modifier chat entry interface already there. Also, the output would not match the die rolls.
Anybody know how to make a feature request?
Thanks,
JPG
-
August 8th, 2007, 04:45 #7
Actually it may not have been clear in my post, in the onDiceLanded event the draginfo has the dieresults already rolled, thats what the result field in a die row is for.
-
August 9th, 2007, 06:46 #8
- Join Date
- Aug 2007
- Posts
- 1
Thanks for the hints joshuha and the question moon_wizard. I am learning how to do FG rulesets myself. It was pretty simple to make it total the dice and send the total in a new message.
What I can't figure out is how to make it display the total like in "display sum" in the radial menu (i.e. in the same dice bubble). I scanned through all the XML and Lua and couldn't find any radial menu stuff anywhere to go on. Is that part of the game engine vs. the ruleset?
Thanks,
SFC
-
August 4th, 2009, 02:21 #9
- Join Date
- Jun 2009
- Posts
- 4
Originally Posted by sfcthulhu
-
August 4th, 2009, 03:21 #10
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,833
As far as I am aware, there is no option or script function to have the dice roll sums shown all the time in the chat window similar to when you select display sum when right-clicking on a roll. I would really like to know if someone has found one.
In my d20_JPG and 4E_JPG rulesets, I provide an option which totals every roll, and appends the total to the description string. Once the developers enable access to that function, I will be including in my rulesets.
Cheers,
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks