PDA

View Full Version : [Programming] Dice names in xml?



pr6i6e6st
April 10th, 2020, 04:16
Hey guys! so I finally got a copy of the Unity version, and decided today i'd poke in at fixing the code for the Alien RPG.

I've got it working for the most part, but I notice something. First, I'm getting errors to start, which is probably leading to the next issues I have.



[4/9/2020 11:28:26 PM] [<color="red">ERROR</color>] die: Name (d3.1) must be alphanumeric value. [AlienRPGtestphase] [definitions/dice.xml]

[4/9/2020 11:28:26 PM] [<color="red">ERROR</color>] die: Name (d3.2) must be alphanumeric value. [AlienRPGtestphase] [definitions/dice.xml]


this appears at loadup for all the "die: Name"s. Obviously, I can't have "." in there anymore? This is part of the Custom Die extension, which was included within my code to bring in the new dice (dS, and dB, d60, d66, d600, d666).

Second thing, when i roll any dice, d6 or anything, no box or graphics show the die results or the dice rolled.

i imagine i just have to rename the die faces in the definitions/dice.xml but I'm not sure what that would be.

I'll include my .pak file. the new dice should show at the bottom as icons next to the d6, but can be rolled from the stats of a character sheet if the number is above 0.

thanks for any advice

damned
April 10th, 2020, 04:37
Rename the dice something like d301, d302 etc

Valarian
April 10th, 2020, 05:55
I've just had to do the same for The One Ring to get the custom dice to show up. I renamed the dice as damned suggests, replacing the "." with "r" (e.g. d6r1, d6r2, etc.). I've then had to use the Adobe Blank font to hide the actual die results, to avoid the results numbers being shown on the custom dice faces.

See:
https://www.fantasygrounds.com/forums/showthread.php?52853-lt-die-gt-name-no-longer-accepts-period
https://www.fantasygrounds.com/forums/showthread.php?51510-The-One-Ring-Core-RPG-Conversion/page7

pr6i6e6st
April 10th, 2020, 06:14
I've just had to do the same for The One Ring to get the custom dice to show up. I renamed the dice as damned suggests, replacing the "." with "r" (e.g. d6r1, d6r2, etc.). I've then had to use the Adobe Blank font to hide the actual die results, to avoid the results numbers being shown on the custom dice faces.

See:
https://www.fantasygrounds.com/forums/showthread.php?52853-lt-die-gt-name-no-longer-accepts-period
https://www.fantasygrounds.com/forums/showthread.php?51510-The-One-Ring-Core-RPG-Conversion/page7

i appear to be lacking the graphic results now. i got the errors to stop, following Damned's advice; but rolling dice just create a chat entry, nothing saying how many of what die were rolled and what the result was. My custom dice do tell me via chat how many successes or fails there are, but i can't see the result of a d6 or d60 etc. etc. even if i roll a table, i don't know what number i rolled, i just get the text from that table column.

33383

might be worth noting that i started this project back in august, so if there were important changes to the custom dice extension, i might need to have a gothrough of that

Valarian
April 10th, 2020, 12:44
Did you change the dice handlers when changing the results to the custom dice graphics?

e.g.

dicetable[n].type = dicetable[n].type .. "." .. dicetable[n].result;
to

dicetable[n].type = dicetable[n].type .. "r" .. dicetable[n].result;

The die handler code needs to be changed to replace the "." with whatever you've used instead (e.g. "r") so that when the d6 is rolled is goes to the d6r1 icon graphic instead of d6.1

pr6i6e6st
April 10th, 2020, 22:55
Did you change the dice handlers when changing the results to the custom dice graphics?

e.g.

dicetable[n].type = dicetable[n].type .. "." .. dicetable[n].result;
to

dicetable[n].type = dicetable[n].type .. "r" .. dicetable[n].result;

The die handler code needs to be changed to replace the "." with whatever you've used instead (e.g. "r") so that when the d6 is rolled is goes to the d6r1 icon graphic instead of d6.1

ah ok i figured out what you mean. awesome. that is looking a lot better. Now, i don't know if you worked it out yet or not, but i think I'm having the issue Trenloe was having. Was there a workaround? Thanks for the help btw.

33419

pr6i6e6st
April 10th, 2020, 23:38
Rename the dice something like d301, d302 etc

instead of making a whole new thread, since i mentioned it within this one, what changed about <buttonfield><frame></fame></buttonfield>? it seems that none of my buttons show frames anymore, nor do my <windowlist><frame></frame></windowlist>

edit: actually, I'm not totally sure about this. it seems a fair amount of the frames are working for the character sheets, but some buttons and the npc list are not showing frames.

damned
April 11th, 2020, 01:02
instead of making a whole new thread, since i mentioned it within this one, what changed about <buttonfield><frame></fame></buttonfield>? it seems that none of my buttons show frames anymore, nor do my <windowlist><frame></frame></windowlist>

edit: actually, I'm not totally sure about this. it seems a fair amount of the frames are working for the character sheets, but some buttons and the npc list are not showing frames.

I havent seen that - sorry.

pr6i6e6st
April 11th, 2020, 02:19
figured out the second issue. seems that the <buttoncontrol><frame></frame></buttoncontrol> format won't work anymore in unity, and it needs to look more like <buttoncontrol><frame name="fielddark" offset="0,0,0,0" /></buttoncontrol>

to clarify, this is what i had before


<buttonfield name="type">
<anchored width="90" height="30">
<top parent="columnanchor" anchor="bottom" relation="relative" offset="0" />
<left offset="97" />
</anchored>
<state text="Vehicle" />
<state text="EEV" />
<state text="Starship" />
<default>0</default>
<color>000000</color>
<frame>fielddark</frame>-----------------------<<<<here
<font>reference-r</font>
<script>
function onInit()
onValueChanged();
end
function onValueChanged()
window.update();
end
</script>
</buttonfield>


and this is what i have now and works in unity


<buttonfield name="type">
<anchored width="90" height="30">
<top parent="columnanchor" anchor="bottom" relation="relative" offset="0" />
<left offset="97" />
</anchored>
<state text="Vehicle" />
<state text="EEV" />
<state text="Starship" />
<default>0</default>
<color>000000</color>
<frame name="fielddark" offset="0,0,0,0" />-------------------<<<<here
<font>reference-r</font>
<script>
function onInit()
onValueChanged();
end
function onValueChanged()
window.update();
end
</script>
</buttonfield>