Sugarcube 2. Halting/overriding default UIBar behavior (without destroying it)

Twine Version: 2.5.1.0
Story Format: Sugarcube 2

Hello, game novelists. Here’s my problem:

Upon opening the window (as in, continuing from a save, or launching the game from a passage containing the UI bar) and the window width is below a certain size, Twine tells the browser not to display the UIBar, obviously so that the play area isn’t covered up by the UI bar. Makes sense to me.

This is a problem because the game will be unplayable on most mobile devices.

So, how do I stop it from doing this? I have tried putting this script:

<<script>>UIBar.unstow()<</script>>

in the StoryInit special passage to no avail. The behavior seems to be taking effect pretty late, overriding any attempt I make to halt it.

UIBar.destroy()

Is not what I need. I need the UI Bar. I would also like to avoid ugly workarounds such as putting the UI Bar Toggle back on the screen (my UI bar is on the bottom and out of the way. I’d like it to stay there at all times).

Thank you for any help you can give!

Twine has nothing to do with this. Story format features are their own.

I’m unsure what you mean by “not to display the UIBar”, however, the UI bar is neither hidden nor removed if the viewport is very small. It’s simply stowed. Unless you’re removing the built-in toggle, players can always stow and unstow the bar as necessary.

 

Placing the following into your project’s Story JavaScript should do the trick:
EDIT: :person_facepalming:t2: Definitely. Use the Config setting.

1 Like

TY! I was also pointed to the Config API by a reddit user, and found this answer:

Config.ui.stowBarInitially = false;