Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to seamlessly unstow, disable stowing and disable the back button, and then re-enabling it later

Hey everyone

i was wondering if it was possible to Unstow the UIbar, then disable stowing and disable the back button, all within a single passage.

Then afterwards re-enable stowing and the back button as a feature in a new passage.

The reason i need this, is because i am making a combat system. It's nice to have the back button as a feature when navigating the story sequences of a twine story, but not so smart when in combat.

Unstowing is because i want health and such to be kept in the UI bar, and i want to make it very clear to the player that the bar is important during combat.

Thanks!

Comments

  • edited July 2017
    You need to state the name and full version number of the story format you are using, as answers can be different for each one. Based on the stow/unstow references I will assume you are using SugarCube 2.18.0

    The UIBar API section of the documentation explains how to use the UIBar.unstow() function to unstow the side-bar, you would generally use a <<script>> macro to call it when used within a Passage:
    <<script>>
    	UIBar.unstow();
    <</script>>
    
    ... you could combine the above with a <<link>> macro to both send the Reader to the first Passage of your Combat System while also unstowing the side-bar like so.
    <<link "Attack the monster" "Combat">>
    	<<script>>
    		UIBar.unstow();
    	<</script>>
    <</link>>
    


    There are a number of different ways to hide the ui-bar's tray, on of the simplest is to assign a passage tag to each of the Passage's you don't want the tray to be visible in and then use a CSS selector based on the name of the tag to hide that element. This CSS would need to be placed within your story's Story Stylesheet area.

    eg. Assuming you assign the relevant passage(s) a tag of no-tray then the related CSS could look the following:
    body[data-tags~="no-tray"] #ui-bar-tray {
    	visibility: hidden;
    }
    
  • edited July 2017
    greyelf wrote: »
    You need to state the name and full version number of the story format you are using, as answers can be different for each one. Based on the stow/unstow references I will assume you are using SugarCube 2.18.0

    Sorry! It's correct that i use SugarCube 2.18.0

    Thanks for the help! It works perfectly :smile:



Sign In or Register to comment.