PDA

View Full Version : DCC Dice d3, d5, d7, d14, d16, d24, d30



damned
March 15th, 2015, 03:09
You can roll (pretty much?) any dice and dice combo using the /die command.
In MoreCore extension we use the npc_roll.lua for several different skill/attack fields.

If I want to roll one of the DCC dice I can do it from the command line but npc_roll.lua only recognises dF, d4, d6, d8, d10, d12, d20, d%
Any suggestions I what I need to change to accept any dValues?



https://www.fg-con.com/wp-content/uploads/2015/02/fg-con-6-150-14.jpg (https://www.fg-con.com/events/)
FG Con 6 – April 17-19th 2015 - register at www.fg-con.com (https://www.fg-con.com/) for all the latest info.

damned
March 17th, 2015, 13:53
Anyone have any suggestions on this?

Valarian
March 17th, 2015, 17:01
Lots of custom die types?

damned
March 17th, 2015, 21:40
the /die command supports them.
npc_roll.lua accepts a string like;
string die,
I would like that dieto support the same options as the /die command in CoreRPG.

([d%dF%+%-]+)%s*$")
d% seems to support standard dice
dF% seems to support Fate/Fudge dice
+%- seems to support modifiers
I dont know what the last bit supports....

Im thinking there might be a substitute for d% or an alternative to it?

Trenloe
March 17th, 2015, 21:59
Have a look at evalDiceString in scripts\manager_string.lua - this evaluates dice expressions randomly without rolling the physical dice.

damned
March 18th, 2015, 01:06
Have a look at evalDiceString in scripts\manager_string.lua - this evaluates dice expressions randomly without rolling the physical dice.


Thank you Trenloe. That is interesting.

This appears to define both Fate/Fudge dice AND d(any) dice.
What I havent been able to nut out of it is what string I can use in my scripts (based on CoreRPG script npc_roll.lua) to take the non standard dice.
I also cant follow from these scripts where the standard dice are defined - or excluded from the d(any) definition?



the /die command supports them.
npc_roll.lua accepts a string like;
string die,
I would like that dieto support the same options as the /die command in CoreRPG.

([d%dF%+%-]+)%s*$")
d% seems to support standard dice
dF% seems to support Fate/Fudge dice
+%- seems to support modifiers
I dont know what the last bit supports....

Im thinking there might be a substitute for d% or an alternative to it?

Trenloe
March 18th, 2015, 01:47
What I havent been able to nut out of it is what string I can use in my scripts (based on CoreRPG script npc_roll.lua) to take the non standard dice.
evalDiceString accepts any dice at all - it uses LUA math.random to get the result, it doesn't roll any dice. The dice string has the usual format you're used to: XdY+Z - where Y is the number of sides on the dice, X is the number of these dice to roll and Y is a modifier to add to the result. It should also cater for multiple difference dice in the same dice string.


I also cant follow from these scripts where the standard dice are defined - or excluded from the d(any) definition?
The base dice are defined in gameelements.xml

Info in the "Built-in dice" section here: https://www.fantasygrounds.com/modguide/resources.xcp This also mentions defining custom dice, but these have to be based on the standard 3D dice.

As a quick kludge you could define weird dice (d16 for example) as a custom die based on another dice (whatever you wish) and in the onValue function for that custom die (see Custom dice section in the page I reference above) do math.random(16) - that is:

<customdie name="d16">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(16);
end
</script>
</customdie>

You'd, of course, have to ignore the actual dice roll as the roll has nothing to do with the end number being returned for the d16. This would be a quick way of getting the DCC dice to work in FG and it would allow all of the usual code to work without any additional code (other than the customdie definitions themselves). It would work quite well - as long as you could get over ignoring the actual dice roll for these custom dice.

EDIT: on further thought you might want to use the Fudge dice for all of the DCC custom dice - this would mean that whenever you see a Fudge dice rolling it is actually a non-polyhedral dice roll, ignore it (quite easy as there are no numbers on the faces) and look at the result in the chat window. I've modified the <customdie> code above to use a Fudge dice (dF).

Trenloe
March 18th, 2015, 01:59
Here's an example of a d16 in action in CoreRPG with MoreCore:

https://dl.dropboxusercontent.com/u/39085830/Screenshots/Fantasy%20Grounds/d16.jpg

All I did was add the code in post #7 above.

This is just doing what Valarian mentioned above - but taking it further by adding code for dice that can't be based on the 3d polyhedral dice.

These custom dice are available via right-click on the Fudge dice - via the Custom Dice selection in the NW of the radial menu, so they can be dragged to abilities/skills in the character sheet.

damned
March 18th, 2015, 02:05
Woot! Thank you Valarian and Trenloe.
Let me see if I can follow your steps.
What you have there in the chat window is perfect and I think the Fudge dice is a great compromise for the rolling dice.


https://www.fg-con.com/wp-content/uploads/2015/02/fg-con-6-150-15.jpg (https://www.fg-con.com/events/)
FG Con 6 – April 17-19th 2015 - register at www.fg-con.com (https://www.fg-con.com/) for all the latest info.

damned
March 18th, 2015, 02:25
what does <menuicon> do and is it neccesary?
I believe there is only room for one or two custom dice in the radial menu?

Trenloe
March 18th, 2015, 02:30
what does <menuicon> do and is it neccesary?
Err, menuicon defines the icon that is used on the radial menu... Say it more than once! ;)


I believe there is only room for one or two custom dice in the radial menu?
It opens up a whole new radial menu - so 8 additional options on the Fudge dice.

Put it in and have a look - stop trying to over think it! ;)

