it is happening with my script every now and then. not often enough to track down the part of the code that is triggering it. i have a script that reproduces the error fairly reliably
I'm pretty sure I can narrow it down to something with ll.GetNotecardLineSync as this started after moving over from ll.GetNotecardLine with data server event
To reproduce add a notecard called LootConfig to an object along side the below script and compile
-- Global variables to track line number and notecard query ID
notecardLine = 0
notecardQueryId = nil
--tables
testTable = {}
rw = {}
rc = {}
rMessage = {}
lStack = {}
config = {}
-- Price of the loot box (read from the notecard)
lPrice = 0
--current user
currentUser = nil
function read_notecard_sync(name)
local notecard = "LootConfig" -- Ensure this is a valid notecard name
local line = 0
if notecard and notecard ~= "" then -- Ensure the notecard name is valid
local text = ll.GetNotecardLineSync(notecard, line)
while text ~= EOF and text ~= NAK do
--ll.OwnerSay(text)
process_line(text)
line = line + 1
text = ll.GetNotecardLineSync(notecard, line)
end
if text == NAK then
ll.OwnerSay("Cache interrupted! getting data")
ll.GetNumberOfNotecardLines("LootConfig")
ll.ResetScript()
else
ll.OwnerSay("finished reading successfully")
if config["price"] then
lPrice = tonumber(config["price"])
ll.SetPayPrice(PAY_HIDE, { lPrice, PAY_HIDE, PAY_HIDE, PAY_HIDE })
ll.OwnerSay("Loot box price set to: " .. lPrice .. " L$")
updatePriceDisplay()
else
ll.OwnerSay("Warning: No price set in the notecard.")
end
end
else
ll.OwnerSay("Error: Notecard name is invalid or missing!")
end
end
function process_line(line)
local key, value = string.match(line, "([%w_]+)%s*=%s*(.+)")
if key and value then
local num_value = tonumber(value)
config[key] = num_value or value
return
end
local r, c, w, i, m = string.match(line, "([^:]+):([^:]+):([^:]+):([^:]+):(.+)")
if r and c and w and i and m then
local iList = string.split(i, ",")
testTable[r] = iList
rw[r] = tonumber(w) or 1
rc[r] = c
rMessage[r] = m
else
ll.OwnerSay("Failed to match line format: " .. line)
end
end
for i=1,1000,1 do
read_notecard_sync("LootConfig")
ll.ResetScript()
end