ORMtnMan Posted May 17, 2015 Share Posted May 17, 2015 So, to explain what I am doing, I am trying to add to my mod the ability to unload ammo from guns/magazines. I intend to do so via context menu, but for one reason or another I can't get my option to appear on the context menu. I need to get this nailed down before I can do anything else... Here is what I have just for the context menu:ORGMInventoryPaneContextMenu = {}ORGMInventoryPaneContextMenu.createMenu = function(player, isInPlayerInventory, items, x, y, origin) if UIManager.getSpeedControls():getCurrentGameSpeed() == 0 then return; end local context = ISContextMenu.get(player, x, y); context.origin = origin; local playerObj = getSpecificPlayer(player) getCell():setDrag(nil, player); if isInPlayerInventory then local item = items[1]; if not instanceof(items[1], "InventoryItem") then item = items[1].items[1]; end if item.currentCapacity ~= 0 then context:addOption(ReloadUtil:getUnloadText(item, playerObj), items, ORGMInventoryPaneContextMenu.OnUnload, player); end endendORGMInventoryPaneContextMenu.OnUnload = function(items, player) local weapon = items[1]; if not instanceof(items[1], "InventoryItem") then weapon = items[1].items[1]; end ReloadManager[player+1]:startUnloadFromUi(weapon);end I basically took and modified the parts of the I Context menu script, stripped it of the non-needed bits and edited the remaining parts to suit my needs (or so I thought) Any help would be greatly appreciated! Edit: D'oh misspelled the title in my haste... and I don't know how to change it. Link to comment Share on other sites More sharing options...
ethanwdp Posted May 17, 2015 Share Posted May 17, 2015 ReloadManager[player+1]:startUnloadFromUi(weapon); You forgot to capitalize the I in UI. Also, for changing the title of the post you click edit and click Full Editor. It'll allow you to change the title. Link to comment Share on other sites More sharing options...
ORMtnMan Posted May 17, 2015 Author Share Posted May 17, 2015 ReloadManager[player+1]:startUnloadFromUi(weapon); You forgot to capitalize the I in UI. Also, for changing the title of the post you click edit and click Full Editor. It'll allow you to change the title. That particular line is how it ties into the reload script. So, once I click the option in the context menu it sends that signal to the script. However, I can't even get the option to show up on the context menu. I don't think that particular line is what is causing it. In the base reload context menu code the "i" in UI is not capitalized. All I really did on that line is change Reload to Unload. Thanks for the assist on the misspelling Link to comment Share on other sites More sharing options...
EnigmaGrey Posted May 17, 2015 Share Posted May 17, 2015 No reference anywhere to Events.OnFillWorldObjectContextMenu.Add()? Link to comment Share on other sites More sharing options...
ORMtnMan Posted May 18, 2015 Author Share Posted May 18, 2015 No reference anywhere to Events.OnFillWorldObjectContextMenu.Add()? ...erm... let me see >.> after work Well that is another way to get a context menu to appear. I'll fiddle around with that type of context menu and see if it works. I had assumed that theORGMInventoryPaneContextMenu.createMenu = function(player, isInPlayerInventory, items, x, y, origin)was the same thing. If I run into another road block there I'll post another "please help me" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now