bojjenclon
November 20th, 2019, 02:31
So I'm trying to write an extension for Numenera that involves a button_stringcycler placed in a window on the desktop. When I try to run the campaign with my extension enabled, I receive the following error:
Script Error: [string "common/scripts/button_stringcycler.lua"]:74: attempt to index local 'node' (a nil value)
I've looked at the code for button_stringcycler and it seems its having a problem retrieving the database node from the window object. Am I not able to use this widget from within the desktop_classes.xml file, or have I simply set something up wrong?
desktop_classes.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->
<root>
<windowclass name="ct_stat_roll">
<sizelimits>
<minimum width="110" height="57" />
</sizelimits>
<noclose />
<nodrag />
<nodrop />
<script>
function onInit()
CtStatRoll.registerControl(self)
end
function onClose()
CtStatRoll.registerControl(nil)
end
</script>
<sheetdata>
<anchor_column name="columnanchor" />
<genericcontrol name="base">
<bounds>5,5,180,52</bounds>
<icon>stat_roll</icon>
</genericcontrol>
<button_stringcycler name="type">
<anchored width="70" height="20">
<top parent="columnanchor" anchor="bottom" offset="22" />
<left parent="columnanchor" anchor="left" offset="23" />
</anchored>
<parameters>
<labelsres>char_label_might|char_label_speed|char_label_intel lect</labelsres>
<values>might|speed|intellect</values>
<defaultlabel>-</defaultlabel>
</parameters>
<tooltip textres="char_tooltip_stat" />
</button_stringcycler>
<numbercontrol name="effort">
<anchored width="42" height="22">
<top parent="columnanchor" anchor="bottom" offset="22" />
<left parent="columnanchor" anchor="left" offset="103" />
</anchored>
<font>modcollector</font>
<default>0</default>
</numbercontrol>
<button_roll name="statroll">
<anchored width="42" height="22">
<top parent="columnanchor" anchor="bottom" offset="22" />
<left parent="columnanchor" anchor="left" offset="133" />
</anchored>
<script>
function action(stat, effort)
CypherStatRolls.rollSkill(stat, effort);
end
function onButtonPress(x, y)
local stat = CtStatRoll.getType()
local effort = CtStatRoll.getEffort()
if stat == nil then
return false
end
action(stat, effort)
return true
end
</script>
</button_roll>
</sheetdata>
</windowclass>
</root>
Script Error: [string "common/scripts/button_stringcycler.lua"]:74: attempt to index local 'node' (a nil value)
I've looked at the code for button_stringcycler and it seems its having a problem retrieving the database node from the window object. Am I not able to use this widget from within the desktop_classes.xml file, or have I simply set something up wrong?
desktop_classes.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->
<root>
<windowclass name="ct_stat_roll">
<sizelimits>
<minimum width="110" height="57" />
</sizelimits>
<noclose />
<nodrag />
<nodrop />
<script>
function onInit()
CtStatRoll.registerControl(self)
end
function onClose()
CtStatRoll.registerControl(nil)
end
</script>
<sheetdata>
<anchor_column name="columnanchor" />
<genericcontrol name="base">
<bounds>5,5,180,52</bounds>
<icon>stat_roll</icon>
</genericcontrol>
<button_stringcycler name="type">
<anchored width="70" height="20">
<top parent="columnanchor" anchor="bottom" offset="22" />
<left parent="columnanchor" anchor="left" offset="23" />
</anchored>
<parameters>
<labelsres>char_label_might|char_label_speed|char_label_intel lect</labelsres>
<values>might|speed|intellect</values>
<defaultlabel>-</defaultlabel>
</parameters>
<tooltip textres="char_tooltip_stat" />
</button_stringcycler>
<numbercontrol name="effort">
<anchored width="42" height="22">
<top parent="columnanchor" anchor="bottom" offset="22" />
<left parent="columnanchor" anchor="left" offset="103" />
</anchored>
<font>modcollector</font>
<default>0</default>
</numbercontrol>
<button_roll name="statroll">
<anchored width="42" height="22">
<top parent="columnanchor" anchor="bottom" offset="22" />
<left parent="columnanchor" anchor="left" offset="133" />
</anchored>
<script>
function action(stat, effort)
CypherStatRolls.rollSkill(stat, effort);
end
function onButtonPress(x, y)
local stat = CtStatRoll.getType()
local effort = CtStatRoll.getEffort()
if stat == nil then
return false
end
action(stat, effort)
return true
end
</script>
</button_roll>
</sheetdata>
</windowclass>
</root>