Jump to content

F10 Radio Questions


lockmart lawndart

Recommended Posts

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:

l598n5x.jpg?1

 

Any idea what the issue is?

Link to comment
Share on other sites

  • 1 year later...

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 by 609_Relentov
Link to comment
Share on other sites

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 ServerScripting 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

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

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 ServerScripting 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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...