STAR TREK 2d20
Page 6 of 26 First ... 4567816 ... Last
  1. #51

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    351
    Thanks for the answer. I'll wait for an update.

    /Peter

  2. #52

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    351

    Error indexing 'catname' in the function recalc() in record_char_skills.xml

    • I'm running a new BRP campaign with no extensions.
    • I'm running on FGU.
    • I did an update just before running the test.
    • [4/5/2021 2:29:55 PM] FGU: v4.0.10 ULTIMATE (2021-02-04)
    • [4/5/2021 2:29:55 PM] OS: Windows 10 (10.0.0) 64bit
    • [4/5/2021 2:30:45 PM] RULESET: Basic Roleplaying: the Chaosium Roleplaying System (v2021-03-09)
    • [4/5/2021 2:30:45 PM] RULESET: Core RPG ruleset (v2021-04-06) for Fantasy Grounds


    In order to replicate this test the "Use Skill Category Bonuses" House Rule needs to be set to "on" in the Prefs window.

    When I change the value of a characteristic, I get the following warnings and errors:
    Code:
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    The category bonuses are calculated correctly! Even though FGU throws this error.

    I have also tested to do the same on FGC with the latest version of the ruleset(s) and there where no errors and the category bonuses where calculated correctly. I also did a test with a pre-coreRPG version of the Basic Roleplaying ruleset (in FGC) and there where no errors and the calculations where correct.

    As far as I can see the code (in the function recalc) is the same in the post-coreRPG and the pre-coreRPG versions of the ruleset. I've tried to come up with a fix but so far I have failed, so any help is appreciated.

  3. #53
    Quote Originally Posted by peterb View Post
    • I'm running a new BRP campaign with no extensions.
    • I'm running on FGU.
    • I did an update just before running the test.
    • [4/5/2021 2:29:55 PM] FGU: v4.0.10 ULTIMATE (2021-02-04)
    • [4/5/2021 2:29:55 PM] OS: Windows 10 (10.0.0) 64bit
    • [4/5/2021 2:30:45 PM] RULESET: Basic Roleplaying: the Chaosium Roleplaying System (v2021-03-09)
    • [4/5/2021 2:30:45 PM] RULESET: Core RPG ruleset (v2021-04-06) for Fantasy Grounds


    In order to replicate this test the "Use Skill Category Bonuses" House Rule needs to be set to "on" in the Prefs window.

    When I change the value of a characteristic, I get the following warnings and errors:
    Code:
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [WARNING]  setValue: Recursive call terminated for (CONTROL_NUMBER) (bonus)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    [4/11/2021 1:17:27 PM] [ERROR]  Handler error: [string "charsheet_skillcategory"]:28: attempt to index global 'catname' (a nil value)
    The category bonuses are calculated correctly! Even though FGU throws this error.

    I have also tested to do the same on FGC with the latest version of the ruleset(s) and there where no errors and the category bonuses where calculated correctly. I also did a test with a pre-coreRPG version of the Basic Roleplaying ruleset (in FGC) and there where no errors and the calculations where correct.

    As far as I can see the code (in the function recalc) is the same in the post-coreRPG and the pre-coreRPG versions of the ruleset. I've tried to come up with a fix but so far I have failed, so any help is appreciated.
    Thank you for the report. It will be added to my list of bug checks.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

  4. #54

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    351
    Hi,

    I've had some success going forward with the "catname" problem. The problem is the recalc() function, which is called from three places in the windowclass "charsheet_skillcategory". If I move the recalc functions code to the two controls that calls it and modify it a bit, then that code works, the category bonuses are correctly calculated.

    For the "catname" label:
    Code:
    function onValueChanged
       if super and super.onValueChanged then
          super.onValueChanged()
       end
       local name = getValue()
       Debug.console("category", name)
       local value = window.windowlist.getBonus(name)
       Debug.console("bonus", value)
       window.bonus.setValue(value)
    end
    and for the "bonus" basicnumber control:
    Code:
    function onValueChanged
       if super and super.onValueChanged then
          super.onValueChanged()
       end
       local name = window.catname.getValue()
       Debug.console("category2", name)
       local value = window.windowlist.getBonus(name)
       Debug.console("bonus2", value)
       bonus.setValue(value)
    end
    **************

    So, so far so good, but the function recalc() is also called by the update() function which in turn is called by the onInit() function the first time you click on the skill tab. The update function can access the bonus control and make it visible, so it has access to the "bonus" control. If I edit the update() function, like below, and reload the ruleset and click on the Skill tab, then the debug statement "Debug.console("category4", name)" displays "s'category4' | s''". That is, it cannot access (or find) "catname", but it can access "bonus". The later is easy to verify because category names and bonus values are visible. The controls "bonus" and "catname" sould be in the same scope, right? So why can't I access "catname"?

    Code:
    function update()
      print("update()")
      local sOptionHRSCB = OptionsManager.getOption("HRSCB")
    
      if sOptionHRSCB == "on" then
        local node = windowlist.window.getDatabaseNode().createChild("abilities")
        node.onChildUpdate = recalc
        bonus.setVisible(true)
        bonuslabel.setVisible(true)
    
        local name = catname.getValue()
        Debug.console("category4", name)
        local value = windowlist.getBonus(name)
        Debug.console("bonus4", value)
        bonus.setValue(value)
      else
        bonus.setVisible(false)
        bonuslabel.setVisible(false)
      end
    end
    **************

    The recalc() function is also accessed when a characteristic on the Main tab is changed (the line node.onChildUpdate = recalc in the update() function). When you access recalc() this way it throws an "attempt to index global" error. And it doesn't seem to mather what statement you put first in the function.

    When I change the recalc() functions code and inserts a few debug statements and a print statement, like this:
    Code:
    function recalc()
      print("recalc()")
      local name = catname.getValue();
      Debug.console("category3", name)
      local value = windowlist.getBonus(name);
      Debug.console("bonus3", value)
      bonus.setValue(value);
    end
    Then I get the error: "attempt to index global 'print' (a nil value)". If I change the print statement to a debug statement, the error messages changes to "attempt to index global 'Debug' (a nil value)". There are two recalc funcions in record_char_skills.xml, so I renamed the recalc() function in charsheet_skillcategory to recalcat(), but that didn't have any effect. What would make a statement in a function throw "attempt to index global", regardless of what statement it is?

    **************

    Finally, It's worth noting that the code seems to work fine in FGC, from what I can tell.


    /Peter

  5. #55

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    351
    If you want to recreate this behavior you can use the extension below. It loads the record_char_skills.xml that I've been modifying. Don't forget to turn on "Use Skill Categories" in the preferences.
    Attached Files Attached Files

  6. #56
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    Quote Originally Posted by peterb View Post
    If I change the print statement to a debug statement, the error messages changes to "attempt to index global 'Debug' (a nil value)".
    Debug needs to be followed with .console or .chat

  7. #57

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    351
    Quote Originally Posted by damned View Post
    Debug needs to be followed with .console or .chat
    It was. I used Debug.console("recalc()", "").

  8. #58

    Join Date
    Mar 2009
    Location
    Lidingö, Sweden, Europe
    Posts
    351
    I found this post when searching for info on "attempt to call global". It seems to suggest that the value of a genericcontrol cannot be accessed by getValue(). But I'm able to do so in
    "catname" genericcontrol:
    Code:
    function onValueChanged
       if super and super.onValueChanged then
          super.onValueChanged()
       end
       local name = getValue()
       Debug.console("category", name)
       local value = window.windowlist.getBonus(name)
       Debug.console("bonus", value)
       window.bonus.setValue(value)
    end
    The post above is a couple of years old. Has this changed?

  9. #59
    The "genericcontrol" object type does not support the getValue function; as the genericcontrol object does not support a database value nor is able to link to a database node.

    The "catname" control may be a template which resolves to a stringcontrol/stringfield, which is why it works there.

    Regards,
    JPG

  10. #60
    Quote Originally Posted by peterb View Post
    Hi,

    I've had some success going forward with the "catname" problem. The problem is the recalc() function, which is called from three places in the windowclass "charsheet_skillcategory". If I move the recalc functions code to the two controls that calls it and modify it a bit, then that code works, the category bonuses are correctly calculated.

    For the "catname" label:
    Code:
    function onValueChanged
       if super and super.onValueChanged then
          super.onValueChanged()
       end
       local name = getValue()
       Debug.console("category", name)
       local value = window.windowlist.getBonus(name)
       Debug.console("bonus", value)
       window.bonus.setValue(value)
    end
    and for the "bonus" basicnumber control:
    Code:
    function onValueChanged
       if super and super.onValueChanged then
          super.onValueChanged()
       end
       local name = window.catname.getValue()
       Debug.console("category2", name)
       local value = window.windowlist.getBonus(name)
       Debug.console("bonus2", value)
       bonus.setValue(value)
    end
    **************

    So, so far so good, but the function recalc() is also called by the update() function which in turn is called by the onInit() function the first time you click on the skill tab. The update function can access the bonus control and make it visible, so it has access to the "bonus" control. If I edit the update() function, like below, and reload the ruleset and click on the Skill tab, then the debug statement "Debug.console("category4", name)" displays "s'category4' | s''". That is, it cannot access (or find) "catname", but it can access "bonus". The later is easy to verify because category names and bonus values are visible. The controls "bonus" and "catname" sould be in the same scope, right? So why can't I access "catname"?

    Code:
    function update()
      print("update()")
      local sOptionHRSCB = OptionsManager.getOption("HRSCB")
    
      if sOptionHRSCB == "on" then
        local node = windowlist.window.getDatabaseNode().createChild("abilities")
        node.onChildUpdate = recalc
        bonus.setVisible(true)
        bonuslabel.setVisible(true)
    
        local name = catname.getValue()
        Debug.console("category4", name)
        local value = windowlist.getBonus(name)
        Debug.console("bonus4", value)
        bonus.setValue(value)
      else
        bonus.setVisible(false)
        bonuslabel.setVisible(false)
      end
    end
    **************

    The recalc() function is also accessed when a characteristic on the Main tab is changed (the line node.onChildUpdate = recalc in the update() function). When you access recalc() this way it throws an "attempt to index global" error. And it doesn't seem to mather what statement you put first in the function.

    When I change the recalc() functions code and inserts a few debug statements and a print statement, like this:
    Code:
    function recalc()
      print("recalc()")
      local name = catname.getValue();
      Debug.console("category3", name)
      local value = windowlist.getBonus(name);
      Debug.console("bonus3", value)
      bonus.setValue(value);
    end
    Then I get the error: "attempt to index global 'print' (a nil value)". If I change the print statement to a debug statement, the error messages changes to "attempt to index global 'Debug' (a nil value)". There are two recalc funcions in record_char_skills.xml, so I renamed the recalc() function in charsheet_skillcategory to recalcat(), but that didn't have any effect. What would make a statement in a function throw "attempt to index global", regardless of what statement it is?

    **************

    Finally, It's worth noting that the code seems to work fine in FGC, from what I can tell.


    /Peter
    I've looked this over and will be presenting a fix soon. Wanted to go over the NPC sheet reports first and combine this fix with that fix.
    Dominic Morta
    Ruleset Developer
    Smiteworks

    How to zip up your campaign if the Developers ask for it-How to zip up your campaign if the Developers ask for it

    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Feature Request

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
  •  
DICE PACKS BUNDLE

Log in

Log in