Thread: Buttongroup_counter
-
November 8th, 2019, 01:39 #11
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
Ok, one more follow up question.
if ModifierStack.getModifierKey("things") then
-
November 8th, 2019, 01:46 #12
Just like with any FG control - you can access the value through the GUI, or the database (if the control stores its value in the database).
For GUI controls: https://www.fantasygrounds.com/refdo...l.xcp#getValue
For database: https://www.fantasygrounds.com/refdoc/DB.xcp#getValue or https://www.fantasygrounds.com/refdo...e.xcp#getValuePrivate Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
November 8th, 2019, 01:46 #13
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
Nope, it's just a single boolean state.
There are a few key questions I think you need to answer before we go any farther:
* Please explain the general concept of what you're trying to do. It will help us answer. Don't worry about the details/APIs/templates, just the high-level concept.
* Does this control show up on GM side?
* Does this control show up on player side?
* If it shows up on both GM and player, does this control show up exactly the same on both GM and player, or different on each?
* If it shows up on both GM and player, can all users (GM and players) edit, or only the GM?
Thanks,
JPG
-
November 8th, 2019, 12:29 #14
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
OK, It does show up to both player and GM. It is controllable by both player and GM, and it is different to both player and GM.
The basic concept is: I want the pips to represent how many dice can be rolled from 1 to 5. So, when I initiate a roll, I want it to go to the desktop and see how many pips are lit up, and take that number and add it to the roll.
I figured the way I would do it, is once I create the rRoll table, I could then pass it to a function that would then add a new table entry for how many pips are lit up, and pass rRoll back with the new entry added. The issue I am having is I can't figure out how to get it to work. I assume it's very much like the modifier number, where the system will grab the number and add it to rRoll.nMod, but that's the point I am having trouble with.
-
November 8th, 2019, 12:50 #15
See this thread: https://www.fantasygrounds.com/forum...(dice-rolling) It breaks the whole action process down and gives example of a custom action. Where an "action" in FG is rolling dice for a specific game mechanic.
In step 3, where the custom modifiers are applied, you can add/remove dice from the LUA rRoll.aDice table as required, based off the number of pips. So I suggest you start the action with 1 dice in rRoll.aDice and then add additional dice for each pip above 1 in the step 3 modifier handler (function modRoll in most FG action scripts).Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!
-
November 9th, 2019, 02:30 #16
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
That was very helpful, but maybe I'm just not getting it.
Do, I went and looked again at modifierstack.lua Through experienting, I learned I can retrieve the number save there by calling ModifierStack.getSum().
Which is:
function getSum()
local total = freeadjustment;
Debug.chat(total)
for i = 1, #slots do
total = total + slots[i].number;
end
return total;
end
It looks like freeadjustment is a global variable. So, I set up a global variable, and whenever the pips are changed, it changes with them, however, for some reason, that variable is not carrying through out of that function. How is it that the modifiierstack variable is carrying over? what am I missing?
-
November 9th, 2019, 04:38 #17
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
The ModifierStack script is implemented simply to add a fixed numerical value; not modify the number of dice rolled in any way.
As I mentioned previously, you should go back to the 5E roll handlers, and make sure that the modifiers are applied to any roll that you want them applied to in your system. You can also apply the modifiers to the general purpose die roll type ("dice"). Please see scripts/manager_action_general.lua in the 5E ruleset. Pay extra attention to the ActionsManager2.encodeDesktopMods(rRoll) call, which you can change in your own ruleset to modify the roll however you want based on any desktop controls.
Regards,
JPG
-
November 9th, 2019, 19:46 #18
- Join Date
- Dec 2015
- Location
- Boston, MA
- Posts
- 167
The ModifierStack script is implemented simply to add a fixed numerical value; not modify the number of dice rolled in any way.
-
November 10th, 2019, 23:18 #19
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,558
That number is already added to roll automatically via the ActionsManager script in CoreRPG.
If you want to change the behavior, you have to either change the ModifierStaci script; or just add the bonuses to the rolls directly. The latter is what 5E does with the desktop buttons. That’s why I’ve been suggesting using the model; since it doesn’t require you to overwrite any CoreRPG scripts.
Regards,
JPGLast edited by Moon Wizard; November 11th, 2019 at 05:47.
-
November 11th, 2019, 02:17 #20
look at ianmwards dice pool extension
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks