My that is a messy setup you have there, you're gonna have to do some debugging yourself. Here's the funcftion i use to debug variables
debug = {
times = 0,
prep = function()
screen:setBackgroundColor(colors.black)
screen:setTextColor(colors.white)
screen:setLayer(6)
screen:fill()
screen:setCursorPos(1,1)
end,
pause = function()
while true do
local _e,key = os.pullEvent"key"
if key == 14 then
error()
else
return
end
end
end,
variables = function(...)
debug.times = debug.times+1
local tLines = {}
for i=1,#arg do
local var = arg[i]
if not var then
tLines[#tLines+1] = "nil"
elseif type(var) == "table" then
for k,v in pairs(var) do
tLines[#tLines+1] = k..": "..tostring(v)
end
else
tLines[#tLines+1] = type(var).." "..var
end
end
local lines = tTerm.screen.y-2
local pages = math.ceil(#tLines/lines)
for page = 1,pages do
debug.prep()
print("Page "..page.."/"..pages.." Debug call #"..debug.times.." on "..tFile.program)
for line = lines*(page-1)+1,lines*page do
if not tLines[line] then
break
else
print(tLines[line])
end
end
debug.pause()
end
end,
}
I'd suggest using it to check the variables determining where the text is loacted. See if any of them are incorrect, then check where they're generated.
v["position"] = {}
v["position"]["xPos"] = xText;
v["position"]["xMin"] = xStart;
v["position"]["xMax"] = xEnd;
v["position"]["yMin"] = yMin;
v["position"]["yMax"] = yMax;
debug.variables(v.position)