FG Spreadshirt Swag
Page 2 of 4 First 1234 Last
  1. #11
    Ok, one more follow up question.

    if ModifierStack.getModifierKey("things") then
    returns true when a control has the name "things". Can I drill down? Like, under that control I have a values entry with a current entry under it with a number. Can I do a getValue or an if current == 1 then this, if current == 2, do this?
    Wesley Toma-Lee
    Lead Developer
    Nerd Eye Industries
    https://www.nerdeyeindustries.com

  2. #12
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    Quote Originally Posted by statik37 View Post
    Can I drill down? Like, under that control I have a values entry with a current entry under it with a number. Can I do a getValue or an if current == 1 then this, if current == 2, do this?
    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#getValue
    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!

  3. #13
    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

  4. #14
    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.
    Wesley Toma-Lee
    Lead Developer
    Nerd Eye Industries
    https://www.nerdeyeindustries.com

  5. #15
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    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!

  6. #16
    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
    When I put that debug line in there, I see freeadjustment passes a value of whatever I type in the mod.

    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?
    Wesley Toma-Lee
    Lead Developer
    Nerd Eye Industries
    https://www.nerdeyeindustries.com

  7. #17
    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

  8. #18
    The ModifierStack script is implemented simply to add a fixed numerical value; not modify the number of dice rolled in any way.
    This is what I want. I want a fixed numerical value. I already have the for loop to break it out into individual d20 entries as needed. I just need to get the value.
    Wesley Toma-Lee
    Lead Developer
    Nerd Eye Industries
    https://www.nerdeyeindustries.com

  9. #19
    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,
    JPG
    Last edited by Moon Wizard; November 11th, 2019 at 05:47.

  10. #20

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in