Varsuuk
July 27th, 2020, 22:49
I am getting this console error:
Runtime Notice: s'Calling onValueChanged() for HD'
Runtime Notice: s'1d6+'
Runtime Notice: nil
Runtime Notice: nil
Runtime Notice: nil
Runtime Notice: s'SAVING THROW='
Runtime Notice: #0
Script Error: [string "hd"]:1: attempt to call field 'savingThrow' (a nil value)
The to be called code was setup in the extensions.xml prior to the xml file which uses it (if that matters)
data_swwb_monster.lua
function hdType()
return "d6"
end
function savingThrow(sHD)
local nHD, sDice, _ = Parser.parseHDInfo(sHD)
-- ADD CODE TO CHECK IF < 1d6
return math.floor(19 - nHD)
end
The caller is a control I inherited from OSE work on MoreCore:
record_npc.xml
<string_column_half name="hd">
<script>
function onValueChanged()
local rActor = ActorManager.getActor("npc", window.getDatabaseNode());
Debug.console("Calling onValueChanged() for HD")
local sHD = DB.getValue(rActor.sCreatureNode..".hd", "")
if not sHD then
Debug.console("HD cannot be empty")
return
end
local num, dice, mod = Parser.parseHDInfo(sHD)
Debug.console(sHD)
Debug.console(num)
Debug.console(dice)
Debug.console(mod)
local nSavingThrow = DB.getValue(rActor.sCreatureNode..".saving_throw", nil, 0)
Debug.console("SAVING THROW=")
Debug.console(nSavingThrow)
Debug.console(Monster_SWWB.savingThrow(sHD))
end
Not at all seeing why "savingThrow" is nil. Ideas?
Runtime Notice: s'Calling onValueChanged() for HD'
Runtime Notice: s'1d6+'
Runtime Notice: nil
Runtime Notice: nil
Runtime Notice: nil
Runtime Notice: s'SAVING THROW='
Runtime Notice: #0
Script Error: [string "hd"]:1: attempt to call field 'savingThrow' (a nil value)
The to be called code was setup in the extensions.xml prior to the xml file which uses it (if that matters)
data_swwb_monster.lua
function hdType()
return "d6"
end
function savingThrow(sHD)
local nHD, sDice, _ = Parser.parseHDInfo(sHD)
-- ADD CODE TO CHECK IF < 1d6
return math.floor(19 - nHD)
end
The caller is a control I inherited from OSE work on MoreCore:
record_npc.xml
<string_column_half name="hd">
<script>
function onValueChanged()
local rActor = ActorManager.getActor("npc", window.getDatabaseNode());
Debug.console("Calling onValueChanged() for HD")
local sHD = DB.getValue(rActor.sCreatureNode..".hd", "")
if not sHD then
Debug.console("HD cannot be empty")
return
end
local num, dice, mod = Parser.parseHDInfo(sHD)
Debug.console(sHD)
Debug.console(num)
Debug.console(dice)
Debug.console(mod)
local nSavingThrow = DB.getValue(rActor.sCreatureNode..".saving_throw", nil, 0)
Debug.console("SAVING THROW=")
Debug.console(nSavingThrow)
Debug.console(Monster_SWWB.savingThrow(sHD))
end
Not at all seeing why "savingThrow" is nil. Ideas?