spidierox Posted October 13, 2024 Posted October 13, 2024 Hey, I keep getting the same error and I have (re)searched some examples but can't figure it out... (btw. my first attempt at LUA) This is the code: local RadioMenu = missionCommands.addSubMenu ('Training') local Menu_A2A = missionCommands.addSubMenu ("Air to Air Training", RadioMenu) local BFM_F5 = missionCommands.addCommand ("BFM F5", Menu_A2A) and I keep getting "attempt to index global 'missionCommands' (a nil value)" Anyone can help ? or have a link ? it is the part where it says "index global" I have added submenu's with the .addsubMenu (2 even 3 layers deep) but as soon as I reference the .addCommand I get the error. Maybe someone can give some guidance as I am clueless now... Thanks in advance Spidierox
kira_mikamy Posted October 13, 2024 Posted October 13, 2024 " local BFM_F5 = missionCommands.addCommand ("BFM F5", Menu_A2A) " thers no command in that string, it should be ("BFM F5", Menu_A2A, COMMAND_FUNC) you are try to add a command without set wich comand it have to call. function COMMAND_FUNC() ..your script here.. end
spidierox Posted October 13, 2024 Author Posted October 13, 2024 (edited) local function Call_me () -- try out trigger.action.outText("F-5 spawned for BFM training!", 10) end local RadioMenu = missionCommands.addSubMenu ('Training') local Menu_A2A = missionCommands.addSubMenu ("Air to Air Training", RadioMenu) local BFM_F5 = missionCommands.addCommand ("BFM F5", Menu_A2A, Call_me) Same problem : "attempt to index global 'missionCommands' (a nil value)" --> this is my issue Edited October 13, 2024 by spidierox
Grimes Posted October 14, 2024 Posted October 14, 2024 Can you attach a mission with the script causing an error? The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
spidierox Posted October 14, 2024 Author Posted October 14, 2024 Here is the LUA script Radio menu.lua
kira_mikamy Posted October 15, 2024 Posted October 15, 2024 Il 13/10/2024 at 20:33, spidierox ha scritto: local function Call_me () not sure about but may you need to use Call_Me() without space or remove the "local" or maybe both
Recommended Posts