Thankyou for the assistance. I've looked at the DLC contents which are helpful to understanding how Lua works. I've made a simple lua script that should just charge the frequency of goodyhut types on game load. Here's the mod
https://www.mediafire.com/?rrvxfd6dr9nrv9c Unfortunately, I can't find the printed 'debug ' lines in the log files which suggests that the script is not executing at game-load. I suspect I either have a script error, or it's not setup to execute on game-load properly. Help appreciated.
-- LuaScript1
-- Author: Owner
-- DateCreated: 5/20/2017 1:17:24 PM
--------------------------------------------------------------
print("DEBUG LUA SCRIPT ENTRY ...")
local NumberOfGoodyHutSubTypes = RowCount("GoodyHutSubTypes")
local sql
if NumberOfGoodyHutSubTypes > 0 then
-- generates integer numbers between 0 and 100.
sql = "UPDATE GoodyHutSubTypes SET Weight = \"" .. tostring(math.random(101) - 1) .. \""
local resultId = DB.QUERY(sql)
print(sql)
end
print("DEBUG LUA SCRIPT EXIT ...")
end
function RowCount(TableName)
local resultId = DB.QUERY("SELECT COUNT(1) AS count FROM " .. TableName .. \"")
if resultId then
local count = result.getDataInt(resultId, "count")
result.free(resultId)
return count
else
return -1
end
end