5E Product Walkthrough Playlist
  1. #1

    Help with buttongroup

    OK time to show my ignorance again.

    I have the following code in a quick test setup just to set a test database value and tie it to some buttons
    Code:
    function onInit()
    newnode=DB.createChild("testnode","test","number")
    Debug.console("newnode",newnode)
    DB.setValue(newnode,"","number",2)
    end
    Then in my xml file I have
    Code:
    <buttongroup_counter name="legrescounter" source="testnode.test">
        <anchored to="legres_label" position="righthigh" offset="40,0" />
        <values>
        <maximum>8</maximum>
        <current>4</current>
        </values>
        
       </buttongroup_counter>
    Which I was hoping would give me a working set of butons to play around with, which it does to a degree.
    The buttons display in the combattracker where I have set them, they have the correct number of buttons, and are filled in upto number 4.

    But when I 1st press the buttons, nothing happens, when they are pressed for the second time the following error is produced :

    Script Error: [string "common/scripts/buttongroup_counter.lua"]:128: attempt to compare nil with number

    I'm obviously doing something incorrectly, what do I need to add/change to get this to work ?

    Cheers, Steve.

  2. #2
    Aaaaand after many hours of staring at the same code,
    It turns out I just need to set the <current> field to point to the database node.

    Can't believe I tried that *just* after posting the initial question.

    Cheers, Steve.

  3. #3
    Turns out I'm not right...
    The buttons now update when I press then, but they are not getting their initial value from my database node.
    Does anyone have any insight on this please ?

    Cheers, Steve.

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