PDA

View Full Version : Dice results display.



statik37
November 28th, 2019, 02:16
Hello,

I am trying to set up a custom dice display in the chat. I have included my custom icons, and used the Mutant extension as my base to write the code. The problem I'm having is, when I roll a d6, whenever I roll a 3 or 4, I want it to show a blank dice with no number. All other rolls, I have set up custom icons.

I went ahead and installed all 6 icons, two blanks for the 3 and 4. When I roll a 1, 2, 5, and 6 roll and display the custom icons. When a 3 or 4 are rolled, it displays the icon with the standard number on it. I know that comm.deliverChatMessage(rMessage); Is taking the value from dice.result, and displaying that in the chat box on top of the icon. How do I turn that off? I tried putting an if statement in that said if 3 or 4 are rolled, dice.result = 0, but that shows a zero. when I set dice.result to either " " or nil, hoping that would do it, the result is a -1 on the dice face. What can I do to not have the image show up without the number superimposed on it?

Trenloe
November 28th, 2019, 11:41
The issue is that FG uses a font with a hard coded name - dieresult to display the number rolled on top of the die result graphic. So, to stop the number appearing, you need to use a dieresult font that has no numbers in it. The problem then, is that all rolls don't show the numbers - as you can't change the dieresult font for each die type - it's for all dice.

For the Star Wars: Edge of the Empire ruleset the dieresult font has the numbers removed and the code has all of the dice icons for the "normal" number dice used with the result embedded in the graphics. Thus, when a d20 is rolled, for example, and a 6 is returned - the d20.6 graphics is used which has the outline of the dice and the number 6 within the graphic.

It's a lot of custom work just to do this, but I believe this is the only way if you *really* want to remove the number from your custom dice. Have a look at the Star Wars: Edge of the Empire ruleset.

statik37
November 28th, 2019, 20:14
I looked at SW, and I saw what I thought was what it did. I thought it used the convertDiceToString() function, but it doesn't seem to be calling that. I can't seem to figure out how the code changes the icon from, basically d20 to d20.1 for example. Can you point me to the right place to look to find the code?

statik37
November 29th, 2019, 19:11
After doing some deep diving, I found out that I wasn't even in the correct file. I found the chat manager file, and copied over the relevant functions. The issue I have now is how do I get the dice to call the processDice function?

I copied over the special_msgtype_dice variable, and the important lines in the onInit file.

Trenloe
November 30th, 2019, 06:47
I’m confused as to which stage you’re at and what the exact issue is.

Have you migrated over a dieresult font that has no numbers in it?

Do you have the dice icons showing the correct numbers in the graphics? Have you assigned those in XML to .1, .2, .3 etc.?

What is the exact thing you’re trying to do at this point?

statik37
November 30th, 2019, 14:46
I'm sorry. It's amazing what a nights rest can do.

I figured it out. the piece I was missing was I was creating the dice handler, but I was not calling it when I threw the dice. I figured it out, and no it works perfectly.

Thank you for being the sounding board for me to get this working.

Trenloe
November 30th, 2019, 21:27
Cool. Glad you got it working. :-)