Trenloe
March 18th, 2015, 02:31
Further info: https://www.fantasygrounds.com/refdoc/customdie.xcp

damned
March 18th, 2015, 02:33
Thank you guys again.

For anyone else who is trying to do this - no changes are required to the npc_roll.lua - you just need to define the custom dice as suggested by Valarian and explained by Trenloe:

Add the following in base.xml or extension.xml

<!-- MoreCore specific Funky Dice for DCC -->
<includefile source="common/funky_dice.xml" />

Create a new file common/funky_dice.xml with the following content:


<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->

<root>
<customdie name="d3">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(3);
end
</script>
</customdie>

<customdie name="d5">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(5);
end
</script>
</customdie>

<customdie name="d7">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(7);
end
</script>
</customdie>

<customdie name="d14">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(14);
end
</script>
</customdie>

<customdie name="d16">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(16);
end
</script>
</customdie>

<customdie name="d24">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(24);
end
</script>
</customdie>

<customdie name="d30">
<model>dF</model>
<menuicon>customdice</menuicon>
<script>
function onValue(result)
return math.random(30);
end
</script>
</customdie>

</root>

leozelig
March 18th, 2015, 03:41
Oh, this is great! Now dF will have to stand for funky dice. :)

Can't wait to try this out!

damned
March 22nd, 2015, 05:11
Another Funky Dice question!

Can I add the funky dice to the Table Top? At the moment the CoreRPG table top has the following default dice:
d4, d6, d8, d10, d12, d20, dF aligned beside the Modifier box.
Is it possible to add more physical dice and set the number on them?

I need the dice on the table to take advantage of the awesome Attributes/Skills in CoreRPG for DCC. Many DCC rolls use the Funky dice. They need to be dragged into the field to work and I cant see anyway to drag something in thats not actually there to start with!
Specifiying a number to be face up on the die would be one way to identify which Funk Dice we are looking at....
If you cant nominate a number, and any number, for any dice - eg still using the Fudge dice but putting a 14 on it - does anyone else have any clever ideas how one might handle this?

I have one idea - I could incorporate some code from Psicodelix's excellent CoreRPG Improved Character Sheet extension but I think having the dice on the table might be easier for players...

