Thread: Help with buttongroup
-
June 4th, 2020, 08:57 #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
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>
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.
-
June 4th, 2020, 09:13 #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.
-
June 4th, 2020, 14:33 #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