SouthSaturnDelta 1 Posted September 13, 2006 Hit a snag guys, wonderered if anyone has a way of getting around it. I have a load of scripts that run ( badly ) from the player's menu using the AddAction line. This is sound and the action is removed with the Remover Action line. However, I have multiple user actions grouped into the menu, so if I remove an action for a set period ( until the script is ready again ) the only way I have found to replace it puts it onto the main user menu. I.E. ===================== Reload M16 Salute Make a sandwich ... (open this and another menu appears) =====================             ... Make a cheese sandwich             ... Make an egg sandwich             ... Make a Ham sandwich ===================== Now say I make a particular sandwich, I remove this action for 1 minute ( while I no doubt search for beer as well ) and replace it using addaction , but it reapears onto the main menu ~ ===================== Reload M16 Salute Make a sandwich ... ... Make a Ham sandwich ===================== Is there a way to replace this rogue action back into its original place with the other sandwich actions ? I do add a hint informing the user to wait until prompted to use the option again, but as its there Its always going to be assumed that its 'ready'. How can I work around this problem ? Cheers, SSD Share this post Link to post Share on other sites
hardrock 1 Posted September 13, 2006 Well, I don't see why that is a problem for you. It should be like that, no? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">ActionSandwich = player addAction ["+ Make a sandwich", "draw_sandwich_actions.sqs"] draw_sandwich_actions.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player removeAction ActionSandwich ActionSandwich = player addAction ["- Make a sandwich", "remove_sandwich_actions.sqs"] ActionCheeseSandwich = player addAction [" ... cheese", "cheese_sandwich.sqs"] ActionHamSandwich = player addAction [" ... ham", "ham_sandwich.sqs"] cheese_sandwich.sqs, ham_sandwich.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] exec "remove_sandwich_actions.sqs" ; further code remove_sandwich_actions.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{player removeAction _x} forEach [ActionSandwich, ActionCheeseSandwich, ActionHamSandwich] ActionSandwich = player addAction ["+ Make a sandwich", "draw_sandwich_actions.sqs"] That works for the player only, but I guess that's all what you need, not? Share this post Link to post Share on other sites
SouthSaturnDelta 1 Posted September 13, 2006 Hi again, and thanks for your reply Hardrock.  I forgot to mention that I have multiple menu's like Unified Artillery has.Here you see the Main options menu. Reload M16 Salute Make a sandwich Make a drink Make some Hot food Now here are the sub menu's that appear when each is pressed :- Make a sandwich ... (open this and another menu appears containing the options below....)            ... Make a cheese sandwich            ... Make an egg sandwich            ... Make a Ham sandwich ... Back Make a Drink ... (open this and another menu appears containing the options below...)            ...Make a cup of tea            ...make a cup of coffee            ...open a bottle of lemonade ... Back Make some hot food ... (open this and another menu appears containing the options below...)            ...Make a Pizza            ...make Hamburger            ...Cook some chips ... Back Now you see there are 3 distinct sub menu's I added ~ The sandwich, the drink and the hot food.Each when pressed opens its own options menu containing various actions. If I remove and replace these user actions, they will only reappear on the main options menu so i end up with for example ~ ( If I remove for 1 min and then replace the Ham sandwich action...) Reload M16 Salute Make a sandwich Make a drink Make some Hot food Make a Ham sandwich ....* ...*( this is out of its sub menu and I need it to be replaced within the 'Make a sandwich' menu again) I'm not sure if this is possible, but would be of great help to me to keep each menu option usable at all times. Cheers, SSD Share this post Link to post Share on other sites
hardrock 1 Posted September 14, 2006 Well, it just would be an extension of the above. You just always have to add the actions in the reverse order. Some init <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">drinkMenuOpen = false sandwichMenuOpen = false drawMenu = loadFile "drawMenu.sqf" call drawMenu drawMenu.sqf <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{player removeAction _x} forEach [actionDrink, actionDrinkTea, actionDrinkCoffee, actionSandwich, actionSandwichHam, actionSandwichCheese]; if (drinkMenuOpen) then { actionDrinkCoffee = player addAction [" ... coffee", "drink_coffee.sqs"]; actionDrinkTea = player addAction [" ... tea", "drink_tea.sqs"]; actionDrink = player addAction ["- Make drink", "drink_menu_close.sqs"]; } else { actionDrink = player addAction ["+ Make drink", "drink_menu_open.sqs"]; } if (sandwichMenuOpen) then { actionSandwichCheese = player addAction [" ... cheese", "sandwich_cheese.sqs"]; actionSandwichHam = player addAction [" ... ham", "sandwich_ham.sqs"]; actionSandwich = player addAction ["- Make sandwich", "sandwich_menu_close.sqs"]; } else { actionSandwich = player addAction ["+ Make sandwich", "sandwich_menu_open.sqs"]; } drink_coffee.sqs, drink_tea.sqs, drink_menu_close.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">drinkMenuOpen = false call drawMenu ; additional code drink_menu_open.sqs <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">drinkMenuOpen = true call drawMenu and the same for the sandwich scripts. Share this post Link to post Share on other sites
SouthSaturnDelta 1 Posted September 14, 2006 Good man Hardrock, I'll have a go at this and let you know how it goes mate. Should be interesting. Thanks, SSD Share this post Link to post Share on other sites