lockmart lawndart Posted January 1, 2015 Share Posted January 1, 2015 I was looking for a way to add submenus to the F10 menu for user operated flags. I thought I found a way after googling using the following: do local MLRSMenu = trigger.action.addOtherSubmenu('MLRS Fire Missions') trigger.action.addOtherCommand('Fire on Kutaisi', 101, 'all', MLRSMenu) trigger.action.addOtherCommand('Fire on Senaki', 102, 'all', MLRSMenu) trigger.action.addOtherCommand('Fire on Kobuleti', 103, 'all', MLRSMenu) local artyMenu = trigger.action.addOtherSubmenu('Artillery Fire Missions') trigger.action.addOtherCommand('Fire on Zugdidi', 104, 'all', artyMenu) trigger.action.addOtherCommand('Fire on Gali', 105, 'all', artyMenu) end The problem is the resulting code and test mission from here: http://forums.eagle.ru/showthread.php?t=98558 gives me this error: Any idea what the issue is? Link to comment Share on other sites More sharing options...
609_Relentov Posted July 1, 2016 Share Posted July 1, 2016 (edited) Same here, I get the same error ("a nil value") when I attempt to use trigger.action.addOtherSubmenu in the same way as described above. Is this function still supported? EDIT - one additional note, I changed the function from addOtherSubmenu to addOtherSubMenu and I got the same exact error. This tells me that both are non-existent functions in the API, so was this function removed or renamed to something else? I have been looking at the SSE documentation here but it's marked as v1.2: http://en.wiki.eagle.ru/wiki/Simulator_Scripting_Engine/DCS:_World_1.2.1/Part_1 Edited July 1, 2016 by 609_Relentov Link to comment Share on other sites More sharing options...
ESAc_matador Posted July 2, 2016 Share Posted July 2, 2016 Try using '101' in the flags. It is supposed to be a string. Link to comment Share on other sites More sharing options...
Grimes Posted July 2, 2016 Share Posted July 2, 2016 That documentation is extremely old. I've maintained an updated version here. trigger.action.addOtherSubmenu was deprecated and much of the capability has been moved to mission commands. Mission commands are essentially the same thing but allow for scripting functions to be called instead of just setting flag values. You may be able to directly call the trigger.action.setUserFlag function and pass it the two other values. Otherwise you can just make your own little function to set the flag when its called. local function setFlags(v) trigger.action.setUserFlag(v.flag, v.val) end local artyMenu = missionCommands.addSubMenu('Artillery Fire Missions') missionCommands.addCommand("Fire on Gali', artyMenu, setFlags, {flag = 105, val = true}) 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 Link to comment Share on other sites More sharing options...
609_Relentov Posted July 2, 2016 Share Posted July 2, 2016 Thanks Grimes! I figured they were no longer supported based on my comment above. I had found the Hoggit site after doing some searches, but thanks for the URL. Also, I tried using your methodology (actually used the "ForCoalition" versions of the two functions you listed) and it worked fine. One question, I used your version for my needs below (which worked fine): local function setFlags(v) trigger.action.setUserFlag(v.flag, v.val) end local MRTMenu = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Mark RED Targets") missionCommands.addCommandForCoalition(coalition.side.BLUE, "Mark BMP Concentrations", MRTMenu, setFlags, {flag=101, val=true}) However, when calling missionCommands.addCommandForCoalition, for the 4th parameter, I tried calling "trigger.action.setUserFlag" directly with its parameters listed after, but the 101 flag was never set although the sub menu was displayed along with the custom command. E.G: local MRTMenu = missionCommands.addSubMenuForCoalition(coalition.side.BLUE, "Mark RED Targets") missionCommands.addCommandForCoalition(coalition.side.BLUE, "Mark BMP Concentrations", MRTMenu, trigger.action.setUserFlag, {101, true}) Is that expected? I.e. you can't call API functions directly, you have to call user defined functions? Thanks Link to comment Share on other sites More sharing options...
Grimes Posted July 2, 2016 Share Posted July 2, 2016 The problem is more to do with the input values required. setUserFlag() takes two values (flag and value to set it to), while the one I created is a single table that has the values within. You could try (101, true) instead of a table declaration. Perhaps the function accepts additional arguments where you could use trigger.action.setUserFlag, 101, true. I don't know off the top of my head though. 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 Link to comment Share on other sites More sharing options...
609_Relentov Posted July 2, 2016 Share Posted July 2, 2016 Thanks Grimes - I'll keep experimenting, and thanks for the effort to keep the documentation up to date, otherwise it's all guesses as to what the current API functions are! It works fine using a new function as you showed, so I'm good to go - thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts