Nebulazer 1 Posted April 13, 2015 I am working on a script for changing loadouts using submenus with the scroll wheel. I have it working when called off the the box that I named 'menuBlu' with this script this AddAction ["<t color=""#B40404"">" +"Select Gear", "Classes\menuBlu.sqf"] call BIS_fnc_MP; There are a lot of different file that i had to use to make the submenus as I am still learning about coding, but hopefully someone here can give me some tips to head in the right direction with this. I need to be able to recreate it for the opposite side, but right now it looks like i will have to copy every single file and change paths and 'menuBlu' to 'menuRed' for opfor's box. I tried doing something like this _myMenu = menuBlu; _myMenu = 1; // // removeAllactions player; player AddAction ["<t color=""#0000FF"">" +"Machine Guns", "Classes\MachineGuns\MG_menu.sqf", "", 0, false, true, "", 'player distance (getPosATL _myMenu) < 5']; player AddAction ["<t color=""#298A08"">" +"DMR", "Classes\DMR\DMR_menu.sqf", "", 0, false, true, "", 'player distance (getPosATL _myMenu) < 5']; player AddAction ["<t color=""#088A85"">" +"Pistols", "Classes\Pistols\pistolMenu.sqf", "", 0, false, true, "", 'player distance (getPosATL _myMenu) < 5']; player AddAction ["<t color=""#DF7401"">" +"Attachments", "Classes\Attachments\ATT_menu.sqf", "", 0, false, true, "", 'player distance (getPosATL _myMenu) < 5']; player AddAction ["<t color=""#A9D0F5"">" +"Extras", "Classes\Extras\extrasMenu.sqf", "", 0, false, true, "", 'player distance (getPosATL _myMenu) < 5']; But it did not work the same as when I have it set up with just 'menuBlu'. I am very new to variables though, so i think i am doing that completely wrong. Here is the Github for the script, feel free to have a look at the rest of the mission while you are there if you like. I plan on giving full credit to any other scripts creaters if i end up running a dedicated server with this mission. I also plan on using a database and level system, but the database stuff is a bit more advanced than what i can currently do. Share this post Link to post Share on other sites
shuko 59 Posted April 13, 2015 Hmm, instead of making two sqf files, why not make one and put side check within that? Share this post Link to post Share on other sites
Nebulazer 1 Posted April 13, 2015 Hmm, instead of making two sqf files, why not make one and put side check within that? That probably would be easier for making the script easier to copy to the other side, I have already done that now though and it all works, could that be used to condense the amount of files I am using or to make variables with? Can i somehow put all of the submenus into one script instead of having them all in the different sqf files like it is now like 'menuBlu', 'MG_menu', DMR_menu'...ect. Share this post Link to post Share on other sites
shuko 59 Posted April 13, 2015 Make one script. Pass something (simple number for example) via the 3rd parameter of addaction to the script. The number should be unique per action. In the script create a switch to do stuff depending on which number was passed. Share this post Link to post Share on other sites
Nebulazer 1 Posted April 14, 2015 Make one script. Pass something (simple number for example) via the 3rd parameter of addaction to the script. The number should be unique per action. In the script create a switch to do stuff depending on which number was passed. Could I get a brief example of what you mean by using a switch instead? I understand the concept of using pathing to activate another script, but like i said before, I am still pretty new to scripting in general and sometimes seeing those generic examples that are on the BI wiki can be more confusing than seeing it in context (still trying to wrap my head around variables). Share this post Link to post Share on other sites
shuko 59 Posted April 14, 2015 player AddAction ["text1", "script.sqf", 1]; player AddAction ["text2", "script.sqf", 2]; player AddAction ["text3", "script.sqf", 3]; _action = _this select 3; switch _action do { case 1: { // text1 action }; case 2: { // text2 action }; case 3: { // text3 action }; }; Share this post Link to post Share on other sites
Nebulazer 1 Posted April 16, 2015 Ok, i think i see. I will mess with this a bit and see if i can get it to work like that. I am currently messing with a money script on this as well to make it so you earn money when you get kills and can spend it on the gear. I have it working but i need to get a dedicated server so i can use IniDB and save the money on players. I think I am going to rent a dedicated this weekend, any suggestions? Share this post Link to post Share on other sites