Skip to content

The New UI System: How to Use It

1234689

Comments

  • elminsterelminster Member, Developer Posts: 16,317
    @Kerozevok looks great :)
  • UlbUlb Member Posts: 295
    @Kerozevok I've been missing my old UI ever since I migrated from BGT to EE versions.. yours looks just like that. Any chance you're willing to share it?
  • KerozevokKerozevok Member Posts: 695
    @elminster Thanks. ;)

    @Ulb Unfortunately that will be hard to share the same GUI, because several values (x,y) are based on my monitor resolution (1440x900).

    For a panel like the "character sheet" or "inventory", there is no problem, but for the "action bar" on the main screen... It's more complicated (I'll need to test). ;)
  • PeccaPecca Member Posts: 2,215
    @Kerozevok: Here is an example of a dynamic area size I used for Load screen. You can calculate any position based on screenWidth and screenHeight.

    function getSaveArea() local screenWidth, screenHeight = Infinity_GetScreenSize() Infinity_SetArea('SaveArea', nil, nil, nil, screenHeight) end ` menu { name 'LOAD' align center center ignoreEsc onOpen " getSaveArea() "
  • KerozevokKerozevok Member Posts: 695
    edited April 2016
    @Pecca Thanks for the code, I'll test it with the "joined store panels"... But for the action bar, I think I will use "offset X Y".

    Edit : Do you know if there's a way to change the order of the panels (eg: the panel A is before - or behind - the panel B ) ?
    Post edited by Kerozevok on
  • PeccaPecca Member Posts: 2,215
    @Kerozevok I'm not sure what you mean specifically, but usually, what comes latest in the code is the one the top of everything. If you move an elemet up in the code, it gets behind.
  • KerozevokKerozevok Member Posts: 695
    @Pecca Doesn't work... If I move the block "WORLD ACTION BAR" at the begin, in game, the bottom panel is always in front of the others panels.
  • PeccaPecca Member Posts: 2,215
    That works only for elements within the menu, not for menus themselves. I don't know if the menus order can be moved.
  • AnthedonAnthedon Member Posts: 26
    Has anyone figured out a way to center the UI buttons on the play screen properly (BG2EE)? They just snap to the window borders if I try to do just that in edit mode. Specifically the pause, reveal details, party AI and select all buttons are not properly centered.

    It makes the whole look rather unpolished.
  • Zach_BDZach_BD Member Posts: 9
    Holding down left shift should turn off snapping. You can also edit the areas manually in the UI.menu file if you want perfect precision.

    RE:menu order, The menus are stored in a stack and rendered in order from the bottom of the stack to the top.
  • Mr2150Mr2150 Member Posts: 1,170
    @Anthedon - I haven't looked into the code for BG2EE at all however I loaded it up quickly to check it out...

    Those three buttons (there are actually four, but one is for TouchUIs only) are part of the menu named RIGHT_SIDEBAR_BOTTOM and as you can see from the code they are aligned bottom right and are offset from the top of that menu.
    Adjusting the 'area 6 x x x' in the code below to '-4 x x x' will center them nicely (or at least, it did for me!).




    Here's the code if you want to search and manually amend it...

    menu { name 'RIGHT_SIDEBAR_BOTTOM' align right bottom ignoreEsc --Buttons form a menu aligned bottom right, with height = 197, y is offset from top of that menu. button { area 6 0 71 48 enabled "e:IsTouchUI() and worldScreen == e:GetActiveEngine()" toggle selectionButtonToggle bam GUILS10 sequence 14 tooltip lua "Infinity_FetchString(11942)" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " worldScreen:OnSelectionButtonClick() " } button { area 6 49 71 48 enabled "worldScreen == e:GetActiveEngine()" toggle highlightButtonToggle bam GUILS10 sequence 11 tooltip lua "Infinity_FetchString(103144)" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " worldScreen:SetHighlightEnabled(highlightButtonToggle == 1) " } button { area 6 99 71 48 enabled "worldScreen == e:GetActiveEngine()" toggle aiButtonToggle bam GUILS10 sequence 10 tooltip lua "getPartyAITooltip()" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " game:ToggleAI() " } button { area 6 149 71 48 enabled "worldScreen == e:GetActiveEngine()" bam GUILS10 sequence 13 tooltip lua "Infinity_FetchString(10485)" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " game:SelectAll() " actionDbl " game:CenterOnGroupLeader() " } }

    menu { name 'RIGHT_SIDEBAR_BOTTOM' align right bottom ignoreEsc --Buttons form a menu aligned bottom right, with height = 197, y is offset from top of that menu. button { area -4 0 71 48 enabled "e:IsTouchUI() and worldScreen == e:GetActiveEngine()" toggle selectionButtonToggle bam GUILS10 sequence 14 tooltip lua "Infinity_FetchString(11942)" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " worldScreen:OnSelectionButtonClick() " } button { area -4 49 71 48 enabled "worldScreen == e:GetActiveEngine()" toggle highlightButtonToggle bam GUILS10 sequence 11 tooltip lua "Infinity_FetchString(103144)" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " worldScreen:SetHighlightEnabled(highlightButtonToggle == 1) " } button { area -4 99 71 48 enabled "worldScreen == e:GetActiveEngine()" toggle aiButtonToggle bam GUILS10 sequence 10 tooltip lua "getPartyAITooltip()" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " game:ToggleAI() " } button { area -4 149 71 48 enabled "worldScreen == e:GetActiveEngine()" bam GUILS10 sequence 13 tooltip lua "Infinity_FetchString(10485)" tooltip force lua "sidebarForceTooltips == 1" clickable lua "sidebarsGreyed ~= 1" action " game:SelectAll() " actionDbl " game:CenterOnGroupLeader() " } }
  • AnthedonAnthedon Member Posts: 26
    edited April 2016
    Zach_BD said:

    Holding down left shift should turn off snapping. You can also edit the areas manually in the UI.menu file if you want perfect precision.

    RE:menu order, The menus are stored in a stack and rendered in order from the bottom of the stack to the top.

    Pressing Shift did the trick, thanks.
    Mr2150 said:

    @Anthedon - I haven't looked into the code for BG2EE at all however I loaded it up quickly to check it out...

    Those three buttons (there are actually four, but one is for TouchUIs only) are part of the menu named RIGHT_SIDEBAR_BOTTOM and as you can see from the code they are aligned bottom right and are offset from the top of that menu.
    Adjusting the 'area 6 x x x' in the code below to '-4 x x x' will center them nicely (or at least, it did for me!).

    Changing it to -4 does nothing, 1 centers them perfectly. Any idea why the buttons are set up this way other than it being just an oversight?
    Post edited by Anthedon on
  • Mr2150Mr2150 Member Posts: 1,170
    I just reloaded BG2EE and mine are still on -4 and display as expected.

    Do you have Scaled Interface set to on?
  • switswit Member, Translator (NDA) Posts: 495
    edited May 2016
    I'm trying to write a code that would be able to write new line into BALDUR.LUA if it doesn't exist yet and retrieve the previously stored value at will. There are some predefined functions in UTIL.LUA that can write and update keybandings ini values as well as a more general printIni(fp) function (no idea what that fp variable should be set to btw.) but I'm struggling to adopt the code for my purpose. Here are the predefined commands that are probably used for setting/writing/removing ini (BALDUR.LUA) lines:
    Infinity_SetINIValue Infinity_RemoveINIEntry Infinity_WriteINILine

    And here is the example code I've used for test:
    function setINICustom() section = "testCol1" key = "testCol2" value = 1 out = "SetPrivateProfileString('" .. section .. "','" .. key .. "',[[" .. value .. "]])\n" Infinity_WriteINILine(out) end
    Unfortunately it crashes the engine when I use setINICustom() in action / actionEnter / actionExit or within another function in UI.MENU. Can anyone please help me with it?
    Post edited by swit on
  • Zach_BDZach_BD Member Posts: 9
    WriteINILine is used internally and takes 2 arguments, the first being a file pointer, so its probably not what you're looking for here. I'd recommend using Infinity_SetINIValue here, it takes 3 arguments:

    Infinity_SetINIValue(section,key,value)
  • switswit Member, Translator (NDA) Posts: 495
    Thank you very much @Zach_BD for quick answer. Infinity_SetINIValue and Infinity_GetINIValue works as expected. New patch 2.0 GUI system is amazing.
  • Mr2150Mr2150 Member Posts: 1,170
    @Zach_BD is it possible to create new INI values/line items in baldur.lua for storing toggle options like the existing toggles are stored, eg like weather on/off but something like:

    Infinity_SetINIValue('Game Options','Layout','1')

    So you can then use a toggle to switch between different layouts, and then remember the layout selected in baldur.lua between close downs?
  • Mr2150Mr2150 Member Posts: 1,170
    No worries -I tried it, and I see it is :)
  • AdulAdul Member Posts: 2,002
    @Dee Do you have a list of key names that can be used with the on command in UI.menu? I've been able to find a few just through trial and error, but I'm having trouble figuring some out like the number keys.
  • AdulAdul Member Posts: 2,002
    edited May 2016
    Another question: is it possible to detect whether the player has issued an order in the current frame? Or maybe detect mouse clicks on the world background, for a similar effect?
    Post edited by Adul on
  • elminsterelminster Member, Developer Posts: 16,317
    Adul said:

    @Dee Do you have a list of key names that can be used with the on command in UI.menu? I've been able to find a few just through trial and error, but I'm having trouble figuring some out like the number keys.

    Not my area of expertise. But would this comment be of any help to you?

    https://forums.beamdog.com/discussion/comment/775234/#Comment_775234
  • AdulAdul Member Posts: 2,002
    @elminster I didn't find anything to help me with this, but that's a really cool trick and it's definitely going to be useful in the future. Thanks for the heads up!
  • AdulAdul Member Posts: 2,002
    edited May 2016
    And yet another question. I don't much care for the new world map and I've been trying to restore the original tooltip behavior and area name labels, but so far it's proven resistant to my efforts. It seems like most of the world map functionality is handled by a class called CScreenWorldMap, which has an instance called worldMapScreen. I haven't had much success trying to work with these.

    So my question is this: is there any way to view and alter classes like CScreenWorldMap and CScreenInventory? How about engine functions like Infinity_SwapSlot? With no access to these, it looks like a big chunk of the inventory and world map behaviors would remain hardcoded.
    Post edited by Adul on
  • DeeDee Member Posts: 10,447
    To the best of my knowledge, engine functions aren't written in Lua, so there's no way to override them.
  • AdulAdul Member Posts: 2,002
    edited May 2016
    To be exact, I did manage to override Infinity_SwapSlot, but all that did was make inventory management inaccessible. I assume restoring its original functions in Lua is impossible.

    It's frustrating to be so close to getting rid of inventory lag, and yet so far.
    Post edited by Adul on
  • Zach_BDZach_BD Member Posts: 9
    The "on" key names are compared to the results from SDL_GetKeyName, the keyname column here should be a mostly valid list.
  • AncientCowboyAncientCowboy Member Posts: 199
    I've a question. What is the significance of the 'sequence' value I see on so many of the UI elements? I've checked around but can't seem to find any information. TIA.
  • Mr2150Mr2150 Member Posts: 1,170
    In cases I've seen it, it's related to the cycle number of a BAM file - not the frame number.

    If you look at the Left Hand Menu, for example, the BAM used is identical for each button - GUILS10. The only difference is the sequence number. Looking at that BAM in NI gives you the buttons used (animated in multiple frames) one for each cycle...

    I'm not sure I explained that well...
  • DeeDee Member Posts: 10,447
    It refers to the specific frame or cycle (I don't recall which) for the referenced BAM.
Sign In or Register to comment.