Howdy, Stranger!

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

Changing variables with and

My problem might be a little complex, I'll try to keep it as simple as possible since I understand only the basics of twine as it is.

I'm currently using Sugarcube and I have two additional options in the sidebar - 'Appearance' and 'Inventory'.

'Appearance' is simply a reference for what the character looks like and thus I ended it with a <<back>> macro. It doesn't and cannot influence the story in any way.

'Inventory' however, can influence the story as the main character can use items within the inventory cell. Therefore I ended it with a <<return>> macro.

Herein lies the problem. If one goes into 'Appearance' and then 'Inventory' using the sidebar, you'll get stuck in an infinite <<return>> <<back>> loop.

The current fix I have is disabling the Appearance tab when using the Inventory and vice versa. However, when I leave the Inventory tab using <<return>> the appearance tab stays off.

So here's my question. Is there a way to add the <<set $EnableAppearance to 1>> whenever the <<return>> macro is clicked? Or will I have to put <<set $EnableAppearance to 1>> in every other passage in my story because of this?

My apologies if this isn't clear.

Comments

  • EDIT:

    Disregard everything. I've decided to move the inventory option away from the sidebar for now.
  • Is this for SugarCube 1.x? Is your inventory screen a single passage?


    Anyway, you don't need a $variable simply to gate your menu links. Assuming that you're doing something like the following:
    [[Appearance]]
    [[Inventory]]
    
    Then you could simply check the active passage and enable/disable the links based on that, like so:
    <<if passage() is "Inventory">>''Appearance''<<else>>[[Appearance]]<</if>>
    <<if passage() is "Appearance">>''Inventory''<<else>>[[Inventory]]<</if>>
    
    Hopefully, you get the idea. If your inventory screen isn't a single passage, then its guard will need to be modified (e.g. preferably by checking for a tag).


    Additionally, there are other ways to solve this problem:
    • You could use a $variable and passage tags (and a little JavaScript) to automatically record the last non-menu passage, which you could then use to return to the player to the correct passage.
    • You could use modal dialogs (e.g. like Saves) for your menus.
Sign In or Register to comment.