dfear 10 Posted August 6, 2009 (edited) Hi, I would like to be able to add one or more custom entries in the player communication/custom menu (0-8, 0-9) via script. I just found the function BIS_FNC_createmenu and the scripting command showCommandingMenu wich respectively creates and shows an user custom menu. I found 3 other functions: BIS_fnc_commsMenuCreate, BIS_fnc_commsMenuToggleAvailability, BIS_fnc_commsMenuToggleVisibility. These functions are probably used by SecOps and Warfare modules to hide or unhide certain communication menu entries. Actually it's not clear to me if is possible and eventually how to edit 0-8 and 0-9 menues, any help would be appreciated. Edited August 6, 2009 by dfear Share this post Link to post Share on other sites
Cellus 10 Posted August 6, 2009 The easiest thing to do is create a radio trigger, and rename it by typing whatever you want in the text field. I'm sure there are other things you could do... Share this post Link to post Share on other sites
moricky 211 Posted August 6, 2009 (edited) BIS_MENU_GroupCommunication = [ //--- Name, context sensitive ["User menu",false], //--- Item name, shortcut, -5 (do not change), expression, show, enable ["Not active", [2], "", -5, [["expression", "player setdamage 1"]], "1", "0"], ["Active", [3], "", -5, [["expression", "player setdamage 1"]], "1", "1"] ]; showCommandingMenu "#USER:BIS_MENU_GroupCommunication"; 'BIS_MENU_GroupCommunication' is where 'Communication' leads to. Edited August 6, 2009 by Moricky Share this post Link to post Share on other sites
dfear 10 Posted August 6, 2009 I'm actually using a scripted radio trigger as you suggests. On activation it shows a previously created menu to manage communications with Air Command for CAS purpose. My intention is to realize a more portable and better configurable CAS/Air strike script than the one included in SecOps. Having these comms options in the 0-9 menu makes things easiest for the player and radio triggers could be available for other mission editing purposes.. ---------- Post added at 03:16 PM ---------- Previous post was at 03:05 PM ---------- Seems like the data structure of a menu. Thanks for the code Gaia =) Share this post Link to post Share on other sites
Big Dawg KS 6 Posted August 6, 2009 What's the story behind the -5, and why can't we change it? Share this post Link to post Share on other sites
dfear 10 Posted August 6, 2009 (edited) SOM scripts use the -5 parameter too, I don't know what it stand for.. The code that Gaia posted works cool, now I'm able to create new submenus within the 0-8 (Communication) one. Cannot find any pointer to the 0-9 menu.. thanks again Gaia Edited August 6, 2009 by dfear Share this post Link to post Share on other sites
kremator 1065 Posted August 6, 2009 dfear, Can you show us how you have created those new menus ... for people like me (hard of thinking!) Share this post Link to post Share on other sites
Bellicosity 10 Posted August 6, 2009 Sample code would indeed be cool Share this post Link to post Share on other sites
Impavido 0 Posted August 6, 2009 I've trie dplacing the example from Gaia in a description.ext and it crashes the game. What am I doing wrong or what have I not properly defined. Share this post Link to post Share on other sites
kremator 1065 Posted August 7, 2009 Is it meant to go into description.ext ? Should it be called ? Share this post Link to post Share on other sites
dfear 10 Posted August 7, 2009 Nevermind description.ext.. You have to execVm a .sqf script. BIS_MENU_GroupCommunication is an array so you can add an alement with a sum increasing the shortcut parameter each time. (first entry of a menu have 2 as shortcut value). I'll post some code lines after launch. Share this post Link to post Share on other sites
dfear 10 Posted August 7, 2009 (edited) BIS_MENU_GroupCommunication is initialized when SecOps and/or Warfare modules are loaded in the editor, otherwise it remains undefined. I don't know about other modules using this menu.. BIS_MENU_GroupCommunication is initialized as follow: BIS_MENU_GroupCommunication = [ ["Communications",false], ["Request support",[2],"#USER:BIS_MENU_SOM_Support",-5,[["expression",""]],"0","0"], ["SecOps",[3],"#USER:BIS_MENU_SOM_SecOps",-5,[["expression",""]],"0","0"], ["",[],"",-1,[],"0","0"], ["Request help",[4],"",-5,[["expression","showCommandingMenu ''; player sideChat 'I need assistance!';"]],"0","0"], ["Request help with mission",[5],"",-5,[["expression","showCommandingMenu ''"]],"0","0"], ["Request units",[6],"",-5,[["expression","showCommandingMenu ''; player sidechat 'I need units!';"]],"0","0"], ["Request money",[7],"",-5,[["expression","showCommandingMenu ''; player sidechat 'I need money!';"]],"0","0"], ["Request join",[8],"",-5,[["expression","['Join'] execVM BIS_FNC_CMDMENUCOMM"]],"0","0"], ["Request disband",[9],"",-5,[["expression","showCommandingMenu ''; ['Dismiss'] execVM BIS_FNC_CMDMENUCOMM; debugLog format ['SQL_comm Disband menu'];"]],"0","0"], ["Disband selected (%SELECTED_UNIT_ID)",[9],"",-5,[["expression","BIS_SQL_SelectedUnits = groupSelectedUnits player; showCommandingMenu ''; ['DismissSelected'] execVM BIS_FNC_CMDMENUCOMM; debugLog format ['SQL_comm Disband selected'];"]],"0","0"], ["",[],"",-1,[],"0","0"], ["Send units (%SELECTED_UNIT_ID)",[10],"",-5,[["expression","showCommandingMenu ''; BIS_WF_GROUPSELECTEDUNITS = groupSelectedUnits player;['SendUnits'] execVM BIS_FNC_CMDMENUCOMM;"]],"0","0"], ["Send money",[11],"",-5,[["expression","showCommandingMenu '';['SendMoney'] execVM BIS_FNC_CMDMENUCOMM;"]],"0","0"] ]; All items in the menu are disabled and hidden by default. The following item stands for a line separator in the menu. ["",[],"",-1,[],"0","0"] I'm actually not able to add a custom item to BIS_MENU_GroupCommunication with SecOps loaded without running in a CTD. Try this sample code without loading SecOps/Warfare: init.sqs [] execVM "commsMenu.sqf"; commsMenu.sqf CUSTOM_menu = [ ["Menu",false], ["Item 1",[2],"",-5,[["expression","hint 'Hello!'"]],"1","1"], ["Item 2",[3],"",-5,[["expression","[] execVM 'myScript.sqf'"]],"1","0"] ]; BIS_MENU_GroupCommunication = [ [localize "STR_SOM_COMMUNICATIONS", false], ["Menu",[2],"#USER:CUSTOM_menu",-5,[["expression",""]],"1","1"] ]; if (true) exitWith {}; Edited August 7, 2009 by dfear Share this post Link to post Share on other sites
kremator 1065 Posted August 7, 2009 Fantastic .... now playing around with splitting squads using the comms menu :) Share this post Link to post Share on other sites
dfear 10 Posted August 8, 2009 Does anyone know what is the 0-9 menu (Custom)? Are we allowed to use it as for the Communications one? Share this post Link to post Share on other sites
kremator 1065 Posted August 8, 2009 (edited) dfear, using your information I have been playing around with Mr Centipede's Hybrid Command System. Seems to work pretty well. I can add items to the Comms menu at will :) For info ... check it out http://rapidshare.com/files/265055269/CM_HCS.utes.pbo.html Can't get the comms REGROUP to work however..... any ideas ? Edited August 8, 2009 by Kremator Share this post Link to post Share on other sites
dfear 10 Posted August 8, 2009 (edited) Can't get the comms REGROUP to work however..... any ideas ? BIS_MENU_GroupCommunication = [ [localize "STR_SOM_COMMUNICATIONS", false], //["Test",[1],"#USER:CUSTOM_menu",-5,[["expression",""]],"1","1"], ["Split Platoon (%SELECTED_UNIT_ID)",[2],"",-5,[["expression","nul=[player,(groupSelectedUnits player)] execVM 'cent_HCS2\cent_HCS2_split.sqf'"]],"1","1"], ["Regroup Platoon (%SELECTED_UNIT_ID)",[3],"",-5,[["expression","nul=[player,(groupSelectedUnits _HCLeader)] execVM 'cent_HCS2\cent_HCS2_join.sqf'"]],"1","1"], There is something wrong with _HCLeader as parameter (line 5), this local var is undefined in this scope. I'll be able to tell you some more later or tomorrow.. Edited August 8, 2009 by dfear Share this post Link to post Share on other sites
kremator 1065 Posted August 8, 2009 Cheers mate ... see what you can do. The other menu items I enabled but they don't do anything yet. Share this post Link to post Share on other sites
Impavido 0 Posted August 9, 2009 Thanks very much for the example dfear! Share this post Link to post Share on other sites
kremator 1065 Posted August 9, 2009 Any luck dfear ? Share this post Link to post Share on other sites
dfear 10 Posted August 10, 2009 Sorry Kremator, I had no time to spend on arma2 these days. I didn't check the regroup script so I have not idea about its behaviour. There is an error in the call of that script indeed: _HCLeader is a local variable, not defined in that scope: you have to use a global var (without the underscore) that points to the leader player or maybe it's good to use 'player' command too if you are scripting for a SP game. Let's continue this discussion on the HCS thread, I hope to find some more time to help you in the next days. Anyway, if the regroup script works fine the issue resides in the call's arguments for sure. Later Share this post Link to post Share on other sites
mr_centipede 31 Posted August 11, 2009 Here's something I did, waituntil {!isnil "bis_fnc_init"}; HCS_menu = [ ["HCS",false], ["Split Unit (%SELECTED_UNIT_ID)",[2],"",-5,[["expression","nul=[player,(groupSelectedUnits player)] execVM 'cent_HCS2 \cent_HCS2_split.sqf'"]],"1","1"], ["Rejoin Group (%SELECTED_UNIT_ID)",[3],"",-5,[["expression","nul=[player,(hcSelected player)] execVM 'cent_HCS2 \cent_HCS2_joinCM.sqf'"]],"1","1"] ]; waituntil {!isnil "BIS_MENU_GroupCommunication"}; [bIS_MENU_GroupCommunication, ["HCS",[0],"#USER:HCS_menu",-5,[["expression",""]],"1","1"]] call [b]BIS_fnc_arrayPush;[/b] if (true) exitWith {}; I use the bolded function to add my custom made HCS_menu into the BIS comms menu. Thank you dfear and kremator for this piece of code Share this post Link to post Share on other sites
kremator 1065 Posted August 11, 2009 Can't get this code to work Mr Centipede. It keeps throwing up errors in the waituntil parts also. Have you looked into opening up the greyed out parts of the menu's that are already there ? OR perhaps looked into how we could put other functionality into the split code (for instance putting colours in there ?) Share this post Link to post Share on other sites
mr_centipede 31 Posted August 11, 2009 Can't get this code to work Mr Centipede. It keeps throwing up errors in the waituntil parts also.Have you looked into opening up the greyed out parts of the menu's that are already there ? OR perhaps looked into how we could put other functionality into the split code (for instance putting colours in there ?) yeah, I forgot something, you have to have SOM sync to you or you could put this on top of that line: [] call BIS_fnc_commsMenuCreate (or was it BIS_fnc_commsCreate?) Share this post Link to post Share on other sites
kremator 1065 Posted August 12, 2009 Have you got any other examples of Comms module loveliness Mr Centipede ? Share this post Link to post Share on other sites