I am getting the following error in console and in the Orbiter log
============================ ERROR: ===========================
Config/Vessels/J3Script/set_anim.lua:157: attempt to index global 'ges' (a nil value)
stack traceback:
Config/Vessels/J3Script/set_anim.lua:157: in function 'Autocoordinate'
Config/Vessels/J3Script/J3Script.lua:192: in function <Config/Vessels/J3Script/J3Script.lua:175>
[ScriptVessel::LuaCall | D:\a\orbiter\orbiter\Src\Vessel\ScriptVessel\ScriptVessel.cpp | 259]
===============================================================

I get this error either at Line 148 or Line 157 in a function that switches the instrument mesh UV coordinates to show a switch throw, depending on the status of the boolean coordinate_hold at the start of the session:
ges is a structure that contains the mesh vertex data:
coordinate_hold is initialized to false in the script, and is read in if it is available in the scenario file using clbk_loadstateex.
This had been working previously, but I realized that I had to edit the code as I initially had the texture shift done inside of a keypress callback which didn't register the boolean if it was read from the scenario file at the start of the session. It is showing the correct texture map according to the boolean in the scenario file at the start of the session, the coordinate_hold boolean and the texture switches correctly during the session. There are no other errors, even after toggling back and forth several times.
============================ ERROR: ===========================
Config/Vessels/J3Script/set_anim.lua:157: attempt to index global 'ges' (a nil value)
stack traceback:
Config/Vessels/J3Script/set_anim.lua:157: in function 'Autocoordinate'
Config/Vessels/J3Script/J3Script.lua:192: in function <Config/Vessels/J3Script/J3Script.lua:175>
[ScriptVessel::LuaCall | D:\a\orbiter\orbiter\Src\Vessel\ScriptVessel\ScriptVessel.cpp | 259]
===============================================================

I get this error either at Line 148 or Line 157 in a function that switches the instrument mesh UV coordinates to show a switch throw, depending on the status of the boolean coordinate_hold at the start of the session:
Code:
function set_anim.Autocoordinate()
--shift UV coordinates of instrument panel texture to toggle switch
if coordinate_hold == true then
ges.Vtx[1].tv = 1.0 --this is line 148
ges.Vtx[2].tv = 1.0
ges.Vtx[3].tv = 0.5
ges.Vtx[4].tv = 0.5
oapi.edit_meshgroup(hdevmesh, 23, ges)
elseif coordinate_hold == false then
ges.Vtx[1].tv = 0.5 --this is line 157
ges.Vtx[2].tv = 0.5
ges.Vtx[3].tv = 0.0
ges.Vtx[4].tv = 0.0
oapi.edit_meshgroup(hdevmesh, 23, ges)
end
end
ges is a structure that contains the mesh vertex data:
Code:
function clbk_visualcreated(vis, refcount)
hdevmesh = vi:get_devmesh(vis,0)
nvtx = 4
vtx = oapi.create_ntvertexarray(nvtx)
vidx = oapi.create_indexarray({0,1,2,3})
ges = {}
ges.flags = GRPEDIT.VTXTEXV
ges.Vtx = vtx
ges.VIdx = vidx
end
coordinate_hold is initialized to false in the script, and is read in if it is available in the scenario file using clbk_loadstateex.
This had been working previously, but I realized that I had to edit the code as I initially had the texture shift done inside of a keypress callback which didn't register the boolean if it was read from the scenario file at the start of the session. It is showing the correct texture map according to the boolean in the scenario file at the start of the session, the coordinate_hold boolean and the texture switches correctly during the session. There are no other errors, even after toggling back and forth several times.