@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?
@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).
@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()
"
@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.
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.
@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()
"
}
}
@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?
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?
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:
@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?
@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.
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?
@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?
@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!
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.
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.
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.
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...
Comments
http://nsa37.casimages.com/img/2016/04/25/16042511571172044.jpg
@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).
function getSaveArea() local screenWidth, screenHeight = Infinity_GetScreenSize() Infinity_SetArea('SaveArea', nil, nil, nil, screenHeight) end ` menu { name 'LOAD' align center center ignoreEsc onOpen " getSaveArea() "
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 ) ?
It makes the whole look rather unpolished.
RE:menu order, The menus are stored in a stack and rendered in order from the bottom of the stack to the top.
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() " } }
Do you have Scaled Interface set to on?
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?
Infinity_SetINIValue(section,key,value)
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?
https://forums.beamdog.com/discussion/comment/775234/#Comment_775234
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.
It's frustrating to be so close to getting rid of inventory lag, and yet so far.
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...