Skip to content

Using 'Reveal Details' button to perform CLUAConsole functions

AncientCowboyAncientCowboy Member Posts: 199

BGEE/SOD 2.x added a 'Reveal Details' button to the right sidebar panel that behaves something like a 'sticky TAB key'. While I'm sure it's very handy when running in tablet mode; I don't find it particularly useful when running desktop - I use the TAB key without even thinking.

So, I decided to re-define the button to perform my favorite 'cheat' command: C:ExploreArea(). Don't be put off, however, if you don't share my 'map complete' fetish - C:CreateCreature('SIRINE'), for example can be used instead as a handy 'grind' mechanism. And the possibilities provided by C:Eval and/or C:Exec are endless. If you come up with a neat alternative to ExploreArea, please share it!

One further note before the how-to. For the sake of occasional tablet users, I decided that when in tablet mode, this mod should enable the default behavior. The re-definition is only enabled when not in tablet mode.

First, if necessary, put a copy of UI.menu in the game override directory; and open it with your favorite text editor. Search for the string "Infinity_FetchString(32729)". On an unmodified 2.1 UI.menu it is line 4963 and is in the middle of a button definition that looks like this:

button
{
	area 6 49 71 48
	enabled "worldScreen == e:GetActiveEngine()"
	toggle highlightButtonToggle
	tooltip lua "Infinity_FetchString(32729)"
	bam GUILS10
	sequence 11
	clickable lua "sidebarsGreyed ~= 1"
	action
	"
		worldScreen:SetHighlightEnabled(highlightButtonToggle == 1)
	"
}

Modify the 'enabled' line, and add a new button definition so that the code looks like this:

button
{
	area 6 49 71 48
	enabled "e:IsTouchUI() and worldScreen == e:GetActiveEngine()"
	toggle highlightButtonToggle
	tooltip lua "Infinity_FetchString(32729)"
	bam GUILS10
	sequence 11
	clickable lua "sidebarsGreyed ~= 1"
	action
	"
		worldScreen:SetHighlightEnabled(highlightButtonToggle == 1)
	"
}
button
{
	area 6 49 71 48
	enabled "not e:IsTouchUI() and worldScreen == e:GetActiveEngine()"
	tooltip lua "'Explore Area'"
	bam GUILS10
	sequence 11
	clickable lua "sidebarsGreyed ~= 1"
	action
	"
		C:ExploreArea()
	"
}

The only tricky bits are to be sure to modify the 'enabled' line in the original button definition; and to be sure to use either a quote-apostrophe text apostrophe-quote or an apostrophe-quote text quote-apostrophe sequence for the tool tip in the second button definition. Or, just leave out the tool tip line altogether :smile:

Enjoy - and if you come up with an alternative to C:ExploreArea, please share it! Off to Candlekeep :smile:


Comments

  • mf2112mf2112 Member, Moderator Posts: 1,919
    Works great, thanks!
  • Mr2150Mr2150 Member Posts: 1,170
    Rather than have two buttons one over the top of the other can't you just keep the existing button but have an 'if' statement determining which action is used? So something like this:

    button { area 6 49 71 48 enabled "worldScreen == e:GetActiveEngine()" toggle highlightButtonToggle tooltip lua "''Explore Area'" bam GUILS10 sequence 11 clickable lua "sidebarsGreyed ~= 1" action " if e:IsTouchUI() then worldScreen:SetHighlightEnabled(highlightButtonToggle == 1) else C:ExploreArea() end " }
  • AncientCowboyAncientCowboy Member Posts: 199
    @Mr2150 I'd have a concern that the 'Reveal Details' function is a toggle (two stable states on/off) - both visually and logically. Whereas the the 'Explore Area' is an astable simple pushbutton (you'll notice there's no 'toggle' field in the second button definition). Aside from visual inconsistency, I'm not sure whether there might be some obscure side effect from that usage. Of course there's also the problem of the tool tip being wrong - but that may or may not matter. Very much a personal taste kind of thing :smile:.
  • Mr2150Mr2150 Member Posts: 1,170
    Or, alternatively - press and hold to explore the area and just single click to turn on/off highlights.

    button { area 6 49 71 48 enabled "worldScreen == e:GetActiveEngine()" toggle highlightButtonToggle tooltip lua "Infinity_FetchString(32729)" bam GUILS10 sequence 11 clickable lua "sidebarsGreyed ~= 1" action "worldScreen:SetHighlightEnabled(highlightButtonToggle == 1)" actionhold "C:ExploreArea()" }
  • AncientCowboyAncientCowboy Member Posts: 199

    I've verified that this continues to work correctly in BGEE/SOD 2.2. Have fun!

Sign In or Register to comment.