-
April 12th, 2020, 01:38 #1
[Programming] Custom Dice and Dice Tower
Hey guys. I think i found where I can get my custom dice working with the dice tower, but I'm having a time getting the results to work. what am I missing this time?
examples.png
Code:function onDrop(draginfo) if control then if OptionsManager.isOption("TBOX", "on") then local sDragType = draginfo.getType(); if GameSystem.actions[sDragType] then local rSource = ActionsManager.actionDropHelper(draginfo, false); for i = 1, draginfo.getSlotCount() do local msgOOB = encodeOOBFromDrag(draginfo, i, rSource); Comm.deliverOOBMessage(msgOOB, ""); if not User.isHost() then local msg = {font = "chatfont", icon = "dicetower_icon", text = ""}; if rSource then msg.sender = ActorManager.getDisplayName(rSource); end if msgOOB.sDesc ~= "" then msg.text = dSCustomResultWedge.dSCustomResult().desc .. " "; end msg.text = msg.text .. "[" .. msgOOB.sDice .. "]"; Comm.addChatMessage(msg); end end elseif sDragType == "string" then ChatManager.processWhisperHelper("GM", draginfo.getStringData()); end end end return true; end
Code:function handleDiceTower(msgOOB) msgOOB.type = nil; local rActor = nil; if msgOOB.sender and msgOOB.sender ~= "" then rActor = ActorManager.getActor(nil, msgOOB.sender); end msgOOB.sender = nil; msgOOB.sDesc = "[" .. Interface.getString("dicetower_tag") .. "] " .. (msgOOB.sDesc or "") .. " [" .. msgOOB.sDice .. "]"; msgOOB.aDice, msgOOB.nMod = StringManager.convertStringToDice(msgOOB.sDice); msgOOB.sDice = nil; msgOOB.bSecret = true; msgOOB.bTower = true; ActionsManager.roll(rActor, nil, msgOOB); end
Last edited by pr6i6e6st; April 13th, 2020 at 02:06.
-
April 13th, 2020, 04:51 #2
Ok i think i found my issue, but not certain how to solve it. the msgOOB.aDice in the second part for handleDiceTower() is coming up blank for my dS or dB. it works fine for the other custom die. so I am inclined to believe the issue lies somewhere in the StringManager.convertStringToDice() function. it is not properly recognizing and converting my stress(dS) nor my base(dB) dice.
is there a workaround to this?
edit: weird thing is, Chat commands on the Unity version will roll the dS and dB for me, which must mean that a convertStringToDice function is working somewhere, just not for the dice tower, and not it classic. i wonder what the difference is. . .Last edited by pr6i6e6st; April 13th, 2020 at 05:10.
-
April 13th, 2020, 06:18 #3
I think all dice must be numerically names after the d (or r or p or g).
eg dS is not a valid dice name (afaik)
-
April 13th, 2020, 06:26 #4
Definitely not arguing this, but I’m curious why then, on unity version, typing /die (or /roll) 3dS+4dB will roll 3 stress dice and 4 base dice on my AlienRPG ruleset. Because that would mean it DOES work somewhere in the code.
I would imagine that all breaks down from the “convertStringToDice” function or something at some point but I haven’t wrapped my head around that function yet. So something is getting worked out in beta it seems, since this doesn’t work on classic. Perhaps that will migrate over at some point?
edit: it appears the die show up as a ruleset die within the interface, so perhaps by dScustomDiceWedge script is getting bypassed somewhere?
Code:[4/13/2020 3:59:24 AM] s'interface.getDie = ' | { #1 = s'dBr5', #2 = s'd6', #3 = s'dBr4', #4 = s'dBr3', #5 = s'dBr1', #6 = s'dB', #7 = s'dBr6', #8 = s'dBr2', #9 = s'd01', #10 = s'd3', #11 = s'dS', #12 = s'rF', #13 = s'r4', #14 = s'r6', #15 = s'r8', #16 = s'r10', #17 = s'r12', #18 = s'r20', #19 = s'r100', #20 = s'r3', #21 = s'r2', #22 = s'gF', #23 = s'g4', #24 = s'g6', #25 = s'g8', #26 = s'g10', #27 = s'g12', #28 = s'g20', #29 = s'g100', #30 = s'g3', #31 = s'g2', #32 = s'bF', #33 = s'b4', #34 = s'b6', #35 = s'b8', #36 = s'b10', #37 = s'b12', #38 = s'b20', #39 = s'b100', #40 = s'b3', #41 = s'b2', #42 = s'pF', #43 = s'p4', #44 = s'p6', #45 = s'p8', #46 = s'p10', #47 = s'p12', #48 = s'p20', #49 = s'p100', #50 = s'p3', #51 = s'p2', #52 = s'dSr1', #53 = s'dSr2', #54 = s'dSr3', #55 = s'dSr4', #56 = s'dSr5', #57 = s'dSr6', #58 = s'd3r1', #59 = s'd3r2', #60 = s'd3r3', #61 = s'd60', #62 = s'd60r10', #63 = s'd60r20', #64 = s'd60r30', #65 = s'd60r40', #66 = s'd60r50', #67 = s'd60r60', #68 = s'd600', #69 = s'd600r100', #70 = s'd600r200', #71 = s'd600r300', #72 = s'd600r400', #73 = s'd600r500', #74 = s'd600r600', #75 = s'd6r1', #76 = s'd6r2', #77 = s'd6r3', #78 = s'd6r4', #79 = s'd6r5', #80 = s'd6r6' }
Code:<!-- Define the custom Base die --> <customdie name="dB"> <icon>dBicon</icon> <model>d6</model> <menuicon>dBicon</menuicon> <script> function onValue(result) local modresult = 0; if result == 1 or result == 2 or result == 3 or result == 4 or result == 5 or result == 6 then modresult = result; end return modresult; end </script> </customdie> <!-- The way the custom dice base extension maps the icons for each possible result, is done by defining a die for each possible result from the onValue() function defined above. Each die then gets mapped to an Icon resource. In this example we therefore need 6 definitions --> <die name="dBr1"><icon>dBicon1</icon></die> <die name="dBr2"><icon>dBicon2</icon></die> <die name="dBr3"><icon>dBicon3</icon></die> <die name="dBr4"><icon>dBicon4</icon></die> <die name="dBr5"><icon>dBicon5</icon></die> <die name="dBr6"><icon>dBiconN</icon></die> <!-- Define the various icons and what PNG files should be loaded for them. In this case I've re-used the graphic for the generic dBicon, in case the new custom die needs to be rendered before being rolled. --> <icon name="dBicon" file="graphics/icons/dB.N.png" /> <icon name="dBicon1" file="graphics/icons/dB.1.png" /> <icon name="dBicon2" file="graphics/icons/dB.2.png" /> <icon name="dBicon3" file="graphics/icons/dB.3.png" /> <icon name="dBicon4" file="graphics/icons/dB.4.png" /> <icon name="dBicon5" file="graphics/icons/dB.5.png" /> <icon name="dBiconN" file="graphics/icons/dB.N.png" /> <!-- Define the custom Stress die --> <customdie name="dS"> <icon>dSicon</icon> <model>d6</model> <menuicon>dSicon</menuicon> <script> function onValue(result) if result == 1 or result == 2 or result == 3 or result == 4 or result == 5 or result == 6 then modresult = result; end return modresult; end </script> </customdie> <!-- The way the custom dice base extension maps the icons for each possible result, is done by defining a die for each possible result from the onValue() function defined above. Each die then gets mapped to an Icon resource. In this example we therefore need 4 definitions --> <die name="dSr1"><icon>dSicon1</icon></die> <die name="dSr2"><icon>dSicon2</icon></die> <die name="dSr3"><icon>dSicon3</icon></die> <die name="dSr4"><icon>dSicon4</icon></die> <die name="dSr5"><icon>dSicon5</icon></die> <die name="dSr6"><icon>dSiconN</icon></die> <!-- Define the various icons and what PNG files should be loaded for them. In this case I've re-used the graphic for the generic dSicon, in case the new custom die needs to be rendered before being rolled. --> <icon name="dSicon" file="graphics/icons/dS.1.png" /> <icon name="dSicon1" file="graphics/icons/dS.1.png" /> <icon name="dSicon2" file="graphics/icons/d6.2.png" /> <icon name="dSicon3" file="graphics/icons/d6.3.png" /> <icon name="dSicon4" file="graphics/icons/d6.4.png" /> <icon name="dSicon5" file="graphics/icons/d6.5.png" /> <icon name="dSiconN" file="graphics/icons/dS.N.png" /> <!-- Load the script that handles the special "Effect" side of the dS dice. Not all custom dice types will require such a script. --> <script name="dSCustomResultWedge" file="scripts/ds_custom_result_wedge.lua"/>
Last edited by pr6i6e6st; April 13th, 2020 at 08:07.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks