agris Posted April 10, 2023 Share Posted April 10, 2023 (edited) I'm playing BG:EE right now with the excellent Classic BG UI mod, and it includes some handy hotkeys. One of them is "loot entire container" when pressing E. It's great, reminds me of some of the great time-saving sfall tweaks for Fallout 1/2. It's defined as such in ui.menu { enabled "containerBigMode == 0" on E action " Infinity_PlaySound('GAM_09') worldScreen:TakeAllFromContainer() " } Setting aside bigmode, I would like to add onto the end of the on E action macro a line that (1) checks if the container is empty, and (2) if so, closes the container. Something like if getContainerEmpty = 1 then closeContainerWindow else end Except both those function calls are fake. I made them up! This is where I'm running into my first issue: it seems like there is no good documentation of the functions available for the EE UIs. It's all contained in the black hole that is the Beamdog forums, which don't let you search per-forum and, strangely, are not searchable by google using the classic "TERM site:https://forums.beamdog.com/categories/ui-modding" method. I've looked through ui.menu and I see a lot of container functions, like getContainerItemProperty([index, 'property']) but I can't find these getContainerX functions documented. So: what's the "easy" function to check if a container is empty, and what type of function am I looking at to close the loot window? And will the "on E action" macro accept those functions? Edited April 10, 2023 by agris Quote Link to comment
lefreut Posted April 10, 2023 Share Posted April 10, 2023 I tried something like this: if #loot.containerItems == 0 then Infinity_PopMenu('WORLD_CONTAINER') end But there are two issues: 1) The loot.containerItems variable is updated only after the action ends so you have to press 'E' a second time. 2) This will close the container menu but it will not reopen the action bar. Quote Link to comment
agris Posted April 10, 2023 Author Share Posted April 10, 2023 (edited) 37 minutes ago, lefreut said: I tried something like this: if #loot.containerItems == 0 then Infinity_PopMenu('WORLD_CONTAINER') end But there are two issues: 1) The loot.containerItems variable is updated only after the action ends so you have to press 'E' a second time. 2) This will close the container menu but it will not reopen the action bar. Thank you. Excuse my ignorance, but to point 1, would something like this work? { on E action " count = 0 Infinity_PlaySound('GAM_09') worldScreen:TakeAllFromContainer() count = 1 " if count > 0 then if #loot.containerItems == 0 then Infinity_PopMenu('WORLD_CONTAINER') end count = 0 end } The counter is tracking if we've pressed E or not, so newly opened but empty containers don't close automatically. To point 2, is there an action bar equivalent of Infinity_PopMenu? like Infinity_PopMenu('ACTION_BAR') that could be invoked together with the closing of the world container? edit: whew, that code view is a finicky beast! Edited April 10, 2023 by agris Quote Link to comment
marchitek Posted April 11, 2023 Share Posted April 11, 2023 15 hours ago, agris said: This is where I'm running into my first issue: it seems like there is no good documentation of the functions available for the EE UIs. It's all contained in the black hole that is the Beamdog forums, which don't let you search per-forum and, strangely, are not searchable by google using the classic "TERM site:https://forums.beamdog.com/categories/ui-modding" method. I recently found this: https://eeex-docs.readthedocs.io/en/latest/EE Game Lua Functions/index.html Not much description there, but method names are rather self explanatory. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.