https://www.fg-con.com/wp-content/uploads/2015/03/FunkyDice.jpg

Trenloe
March 22nd, 2015, 05:16
Can I add the funky dice to the Table Top? At the moment the CoreRPG table top has the following default dice:
d4, d6, d8, d10, d12, d20, dF aligned beside the Modifier box.
Is it possible to add more physical dice and set the number on them?
Short answer - no. Longer answer: maybe... with a lot of coding and messing around, but they wouldn't actually be the same as the current dice we're used to.


They need to be dragged into the field to work and I cant see anyway to drag something in thats not actually there to start with!
See the last paragraph of post #8 above.

Trenloe
March 22nd, 2015, 05:34
Actually, you might be able to get it working (sort of).

Look at the Star Wars EotE ruleset. Look in classes\desktop at the dboost.xml file - this defines a windowclass "dBoost" with a diepanel for the dBoost custom dice type. This windowclass is used in definitions\desktop.xml to position a "panel" using the <class> dBoost (defined in dboost.xml). The dBoost custom die type is defined in definitions\dice.xml - but this is similar to the custom dice defined earlier in this thread. You may need to add a specific icon definition with the same name as the custom die in order to display something on the dekstop in the panel (e.g. <icon name="d30" file="graphics/icons/d30.png" /> )

damned
March 22nd, 2015, 05:55
These custom dice are available via right-click on the Fudge dice - via the Custom Dice selection in the NW of the radial menu, so they can be dragged to abilities/skills in the character sheet.

Thank you! To drag these dice onto the Char Sheet you need to do:

Right click dFudge
At 11 oclock Left Click Custom Dice
Left Click your required Dice
Move to the target and Left Click again to drop the dice

I must have been trying Right Click options and didnt think this was possible


Actually, you might be able to get it working (sort of).

Look at the Star Wars EotE ruleset. Look in classes\desktop at the dboost.xml file - this defines a windowclass "dBoost" with a diepanel for the dBoost custom dice type. This windowclass is used in definitions\desktop.xml to position a "panel" using the <class> dBoost (defined in dboost.xml). The dBoost custom die type is defined in definitions\dice.xml - but this is similar to the custom dice defined earlier in this thread. You may need to add a specific icon definition with the same name as the custom die in order to display something on the dekstop in the panel (e.g. <icon name="d30" file="graphics/icons/d30.png" /> )

I am downloading SW now to look at this.

damned
March 22nd, 2015, 09:09
Hi Trenloe - I think your code is quite a bit more complex again - there are other files included too.
I can add them to HotKeys and then they are draggable - this is not the best solution but Im running with it just for now.

https://www.fg-con.com/wp-content/uploads/2015/03/funkyhotkeys.jpg

and I swapped the customdice icon

https://www.fg-con.com/wp-content/uploads/2015/03/customfunkydice.jpg



https://www.fg-con.com/wp-content/uploads/2015/01/fg-con-6-150-7.jpg (https://www.fg-con.com/events/)
FG Con 6 – April 17-19th 2015 - register at www.fg-con.com (https://www.fg-con.com/) for all the latest info.

Trenloe
April 19th, 2015, 05:54
Hi Trenloe - I think your code is quite a bit more complex again - there are other files included too.
I can add them to HotKeys and then they are draggable - this is not the best solution but Im running with it just for now.

https://www.fg-con.com/wp-content/uploads/2015/03/funkyhotkeys.jpg

and I swapped the customdice icon

https://www.fg-con.com/wp-content/uploads/2015/03/customfunkydice.jpg
Did you ever release this as an extension or has it been taken forwards for DCC? This has been recently asked about here: https://www.fantasygrounds.com/forums/showthread.php?23886-Question-regarding-dice

damned
April 19th, 2015, 06:06
Thanks Trenloe - I will post in the other thread.
This is a part of MoreCore and MoreCore-DCC (well and truly still a WIP).